Support » Plugins » [Plugin: bbPress] How to make display WordPress Roles in bbPress Replies?

  • Resolved Omtesla

    (@itesla)


    Hello support.
    I will launch my site soon and i need to achieve this,for example my members will register to my site through s2member plugin which created Copper Member (Level 1),Silver Member (Level 2) and Gold Member (Level 3) and i will need to see in Forums what role they have when they ask a question for support.
    I have searched for a solution and found this
    Topic i have put this code as he explained but not worked.

    bbp_reply_author_link( array( ‘sep’ => ‘<br />’, ‘show_role’ => false ) );
    $reply_author_id = get_post_field( ‘post_author’, bbp_get_reply_id() );
    $user = new WP_User( $reply_author_id ); if ( !empty( $user->roles ) && is_array( $user->roles ) )
    {
    foreach ( $user->roles as $role )
    {
    /*if (preg_match(“/”.$roles.”/i”, “administrator”))
    {
    echo(“Administrator”);
    break;
    }
    else*/
    echo “<div class=’role_custom_bhush’>”.ucfirst($role).”</div>”;
    break;
    }
    }

    Maybe i do something wrong, can someone help please?

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: bbPress] How to make display WordPress Roles in bbPress Replies?’ is closed to new replies.