本文整理汇总了PHP中BP_Groups_Member::get_is_admin_of方法的典型用法代码示例。如果您正苦于以下问题:PHP BP_Groups_Member::get_is_admin_of方法的具体用法?PHP BP_Groups_Member::get_is_admin_of怎么用?PHP BP_Groups_Member::get_is_admin_of使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BP_Groups_Member
的用法示例。
在下文中一共展示了BP_Groups_Member::get_is_admin_of方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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_admin_of_with_filter
public function test_get_is_admin_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('admin');
$m2 = new BP_Groups_Member($u, $g2);
$m2->promote('admin');
$groups = BP_Groups_Member::get_is_admin_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_admin_of
function groups_get_user_is_admin_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_admin_of($user_id, $pag_num, $pag_page, $filter);
}
示例5: single_row
//.........这里部分代码省略.........
case 'cb':
$r .= "<th scope='row' class='check-column'>{$checkbox}</th>";
break;
case 'info':
add_thickbox();
if (!is_multisite()) {
$url = esc_url(admin_url(add_query_arg(array('page' => 'wangguard_users_info'), 'admin.php')));
} else {
$url = esc_url(network_admin_url(add_query_arg(array('page' => 'wangguard_users_info'), 'admin.php')));
}
$arrayUrl = array('userID' => $row_data->ID, 'userIP' => $row_data->user_ip, '?TB_iframe' => 'true', 'width' => '900', 'height' => '550');
$final_user_info_url = esc_url(add_query_arg($arrayUrl, $url));
$r .= "<td width='25'><a class='thickbox' title='" . __('Info about', 'wangguard') . " {$row_data->first_name} {$row_data->last_name}' href='" . $final_user_info_url . "'><img class='alignnone size-full wp-image-2055' alt='Info about {$row_data->first_name} {$row_data->last_name}' src='" . plugins_url('img/info-wgg.png', __FILE__) . "' width='15' height='15' /> " . __('User Info', 'wangguard') . "</a>";
break;
case 'username':
$r .= "<td {$attributes}>{$avatar} {$report} <span style='font-size:11px'>{$role}" . ($actions ? $this->row_actions($actions) : "") . "</span></td>";
break;
case 'name':
$r .= "<td {$attributes}>{$row_data->first_name} {$row_data->last_name}</td>";
break;
case 'email':
$r .= "<td {$attributes}><a href='mailto:{$email}' title='" . esc_attr(sprintf(__('E-mail: %s'), $email)) . "'>{$email}</a></td>";
break;
case 'user_registered':
$r .= "<td {$attributes}><span style='font-size:11px'>" . date(get_option('date_format'), strtotime($row_data->user_registered)) . " " . date(get_option('time_format'), strtotime($row_data->user_registered)) . "</span></td>";
break;
case 'from_ip':
$r .= "<td {$attributes}>";
$r .= "<div class='wangguard-user-ip' data='{$row_data->user_ip}'><span class='wangguard-user-ip-bb'>";
$r .= $row_data->user_ip;
$r .= '</span>';
if ($row_data->user_ip_is_proxy) {
$r .= " <span class='wangguard_proxy'>" . __('proxy', 'wangguard') . "</span>";
}
$r .= "</div>";
if (!empty($row_data->user_reported_proxy_ip)) {
$r .= "<div class='wangguard-user-ip' data='{$row_data->user_reported_proxy_ip}'><span class='wangguard-user-ip-bb'>";
$r .= $row_data->user_reported_proxy_ip;
$r .= '</span>';
$r .= " <span class='wangguard_proxy'>" . __('reported proxy', 'wangguard') . "</span>";
$r .= "</div>";
}
$r .= "</td>";
break;
case 'posts':
$attributes = 'class="posts column-posts num"' . $style;
$r .= "<td {$attributes}>";
if ($numposts > 0) {
$r .= "<a target='_blank' href='edit.php?author={$row_data->ID}' title='" . esc_attr__('View posts by this author') . "' class='edit'>";
$r .= $numposts;
$r .= '</a>';
} else {
$r .= 0;
}
$r .= "</td>";
break;
case 'blogs':
add_thickbox();
$r .= "<td {$attributes}>";
if (function_exists("get_blogs_of_user")) {
$blogs = @get_blogs_of_user($row_data->ID, true);
if (is_array($blogs)) {
foreach ((array) $blogs as $key => $details) {
$r .= '- <a href="' . $details->siteurl . '?TB_iframe=true&width=900&height=550" class="thickbox" title="' . htmlentities($details->siteurl, 0, 'UTF-8') . '">' . $details->blogname . '</a><br/>';
}
}
}
$r .= "</td>";
break;
case 'groups':
add_thickbox();
$r .= "<td {$attributes}>";
if (defined('BP_VERSION') && class_exists('BP_Groups_member')) {
global $bp;
$bpgrpupsslug = $bp->groups->root_slug;
$groups = BP_Groups_Member::get_is_admin_of($row_data->ID);
foreach ($groups as $group) {
if (is_array($group)) {
foreach ($group as $detail) {
$groupdomain = $bp->root_domain;
$bpgroupsslug = $bp->groups->root_slug;
$groupslug = $detail->slug;
$groupname = $detail->name;
$r .= '- <a href="' . $groupdomain . '/' . $bpgroupsslug . '/' . $groupslug . '/?TB_iframe=true&width=900&height=550" class="thickbox" title="' . htmlentities($groupdomain . '/' . $bpgrpupsslug . '/' . $groupslug, 0, 'UTF-8') . '">' . $groupname . '</a><br/>';
}
} else {
continue;
}
}
}
$r .= "</td>";
break;
case 'wgstatus':
$r .= "<td {$attributes}>" . $statushtml . "</td>";
break;
}
}
$r .= '</tr>';
return $r;
}
示例6: bfox_bp_plans_user_owner_options
function bfox_bp_plans_user_owner_options($user_id = 0)
{
if (!$user_id) {
$user_id = $GLOBALS['user_ID'];
}
$results = BP_Groups_Member::get_is_admin_of($user_id);
$options = array();
foreach ((array) $results['groups'] as $group) {
$id = BfoxOwnedObject::owner_type_group . '-' . $group->id;
$options[$id] = stripslashes($group->name);
}
return $options;
}