BuddyDev

Search

Replies

  • Participant
    Level: Initiated
    Posts: 2
    Mitch on #6888

    Excellent Brajesh, thank you. I was close. In my guessing, I had also tried bp_core_get_user_link 🙂

    But what I can’t figure out is why ‘ $role->name ‘ displays the wrong WP Role. This code displays the default WP/S2Member role name, even though I have specifically changed the S2/WP role name (via User Role Editor).

    I also tried ‘ role->display_name ‘ and ‘ $user_info->role ‘ – neither worked (at least I tried) 🙂 and I just don’t know enough for where to look to resolve. Any ideas?

    Thanks again. Have a great day.

  • Participant
    Level: Initiated
    Posts: 2
    Mitch on #6871

    Hello Brajesh,

    This is great. It worked first try, thanks so much.

    There were a couple of things I wanted to see if I could add. In the above code, it displays the user name, but it does not link like a normal activity post. I searched around and tried a few solutions (trial and error) 🙂 until finally this worked (so I thought):

    I changed:

    $action = sprintf( '%s has become %s', bp_core_get_user_displayname( $user_id ), $role->name );

    to

    $action = sprintf( '<a href="'. bp_get_loggedin_user_link() .'">%s</a> has become %s', bp_core_get_user_displayname( $user_id ), $role->name );
    

    I thought I was smart, only to find that link to MY profile, not to the user listed in the activity update. Whoops. 🙂

    If I wanted to make this user name display link to the user’s profile like a traditional activity stream update, how would I change this code?

    Thanks, and have a great day!