Problem with checking if a user is in a group (SOLVED (maybe?))
-
Hi, since updating to the latest buddypress i’ve had issues with detecting if a member is in a specific group.
I have the following function
public function user_is_mod() {
global $bp;
if(function_exists(‘groups_get_group’) && function_exists(‘bp_group_is_member’)) {
$modgroup = groups_get_group( array(“group_id” => 1) );
if($_SERVER == “84.13.3.11”) {
var_dump($modgroup);
var_dump(bp_group_is_member($modgroup));
}
if ($modgroup->is_member === 1) {
return true;
} else return false;
} else return false;
//return false;
}Which is returning true for all members
I added some debug code and that is returning
object(BP_Groups_Group)#452 (14) {
[“id”]=>
string(1) “1”
[“creator_id”]=>
string(1) “2”
[“name”]=>
string(10) “Moderators”
[“slug”]=>
string(10) “moderators”
[“description”]=>
string(19) “The site moderators”
[“status”]=>
string(7) “private”
[“enable_forum”]=>
string(1) “0”
[“date_created”]=>
string(19) “2012-04-03 11:34:20”
[“total_member_count”]=>
string(2) “14”
[“is_member”]=>
int(1)
[“last_activity”]=>
string(19) “2012-07-28 15:24:08”
[“user_has_access”]=>
bool(true)
}
bool(true)in particular the important bits are:
[“is_member”]=>
int(1)
[“last_activity”]=>
string(19) “2012-07-28 15:24:08”
[“user_has_access”]=>
bool(true)
}
bool(true)this is for a user that is not in the group, does anyone have any ideas?
- The topic ‘Problem with checking if a user is in a group (SOLVED (maybe?))’ is closed to new replies.