Skip to:
Content
Pages
Categories
Search
Top
Bottom

Display user’s role on the members-loop.php file

  • Been trying to get this sniped all day long without success.

    Just trying to display the wordpress user’s role on the member’s loop.

    Did try several different ways but haven’t be able to do so

    it’s there any help on this?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Avatar of shanebpdev
    shanebpdev
    Participant

    @shanebp

    edit: thanks modemlooper – much better approach

    Avatar of @modemlooper
    @modemlooper
    Moderator

    @modemlooper

    Don’t query table, BP and WP has methods to get the info.

    plop this inside the members loop:

    `<?php
    global $members_template;

    $user_id = $members_template->member->id;
    $user = new WP_User($user_id);

    $role = array_keys($user->wp_capabilities,”1″);

    echo ‘User Level: ‘ . $role[0];
    ?>`

    Avatar of Dan Beil
    Dan Beil
    Participant

    @dan-gaia

    Thank You so much….I ended up using this to remove s2member’s ‘free subscriber’ from the member’s list…Lots of Help!

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

You must be logged in to reply to this topic.