UserPro Forums
  • Create new topic
  • Forums
    • No replies topics
    • Newest topics
    • Forum statistics
  • Account
    • Lost password
    • Register
    • Login
  • Documentation
  • Back to main site

Community Forums

User To User Support Forum/Forums/Customization Help / Requests/bbPress @mentions vs. UserPro

bbPress @mentions vs. UserPro

bbPressfacebookusername
  • 8 years, 4 months ago AvatarTenebral
    Participant

    If someone register trough facebook button, the “username” defined is the email address.

    For example, my username is: [email protected]

    So, when you want to mention my name in bbPress you should use: @tenebralyogmail-com which is pretty ugly and inappropriate, and of course the profile linked there is the bbPress profile, not the userpro one.

    Possible solution (suggestion): the wordpress username should be the FIRST name or full name from facebook profiles.

    Would be nice if you guys share some custom code to fix this, while we wait for definitive solution.

    8 years, 4 months ago AvatarTenebral
    Participant

    Solution:

    You’ll need to add this in your theme’s functions.php or bbpress-functions.php

    PHP
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    /**
    * Use the display name instead of username in bbPress profiles URL
    */
     
    add_action( 'init', 'nicenames_to_display_name' );
    function nicenames_to_display_name() {
        foreach ( get_users() as $user ) {
    if ( $user->data->user_status == 0 && $user->data->user_nicename != $user->data->display_name ) {
    $user_ids[] = $user->ID;
    }
    }
    foreach( $user_ids as $uid ) {
    $info = get_userdata( $uid );
    $display_name = $info->data->display_name;
    if ($display_name) {
    $args = array(
    'ID'            => $uid,
    'user_nicename' => strtolower(str_replace(" ", "_", $display_name))
    );
    wp_update_user( $args );
    }
    }
    }

    source: https://bbpress.org/forums/topic/user-profile-url-uses-the-username-can-that-be-changed/

    Additionally (optional) you can add this too:

    PHP
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    /**
    * Add @mentionname after bbpress forum author details
    */
     
    add_action( 'bbp_theme_after_reply_author_details', 'mentionname_to_bbpress' );
    function mentionname_to_bbpress () {
    $user = get_userdata( bbp_get_reply_author_id() );
    if ( !empty( $user->user_nicename ) ) {
    $user_nicename = $user->user_nicename;
    echo "@".$user_nicename;
    }
    }

    source: https://bbpress.org/forums/topic/putting-the-mention-below-name/

    enjoy!

    8 years, 4 months ago Avataradmin
    Keymaster

    Thanks so much for sharing the solution ! Appreciate it

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

Disclaimer

This forum is 100% free and USER to USER support only. Technical support staff doesn’t monitor this forum actively.

If you are a customer and want to get technical support from our staff please submit a technical support ticket here: UserPRO Technical Support

Recent Topics

  • Custom Badges AddOn Plugin here
  • Green Trust Cash APplication
  • How to use cash app without a bank account
  • Install Cash App on your Device [100%] by yourself | Step-by-Step Guide
  • Green Trust Cash Application

About forum

Here you can find help from UserPro plugin developers and other UserPro fellow users. Please be polite and ask your questions. NO SPAM!

Search Forums

Follow us

  • facebook
  • twitter
  • youtube
© Copyright UserPro