Created
July 18, 2012 20:25
-
-
Save rachelbaker/3138658 to your computer and use it in GitHub Desktop.
Determine BuddyPress User Role in Members Loop
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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