PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Setting a default display name when registring

  1. On http://www.dagenspharma.dk we’re using ’User Registration Add-On’ for signing up people as subscribers.

    The only problem is, that we would like set the users display name to be his/hers full name, not the username, as wordpress would want us to.

    Since ’User Registration Add-On will not let us map a field in the form to be display-name, we’ve tried to change a couple of lines in user.php (/wp-includes) like this:

    BEFORE
    if ( empty($display_name) )
    $display_name = $display_name;
    $display_name = apply_filters('pre_user_display_name', $display_name);

    AFTER
    if ( empty($display_name) )
    $display_name = $first_name.' '.$last_name;
    $display_name = apply_filters('pre_user_display_name', $display_name);

    It actually works, when a user is created from the wordpress-backend, but not when a user creates his own account from our frontpage. In that case the display-name is just left blank.

    any ideas, anyone?

    Posted 13 years ago on Tuesday March 8, 2011 | Permalink
  2. Hey there, give this a shot: http://pastie.org/1647908

    Just paste that in your theme's functions.php file. It uses a GF User Registration hook to update the display name to the full name immediately after the user is registered.

    Posted 13 years ago on Tuesday March 8, 2011 | Permalink
  3. It works nicely

    Posted 13 years ago on Thursday March 31, 2011 | Permalink

This topic has been resolved and has been closed to new replies.