本文整理汇总了PHP中BP_Groups_Member::get_group_moderator_ids方法的典型用法代码示例。如果您正苦于以下问题:PHP BP_Groups_Member::get_group_moderator_ids方法的具体用法?PHP BP_Groups_Member::get_group_moderator_ids怎么用?PHP BP_Groups_Member::get_group_moderator_ids使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BP_Groups_Member
的用法示例。
在下文中一共展示了BP_Groups_Member::get_group_moderator_ids方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: groups_get_group_mods
/**
* Get a list of group moderators.
*
* @param int $group_id ID of the group.
*
* @return array Info about group admins (user_id + date_modified).
*/
function groups_get_group_mods($group_id)
{
return BP_Groups_Member::get_group_moderator_ids($group_id);
}
示例2: crowdmentions_activity_after_save_group_activity_comment
/**
* Process a group activity comment.
*
* @since 1.0.0
*
* @param object $activity The activity item being saved.
*/
function crowdmentions_activity_after_save_group_activity_comment($activity)
{
if ($activity->type !== 'activity_comment') {
return;
}
$root_activity = new BP_Activity_Activity($activity->item_id);
if ($root_activity->component !== 'groups') {
return;
}
// Find mentions in the activity item's content.
$mentions = crowdmentions_find_mentions($activity->content);
foreach ((array) array_values($mentions) as $mention) {
if (!bp_is_active('groups') && $mention === 'group') {
continue;
}
if (!bp_is_active('groups') && $mention === 'moderators') {
continue;
}
if (!bp_is_active('groups') && $mention === 'administrators') {
continue;
}
if (!bp_is_active('friends') && $mention === 'friends') {
continue;
}
switch ($mention) {
case 'group':
$args = array('user_ids' => BP_Groups_Member::get_group_member_ids($root_activity->item_id), 'user_id' => $activity->user_id, 'item_id' => $activity->id, 'secondary_item_id' => $root_activity->item_id, 'component_action' => 'mention_group_' . $activity->id);
break;
case 'moderators':
$user_ids = [];
$mods = BP_Groups_Member::get_group_moderator_ids($root_activity->item_id);
// Get an array of moderator IDs.
foreach ((array) $mods as $mod) {
$user_ids[] = $mod->user_id;
}
$args = array('user_ids' => $user_ids, 'user_id' => $activity->user_id, 'item_id' => $activity->id, 'secondary_item_id' => $root_activity->item_id, 'component_action' => 'mention_moderators_' . $activity->id);
break;
case 'administrators':
$user_ids = [];
$admins = BP_Groups_Member::get_group_administrator_ids($root_activity->item_id);
// Get an array of administrator IDs.
foreach ((array) $admins as $admin) {
$user_ids[] = $admin->user_id;
}
$args = array('user_ids' => $user_ids, 'user_id' => $activity->user_id, 'item_id' => $activity->id, 'secondary_item_id' => $root_activity->item_id, 'component_action' => 'mention_administrators_' . $activity->id);
break;
case 'friends':
$friend_ids = BP_Friends_Friendship::get_friend_user_ids($activity->user_id, false, false);
$args = array('user_ids' => array_intersect(BP_Groups_Member::get_group_member_ids($root_activity->item_id), $friend_ids), 'user_id' => $activity->user_id, 'item_id' => $activity->id, 'secondary_item_id' => $root_activity->item_id, 'component_action' => 'mention_friends_' . $activity->id);
break;
default:
// Skip to the next iteration.
continue 2;
}
// Send notifications.
crowdmentions_send_notifications($args);
}
}
示例3: bp_gtm_search_gmembers
function bp_gtm_search_gmembers($search_term, $limit, $group_id, $role)
{
global $bp, $wpdb;
if ($role == 'admins') {
$allmembers = BP_Groups_Member::get_group_administrator_ids($group_id);
} elseif ($role == 'mods') {
$allmembers = BP_Groups_Member::get_group_moderator_ids($group_id);
} elseif ($role == 'members') {
$allmembers = BP_Groups_Member::get_group_member_ids($group_id);
}
/* Fetch the user's full name */
// if (function_exists('xprofile_install')) {
/* Ensure xprofile globals are set */
if (!defined('BP_XPROFILE_FULLNAME_FIELD_NAME')) {
xprofile_setup_globals();
}
$allmembers = $wpdb->escape(implode(',', (array) $allmembers));
$members = $wpdb->get_results($wpdb->prepare("\n SELECT `user_id` as `id` FROM {$bp->profile->table_name_data}\n WHERE `field_id` = 1 AND `user_id` IN ( {$allmembers} ) AND `value` LIKE '%%{$search_term}%%'\n LIMIT %d\n ", $limit));
return $members;
}
示例4: set_up_admins_and_mods
/**
* Set up admins and mods for the current group object.
*
* Called only when the 'admins' or 'mods' property is accessed.
*
* @since 2.7.0
*/
protected function set_up_admins_and_mods()
{
$admin_ids = BP_Groups_Member::get_group_administrator_ids($this->id);
$admin_ids_plucked = wp_list_pluck($admin_ids, 'user_id');
$mod_ids = BP_Groups_Member::get_group_moderator_ids($this->id);
$mod_ids_plucked = wp_list_pluck($mod_ids, 'user_id');
$admin_mod_users = get_users(array('include' => array_merge($admin_ids_plucked, $mod_ids_plucked)));
$admin_objects = $mod_objects = array();
foreach ($admin_mod_users as $admin_mod_user) {
$obj = new stdClass();
$obj->user_id = $admin_mod_user->ID;
$obj->user_login = $admin_mod_user->user_login;
$obj->user_email = $admin_mod_user->user_email;
$obj->user_nicename = $admin_mod_user->user_nicename;
if (in_array($admin_mod_user->ID, $admin_ids_plucked, true)) {
$obj->is_admin = 1;
$obj->is_mod = 0;
$admin_objects[] = $obj;
} else {
$obj->is_admin = 0;
$obj->is_mod = 1;
$mod_objects[] = $obj;
}
}
$this->admins = $admin_objects;
$this->mods = $mod_objects;
}