Membership Plugin

WordPress Membership Plugin

  • Home
  • Documentation
  • Addons
  • Support
    • Quick Setup
    • Documentation
    • Premium Addon Support
    • Paid Support
    • Support Forum
    • Support Forum Search
    • Forum Login
    • Forum Registration
  • Contact

[Support request] Change the wordpress user display name

Simple Membership Plugin › Forums › Simple Membership Plugin › Change the wordpress user display name

Tagged: change display name, create users, user, users

  • This topic has 1 reply, 2 voices, and was last updated 5 years, 4 months ago by mbrsolution.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • March 29, 2021 at 6:35 am #22330
    PierreL
    Participant

    Hello, I’m trying to change the wordpress user display name when a simple membership user is created.

    I’m trying this following code :

    
    function change_display_name_user_register ( $user_id ) {
        
        // get the user meta data
        $user_info_other = get_user_meta( $user_id );
    
        // pick our default display name
        $display_publicly_as = $user_info_other["first_name"][0] . " " . $user_info_other["last_name"][0];
        // update the display name
    
        wp_update_user( array ('ID' => $user_id, 'display_name' =>  $display_publicly_as));
    }
    add_action( 'user_register', 'change_display_name_user_register', 10, 1 ); 
    

    this code seems to work but it does not change anything.

    what’s wrong with this, is there an other “hook” to use to redefine wordpress display_name ?

    Is someone has already dealt with this case ?

    Thanks in advance for your help.

    April 4, 2021 at 7:26 am #22402
    mbrsolution
    Moderator

    Hi, for code development questions, please create a paid support ticket.

    Thank you

  • Author
    Posts
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Log In

Please read this message before using our plugin.

Search

Featured Addons and Extensions

  • Membership Form Builder Addon
  • Member Directory Listing Addon
  • WooCommerce Payment Integration
  • Member Data Exporter Addon

Documentation

  • Documentation Index Page

Copyright © 2026 | Simple Membership Plugin | Privacy Policy