• We would like to create the nickname of the profile from two fields (first name and last name), as this is displayed in the title of the profile for SEO purposes.

    We are missing the variable to be read. Here is a code that creates the nickname from the first and last name. For the variables first_name and last_name we need the corresponding variables of the fields of the profile files.

    add_action(‘admin_head’, function () {
    foreach (get_users([‘fields’ => ‘all’]) as $user) {
    $userData = get_userdata($user->ID);
    wp_update_user([‘ID’ => $user->ID, ‘display_name’ => $userData->first_name . ‘ ‘ . $userData->last_name?: $user->display_login]);
    }
    });

    Thanks!

Viewing 1 replies (of 1 total)
  • Plugin Author BuddyDev

    (@buddydev)

    Hi,

    I am sorry, I am unable to understand your question.

    Our plugin offers custom xprofile field type. I will suggest reaching out to BuddyPress or BuddyBoss team( depending onwhich software you are using). They can assist you better with nickname customization.

    Regards

    BuddyDev support Team

Viewing 1 replies (of 1 total)
  • The topic ‘create the nickname of the profile from two fields’ is closed to new replies.