Created
December 27, 2013 20:45
-
-
Save 8lane/8152412 to your computer and use it in GitHub Desktop.
Wordpress Multisite + Groups Plugin: Check if user is in group
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 | |
$blog_id = 1; //set the blog id to the main site id | |
switch_to_blog( $blog_id ); | |
$user_id = get_current_user_id(); | |
$group = Groups_Group::read_by_name( 'Premium' ); | |
if ( Groups_User_Group::read( $user_id, $group->group_id ) ) { | |
echo 'Premium'; | |
} else { | |
echo 'Not premium'; | |
} | |
restore_current_blog(); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment