Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search for user role


  • noizeburger
    Participant

    @noizeburger

    Hy,

    after searching the forums I found a solution to show the role of a user in its profile:
    in my bp-custom.php I put

    function pc_get_userrole ($user_id) {
    
    $user = new WP_User($user_id);
    
    $userclean = $user->roles[0];
    
    return $userclean;
    
    }

    and call it in my member-header.php like this

    <?php echo pc_get_userrole(bp_current_user_id()); ?>

    My question is, how to make the output searchable. I managed to make a link, but it shows an error – page not found. Any ideas?

    If you take a look – for example here:
    you can see “BAND” – this is the user role I want to make searchable.

Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Search for user role’ is closed to new replies.
Skip to toolbar