Skip to content

Instantly share code, notes, and snippets.

@rachelbaker
Created July 18, 2012 20:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rachelbaker/3138658 to your computer and use it in GitHub Desktop.
Save rachelbaker/3138658 to your computer and use it in GitHub Desktop.
Determine BuddyPress User Role in Members Loop
<?php
// Grab member's userid
$bpuser_id = bp_get_member_user_id();
// Fetch the user's information based on the userid
$user_info = get_userdata($bpuser_id);
// Fetch the user's user level.
// Find more on user levels here: http://codex.wordpress.org/User_Levels
$user_role = $user_info->user_level;
if ( $user_role == '10') {
echo "You are an admin!";
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment