本文整理汇总了PHP中BP_Groups_Member::get_is_mod_of方法的典型用法代码示例。如果您正苦于以下问题:PHP BP_Groups_Member::get_is_mod_of方法的具体用法?PHP BP_Groups_Member::get_is_mod_of怎么用?PHP BP_Groups_Member::get_is_mod_of使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BP_Groups_Member
的用法示例。
在下文中一共展示了BP_Groups_Member::get_is_mod_of方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: set_up_user_groups
/**
* Get a list of a user's groups, as well as those groups of which
* the user is an admin or mod
*
* @since 1.2
*/
protected function set_up_user_groups()
{
$groups = BP_Groups_Member::get_group_ids($this->user_id);
$this->user_groups['groups'] = $groups['groups'];
$admin_groups = BP_Groups_Member::get_is_admin_of($this->user_id);
$mod_groups = BP_Groups_Member::get_is_mod_of($this->user_id);
$this->user_groups['admin_mod_of'] = array_merge(wp_list_pluck($admin_groups['groups'], 'id'), wp_list_pluck($mod_groups['groups'], 'id'));
}
示例2: test_get_is_mod_of_with_filter
public function test_get_is_mod_of_with_filter()
{
$g1 = $this->factory->group->create(array('name' => 'RC Cola'));
$g2 = $this->factory->group->create(array('name' => 'Pepsi'));
$u = $this->factory->user->create();
self::add_user_to_group($u, $g1);
self::add_user_to_group($u, $g2);
$m1 = new BP_Groups_Member($u, $g1);
$m1->promote('mod');
$m2 = new BP_Groups_Member($u, $g2);
$m2->promote('mod');
$groups = BP_Groups_Member::get_is_mod_of($u, false, false, 'eps');
$ids = wp_list_pluck($groups['groups'], 'id');
$this->assertEquals($ids, array($g2));
}
示例3: bpfb_documents_allowed
/**
* Checks upload permissions.
* Adapted from Group Documents plugin.
*/
function bpfb_documents_allowed($group = false)
{
if (!$group) {
return false;
}
$user = wp_get_current_user();
$moderator_of = BP_Groups_Member::get_is_admin_of($user->ID) + BP_Groups_Member::get_is_mod_of($user->ID);
$moderator_of = is_array($moderator_of) && isset($moderator_of['groups']) ? $moderator_of['groups'] : false;
$is_mod = false;
foreach ($moderator_of as $gm) {
if ($gm->id == $group->id) {
$is_mod = true;
break;
}
}
switch (get_option('bp_group_documents_upload_permission')) {
case 'mods_decide':
switch (groups_get_groupmeta($group->id, 'group_documents_upload_permission')) {
case 'mods_only':
if ($is_mod) {
return true;
}
break;
case 'members':
default:
if (bp_group_is_member($group)) {
return true;
}
break;
}
break;
case 'mods_only':
if ($is_mod) {
return true;
}
break;
case 'members':
default:
if (bp_group_is_member($group)) {
return true;
}
break;
}
return false;
}
示例4: groups_get_user_is_mod_of
function groups_get_user_is_mod_of($user_id = false, $pag_num = false, $pag_page = false, $filter = false)
{
global $bp;
if (!$user_id) {
$user_id = $bp->displayed_user->id;
}
return BP_Groups_Member::get_is_mod_of($user_id, $pag_num, $pag_page, $filter);
}