Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)

  • Stagger Lee
    Participant

    @stagger-lee

    Yes, I see now it is RC2 version of PHP. Get lost, why I am using it.
    Stable version is 7.0.1, that tricked me.

    Anyway it is here if you want to take a look. It is waiting for you anyway.


    Stagger Lee
    Participant

    @stagger-lee

    add_action( 'bp_before_member_header_meta', 'devb_show_role_on_profile');
    function devb_show_role_on_profile(){
     global $wp_roles;
     
    $user_id = bp_displayed_user_id();
     
    $user = get_userdata( $user_id );
     
    $roles = $user->roles;
     
     if( !$roles)
     return ;
     
     if ( !isset( $wp_roles ) )
     $wp_roles = new WP_Roles();
     
     $named_roles = array();
     
    foreach( $roles as $role ){
     
    $named_roles [] = $wp_roles->role_names[$role];
     }
     
    if( $named_roles )
     echo '<span class="user-role activity">'. join( ', ', $named_roles ) . '</span>';
     
    }

    Showing User role on BuddyPress Profile

Viewing 2 replies - 1 through 2 (of 2 total)
Skip to toolbar