本文整理汇总了PHP中groups_ban_member函数的典型用法代码示例。如果您正苦于以下问题:PHP groups_ban_member函数的具体用法?PHP groups_ban_member怎么用?PHP groups_ban_member使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了groups_ban_member函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: groups_screen_group_admin_manage_members
/**
* This function handles actions related to member management on the group admin.
*/
function groups_screen_group_admin_manage_members()
{
if ('manage-members' != bp_get_group_current_admin_tab()) {
return false;
}
if (!bp_is_item_admin()) {
return false;
}
$bp = buddypress();
if (bp_action_variable(1) && bp_action_variable(2) && bp_action_variable(3)) {
if (bp_is_action_variable('promote', 1) && (bp_is_action_variable('mod', 2) || bp_is_action_variable('admin', 2)) && is_numeric(bp_action_variable(3))) {
$user_id = bp_action_variable(3);
$status = bp_action_variable(2);
// Check the nonce first.
if (!check_admin_referer('groups_promote_member')) {
return false;
}
// Promote a user.
if (!groups_promote_member($user_id, $bp->groups->current_group->id, $status)) {
bp_core_add_message(__('There was an error when promoting that user. Please try again.', 'buddypress'), 'error');
} else {
bp_core_add_message(__('User promoted successfully', 'buddypress'));
}
/**
* Fires before the redirect after a group member has been promoted.
*
* @since 1.0.0
*
* @param int $user_id ID of the user being promoted.
* @param int $id ID of the group user is promoted within.
*/
do_action('groups_promoted_member', $user_id, $bp->groups->current_group->id);
bp_core_redirect(bp_get_group_permalink(groups_get_current_group()) . 'admin/manage-members/');
}
}
if (bp_action_variable(1) && bp_action_variable(2)) {
if (bp_is_action_variable('demote', 1) && is_numeric(bp_action_variable(2))) {
$user_id = bp_action_variable(2);
// Check the nonce first.
if (!check_admin_referer('groups_demote_member')) {
return false;
}
// Stop sole admins from abandoning their group.
$group_admins = groups_get_group_admins($bp->groups->current_group->id);
if (1 == count($group_admins) && $group_admins[0]->user_id == $user_id) {
bp_core_add_message(__('This group must have at least one admin', 'buddypress'), 'error');
} elseif (!groups_demote_member($user_id, $bp->groups->current_group->id)) {
bp_core_add_message(__('There was an error when demoting that user. Please try again.', 'buddypress'), 'error');
} else {
bp_core_add_message(__('User demoted successfully', 'buddypress'));
}
/**
* Fires before the redirect after a group member has been demoted.
*
* @since 1.0.0
*
* @param int $user_id ID of the user being demoted.
* @param int $id ID of the group user is demoted within.
*/
do_action('groups_demoted_member', $user_id, $bp->groups->current_group->id);
bp_core_redirect(bp_get_group_permalink(groups_get_current_group()) . 'admin/manage-members/');
}
if (bp_is_action_variable('ban', 1) && is_numeric(bp_action_variable(2))) {
$user_id = bp_action_variable(2);
// Check the nonce first.
if (!check_admin_referer('groups_ban_member')) {
return false;
}
// Ban a user.
if (!groups_ban_member($user_id, $bp->groups->current_group->id)) {
bp_core_add_message(__('There was an error when banning that user. Please try again.', 'buddypress'), 'error');
} else {
bp_core_add_message(__('User banned successfully', 'buddypress'));
}
/**
* Fires before the redirect after a group member has been banned.
*
* @since 1.0.0
*
* @param int $user_id ID of the user being banned.
* @param int $id ID of the group user is banned from.
*/
do_action('groups_banned_member', $user_id, $bp->groups->current_group->id);
bp_core_redirect(bp_get_group_permalink(groups_get_current_group()) . 'admin/manage-members/');
}
if (bp_is_action_variable('unban', 1) && is_numeric(bp_action_variable(2))) {
$user_id = bp_action_variable(2);
// Check the nonce first.
if (!check_admin_referer('groups_unban_member')) {
return false;
}
// Remove a ban for user.
if (!groups_unban_member($user_id, $bp->groups->current_group->id)) {
bp_core_add_message(__('There was an error when unbanning that user. Please try again.', 'buddypress'), 'error');
} else {
bp_core_add_message(__('User ban removed successfully', 'buddypress'));
}
//.........这里部分代码省略.........
示例2: bp_groups_admin_load
//.........这里部分代码省略.........
$admin_count++;
break;
}
}
if (!$admin_count) {
$redirect_to = add_query_arg('no_admins', 1, $redirect_to);
$error = $group_id;
} else {
// Process only those users who have had their roles changed
foreach ((array) $_POST['bp-groups-role'] as $user_id => $new_role) {
$existing_role = isset($_POST['bp-groups-existing-role'][$user_id]) ? $_POST['bp-groups-existing-role'][$user_id] : '';
if ($existing_role != $new_role) {
switch ($new_role) {
case 'mod':
// Admin to mod is a demotion. Demote to
// member, then fall through
if ('admin' == $existing_role) {
groups_demote_member($user_id, $group_id);
}
case 'admin':
// If the user was banned, we must
// unban first
if ('banned' == $existing_role) {
groups_unban_member($user_id, $group_id);
}
// At this point, each existing_role
// is a member, so promote
$result = groups_promote_member($user_id, $group_id, $new_role);
break;
case 'member':
if ('admin' == $existing_role || 'mod' == $existing_role) {
$result = groups_demote_member($user_id, $group_id);
} elseif ('banned' == $existing_role) {
$result = groups_unban_member($user_id, $group_id);
}
break;
case 'banned':
$result = groups_ban_member($user_id, $group_id);
break;
case 'remove':
$result = groups_remove_member($user_id, $group_id);
break;
}
// Store the success or failure
if ($result) {
$success_modified[] = $user_id;
} else {
$error_modified[] = $user_id;
}
}
}
}
}
/**
* Fires before redirect so plugins can do something first on save action.
*
* @since 1.6.0
*
* @param int $group_id ID of the group being edited.
*/
do_action('bp_group_admin_edit_after', $group_id);
// Create the redirect URL
if ($error) {
// This means there was an error updating group details
$redirect_to = add_query_arg('error', (int) $error, $redirect_to);
} else {
// Group details were update successfully
$redirect_to = add_query_arg('updated', 1, $redirect_to);
}
if (!empty($success_new)) {
$success_new = implode(',', array_filter($success_new, 'urlencode'));
$redirect_to = add_query_arg('success_new', $success_new, $redirect_to);
}
if (!empty($error_new)) {
$error_new = implode(',', array_filter($error_new, 'urlencode'));
$redirect_to = add_query_arg('error_new', $error_new, $redirect_to);
}
if (!empty($success_modified)) {
$success_modified = implode(',', array_filter($success_modified, 'urlencode'));
$redirect_to = add_query_arg('success_modified', $success_modified, $redirect_to);
}
if (!empty($error_modified)) {
$error_modified = implode(',', array_filter($error_modified, 'urlencode'));
$redirect_to = add_query_arg('error_modified', $error_modified, $redirect_to);
}
/**
* Filters the URL to redirect to after successfully editing a group.
*
* @since 1.7.0
*
* @param string $redirect_to URL to redirect user to.
*/
wp_redirect(apply_filters('bp_group_admin_edit_redirect', $redirect_to));
exit;
// If a referrer and a nonce is supplied, but no action, redirect back.
} elseif (!empty($_GET['_wp_http_referer'])) {
wp_redirect(remove_query_arg(array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI'])));
exit;
}
}
示例3: groups_screen_group_admin_manage_members
function groups_screen_group_admin_manage_members() {
global $bp;
if ( $bp->current_component == $bp->groups->slug && 'manage-members' == $bp->action_variables[0] ) {
if ( !$bp->is_item_admin )
return false;
if ( 'promote' == $bp->action_variables[1] && ( 'mod' == $bp->action_variables[2] || 'admin' == $bp->action_variables[2] ) && is_numeric( $bp->action_variables[3] ) ) {
$user_id = $bp->action_variables[3];
$status = $bp->action_variables[2];
// Check the nonce first.
if ( !check_admin_referer( 'groups_promote_member' ) )
return false;
// Promote a user.
if ( !groups_promote_member( $user_id, $bp->groups->current_group->id, $status ) )
bp_core_add_message( __( 'There was an error when promoting that user, please try again', 'buddypress' ), 'error' );
else
bp_core_add_message( __( 'User promoted successfully', 'buddypress' ) );
do_action( 'groups_promoted_member', $user_id, $bp->groups->current_group->id );
bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) . 'admin/manage-members/' );
}
if ( 'demote' == $bp->action_variables[1] && is_numeric( $bp->action_variables[2] ) ) {
$user_id = $bp->action_variables[2];
// Check the nonce first.
if ( !check_admin_referer( 'groups_demote_member' ) )
return false;
// Demote a user.
if ( !groups_demote_member( $user_id, $bp->groups->current_group->id ) )
bp_core_add_message( __( 'There was an error when demoting that user, please try again', 'buddypress' ), 'error' );
else
bp_core_add_message( __( 'User demoted successfully', 'buddypress' ) );
do_action( 'groups_demoted_member', $user_id, $bp->groups->current_group->id );
bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) . 'admin/manage-members/' );
}
if ( 'ban' == $bp->action_variables[1] && is_numeric( $bp->action_variables[2] ) ) {
$user_id = $bp->action_variables[2];
// Check the nonce first.
if ( !check_admin_referer( 'groups_ban_member' ) )
return false;
// Ban a user.
if ( !groups_ban_member( $user_id, $bp->groups->current_group->id ) )
bp_core_add_message( __( 'There was an error when banning that user, please try again', 'buddypress' ), 'error' );
else
bp_core_add_message( __( 'User banned successfully', 'buddypress' ) );
do_action( 'groups_banned_member', $user_id, $bp->groups->current_group->id );
bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) . 'admin/manage-members/' );
}
if ( 'unban' == $bp->action_variables[1] && is_numeric( $bp->action_variables[2] ) ) {
$user_id = $bp->action_variables[2];
// Check the nonce first.
if ( !check_admin_referer( 'groups_unban_member' ) )
return false;
// Remove a ban for user.
if ( !groups_unban_member( $user_id, $bp->groups->current_group->id ) )
bp_core_add_message( __( 'There was an error when unbanning that user, please try again', 'buddypress' ), 'error' );
else
bp_core_add_message( __( 'User ban removed successfully', 'buddypress' ) );
do_action( 'groups_unbanned_member', $user_id, $bp->groups->current_group->id );
bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) . 'admin/manage-members/' );
}
if ( 'remove' == $bp->action_variables[1] && is_numeric( $bp->action_variables[2] ) ) {
$user_id = $bp->action_variables[2];
// Check the nonce first.
if ( !check_admin_referer( 'groups_remove_member' ) )
return false;
// Remove a user.
if ( !groups_remove_member( $user_id, $bp->groups->current_group->id ) )
bp_core_add_message( __( 'There was an error removing that user from the group, please try again', 'buddypress' ), 'error' );
else
bp_core_add_message( __( 'User removed successfully', 'buddypress' ) );
do_action( 'groups_removed_member', $user_id, $bp->groups->current_group->id );
bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) . 'admin/manage-members/' );
}
do_action( 'groups_screen_group_admin_manage_members', $bp->groups->current_group->id );
//.........这里部分代码省略.........
示例4: groups_screen_group_admin_manage_members
/**
* This function handles actions related to member management on the group admin.
*/
function groups_screen_group_admin_manage_members()
{
if ('manage-members' != bp_get_group_current_admin_tab()) {
return false;
}
if (!bp_is_item_admin()) {
return false;
}
$bp = buddypress();
if (bp_action_variable(1) && bp_action_variable(2) && bp_action_variable(3)) {
if (bp_is_action_variable('promote', 1) && (bp_is_action_variable('mod', 2) || bp_is_action_variable('admin', 2)) && is_numeric(bp_action_variable(3))) {
$user_id = bp_action_variable(3);
$status = bp_action_variable(2);
// Check the nonce first.
if (!check_admin_referer('groups_promote_member')) {
return false;
}
// Promote a user.
if (!groups_promote_member($user_id, $bp->groups->current_group->id, $status)) {
bp_core_add_message(__('There was an error when promoting that user. Please try again.', 'buddypress'), 'error');
} else {
bp_core_add_message(__('User promoted successfully', 'buddypress'));
}
do_action('groups_promoted_member', $user_id, $bp->groups->current_group->id);
bp_core_redirect(bp_get_group_permalink(groups_get_current_group()) . 'admin/manage-members/');
}
}
if (bp_action_variable(1) && bp_action_variable(2)) {
if (bp_is_action_variable('demote', 1) && is_numeric(bp_action_variable(2))) {
$user_id = bp_action_variable(2);
// Check the nonce first.
if (!check_admin_referer('groups_demote_member')) {
return false;
}
// Stop sole admins from abandoning their group
$group_admins = groups_get_group_admins($bp->groups->current_group->id);
if (1 == count($group_admins) && $group_admins[0]->user_id == $user_id) {
bp_core_add_message(__('This group must have at least one admin', 'buddypress'), 'error');
} elseif (!groups_demote_member($user_id, $bp->groups->current_group->id)) {
bp_core_add_message(__('There was an error when demoting that user. Please try again.', 'buddypress'), 'error');
} else {
bp_core_add_message(__('User demoted successfully', 'buddypress'));
}
do_action('groups_demoted_member', $user_id, $bp->groups->current_group->id);
bp_core_redirect(bp_get_group_permalink(groups_get_current_group()) . 'admin/manage-members/');
}
if (bp_is_action_variable('ban', 1) && is_numeric(bp_action_variable(2))) {
$user_id = bp_action_variable(2);
// Check the nonce first.
if (!check_admin_referer('groups_ban_member')) {
return false;
}
// Ban a user.
if (!groups_ban_member($user_id, $bp->groups->current_group->id)) {
bp_core_add_message(__('There was an error when banning that user. Please try again.', 'buddypress'), 'error');
} else {
bp_core_add_message(__('User banned successfully', 'buddypress'));
}
do_action('groups_banned_member', $user_id, $bp->groups->current_group->id);
bp_core_redirect(bp_get_group_permalink(groups_get_current_group()) . 'admin/manage-members/');
}
if (bp_is_action_variable('unban', 1) && is_numeric(bp_action_variable(2))) {
$user_id = bp_action_variable(2);
// Check the nonce first.
if (!check_admin_referer('groups_unban_member')) {
return false;
}
// Remove a ban for user.
if (!groups_unban_member($user_id, $bp->groups->current_group->id)) {
bp_core_add_message(__('There was an error when unbanning that user. Please try again.', 'buddypress'), 'error');
} else {
bp_core_add_message(__('User ban removed successfully', 'buddypress'));
}
do_action('groups_unbanned_member', $user_id, $bp->groups->current_group->id);
bp_core_redirect(bp_get_group_permalink(groups_get_current_group()) . 'admin/manage-members/');
}
if (bp_is_action_variable('remove', 1) && is_numeric(bp_action_variable(2))) {
$user_id = bp_action_variable(2);
// Check the nonce first.
if (!check_admin_referer('groups_remove_member')) {
return false;
}
// Remove a user.
if (!groups_remove_member($user_id, $bp->groups->current_group->id)) {
bp_core_add_message(__('There was an error removing that user from the group. Please try again.', 'buddypress'), 'error');
} else {
bp_core_add_message(__('User removed successfully', 'buddypress'));
}
do_action('groups_removed_member', $user_id, $bp->groups->current_group->id);
bp_core_redirect(bp_get_group_permalink(groups_get_current_group()) . 'admin/manage-members/');
}
}
do_action('groups_screen_group_admin_manage_members', $bp->groups->current_group->id);
bp_core_load_template(apply_filters('groups_template_group_admin_manage_members', 'groups/single/home'));
}
示例5: groups_screen_group_admin_manage_members
function groups_screen_group_admin_manage_members()
{
global $bp, $group_obj;
if ($bp->current_component == $bp->groups->slug && 'manage-members' == $bp->action_variables[0]) {
if (!$bp->is_item_admin) {
return false;
}
if ('promote' == $bp->action_variables[1] && is_numeric($bp->action_variables[2])) {
$user_id = $bp->action_variables[2];
// Promote a user.
if (!groups_promote_member($user_id, $group_obj->id)) {
bp_core_add_message(__('There was an error when promoting that user, please try again', 'buddypress'), 'error');
} else {
bp_core_add_message(__('User promoted successfully', 'buddypress'));
}
do_action('groups_promoted_member', $user_id, $group_obj->id);
bp_core_redirect(site_url() . '/' . $bp->current_component . '/' . $bp->current_item . '/admin/manage-members');
}
if ('demote' == $bp->action_variables[1] && is_numeric($bp->action_variables[2])) {
$user_id = $bp->action_variables[2];
// Demote a user.
if (!groups_demote_member($user_id, $group_obj->id)) {
bp_core_add_message(__('There was an error when demoting that user, please try again', 'buddypress'), 'error');
} else {
bp_core_add_message(__('User demoted successfully', 'buddypress'));
}
do_action('groups_demoted_member', $user_id, $group_obj->id);
bp_core_redirect(site_url() . '/' . $bp->current_component . '/' . $bp->current_item . '/admin/manage-members');
}
if ('ban' == $bp->action_variables[1] && is_numeric($bp->action_variables[2])) {
$user_id = $bp->action_variables[2];
// Ban a user.
if (!groups_ban_member($user_id, $group_obj->id)) {
bp_core_add_message(__('There was an error when banning that user, please try again', 'buddypress'), 'error');
} else {
bp_core_add_message(__('User banned successfully', 'buddypress'));
}
do_action('groups_banned_member', $user_id, $group_obj->id);
bp_core_redirect(site_url() . '/' . $bp->current_component . '/' . $bp->current_item . '/admin/manage-members');
}
if ('unban' == $bp->action_variables[1] && is_numeric($bp->action_variables[2])) {
$user_id = $bp->action_variables[2];
// Remove a ban for user.
if (!groups_unban_member($user_id, $group_obj->id)) {
bp_core_add_message(__('There was an error when unbanning that user, please try again', 'buddypress'), 'error');
} else {
bp_core_add_message(__('User ban removed successfully', 'buddypress'));
}
do_action('groups_unbanned_member', $user_id, $group_obj->id);
bp_core_redirect(site_url() . '/' . $bp->current_component . '/' . $bp->current_item . '/admin/manage-members');
}
do_action('groups_screen_group_admin_manage_members', $group_obj->id);
bp_core_load_template(apply_filters('groups_template_group_admin_manage_members', 'groups/admin/manage-members'));
}
}
示例6: test_wp_idea_stream_groups_member_banned_hidden_group
/**
* @group remove_from_group
*/
public function test_wp_idea_stream_groups_member_banned_hidden_group()
{
$bp = buddypress();
$group = new BP_Groups_Group($this->group_id);
$group->status = 'hidden';
$group->save();
// Set current group
$bp->groups->current_group = groups_get_group(array('group_id' => $this->group_id, 'populate_extras' => true));
$u = $this->factory->user->create();
groups_join_group($this->group_id, $u);
$idea1 = $this->factory->idea->create(array('author' => $u, 'metas' => array('group_id' => $this->group_id), 'status' => 'private'));
$idea2 = $this->factory->idea->create(array('author' => $u, 'metas' => array('group_id' => $this->group_id), 'status' => 'private'));
$bp->is_item_admin = true;
groups_ban_member($u, $this->group_id);
// Check metas
$this->assertEmpty(wp_idea_stream_ideas_get_meta($idea1, 'group_id'));
$this->assertEmpty(wp_idea_stream_ideas_get_meta($idea2, 'group_id'));
$ideas = wp_idea_stream_ideas_get_ideas(array('include' => array($idea1, $idea2)));
$public_ideas = wp_filter_object_list($ideas['ideas'], array('post_status' => 'publish'), 'and', 'ID');
$this->assertEqualSets(array($idea1, $idea2), $public_ideas, 'When a member is banned from the group, ideas should always be public');
// Reset item admin
$bp->is_item_admin = false;
}
示例7: test_bp_group_is_user_banned_not_in_groups_loop
/**
* @group bp_group_is_user_banned
*/
public function test_bp_group_is_user_banned_not_in_groups_loop()
{
$now = time();
$u1 = $this->factory->user->create(array('last_activity' => date('Y-m-d H:i:s', $now - 100)));
$u2 = $this->factory->user->create(array('last_activity' => date('Y-m-d H:i:s', $now - 100)));
$g1 = $this->factory->group->create(array('creator_id' => $u1));
$g2 = $this->factory->group->create(array('creator_id' => $u2));
$this->add_user_to_group($u1, $g2, array('date_modified' => date('Y-m-d H:i:s', $now - 50)));
$this->add_user_to_group($u2, $g2, array('date_modified' => date('Y-m-d H:i:s', $now - 500)));
$this->add_user_to_group($u1, $g2, array('date_modified' => date('Y-m-d H:i:s', $now - 50)));
// Ban user 1 from group 2
// Fool the admin check
$old_user = get_current_user_id();
$this->set_current_user($u2);
buddypress()->is_item_admin = true;
groups_ban_member($u1, $g2);
// Do group ban checks
$group1 = new BP_Groups_Group($g1);
$group2 = new BP_Groups_Group($g2);
$found = array();
$found[] = bp_group_is_user_banned($group1, $u1);
$found[] = bp_group_is_user_banned($group2, $u1);
// Assert
$expected = array(false, true);
$this->assertEquals($expected, $found);
// Clean up
$this->set_current_user($old_user);
}
示例8: test_total_member_count_groups_unban_member
/**
* @group total_member_count
* @group groups_unban_member
*/
public function test_total_member_count_groups_unban_member()
{
$u1 = $this->factory->user->create();
$u2 = $this->factory->user->create();
$g1 = $this->factory->group->create(array('creator_id' => $u1));
groups_join_group($g1, $u2);
// Fool the admin check
$this->set_current_user($u1);
buddypress()->is_item_admin = true;
groups_ban_member($u2, $g1);
groups_unban_member($u2, $g1);
$this->assertEquals(2, groups_get_groupmeta($g1, 'total_member_count'));
}
示例9: groups_screen_group_admin_manage_members
/**
* This function handles actions related to member management on the group admin.
*
* @package BuddyPress
*/
function groups_screen_group_admin_manage_members()
{
global $bp;
if (bp_is_groups_component() && bp_is_action_variable('manage-members', 0)) {
if (!$bp->is_item_admin) {
return false;
}
if (bp_action_variable(1) && bp_action_variable(2) && bp_action_variable(3)) {
if (bp_is_action_variable('promote', 1) && (bp_is_action_variable('mod', 2) || bp_is_action_variable('admin', 2)) && is_numeric(bp_action_variable(3))) {
$user_id = bp_action_variable(3);
$status = bp_action_variable(2);
// Check the nonce first.
if (!check_admin_referer('groups_promote_member')) {
return false;
}
// Promote a user.
if (!groups_promote_member($user_id, $bp->groups->current_group->id, $status)) {
bp_core_add_message(__('There was an error when promoting that user, please try again', 'buddypress'), 'error');
} else {
bp_core_add_message(__('User promoted successfully', 'buddypress'));
}
do_action('groups_promoted_member', $user_id, $bp->groups->current_group->id);
bp_core_redirect(bp_get_group_permalink(groups_get_current_group()) . 'admin/manage-members/');
}
}
if (bp_action_variable(1) && bp_action_variable(2)) {
if (bp_is_action_variable('demote', 1) && is_numeric(bp_action_variable(2))) {
$user_id = bp_action_variable(2);
// Check the nonce first.
if (!check_admin_referer('groups_demote_member')) {
return false;
}
// Demote a user.
if (!groups_demote_member($user_id, $bp->groups->current_group->id)) {
bp_core_add_message(__('There was an error when demoting that user, please try again', 'buddypress'), 'error');
} else {
bp_core_add_message(__('User demoted successfully', 'buddypress'));
}
do_action('groups_demoted_member', $user_id, $bp->groups->current_group->id);
bp_core_redirect(bp_get_group_permalink(groups_get_current_group()) . 'admin/manage-members/');
}
if (bp_is_action_variable('ban', 1) && is_numeric(bp_action_variable(2))) {
$user_id = bp_action_variable(2);
// Check the nonce first.
if (!check_admin_referer('groups_ban_member')) {
return false;
}
// Ban a user.
if (!groups_ban_member($user_id, $bp->groups->current_group->id)) {
bp_core_add_message(__('There was an error when banning that user, please try again', 'buddypress'), 'error');
} else {
bp_core_add_message(__('User banned successfully', 'buddypress'));
}
do_action('groups_banned_member', $user_id, $bp->groups->current_group->id);
bp_core_redirect(bp_get_group_permalink(groups_get_current_group()) . 'admin/manage-members/');
}
if (bp_is_action_variable('unban', 1) && is_numeric(bp_action_variable(2))) {
$user_id = bp_action_variable(2);
// Check the nonce first.
if (!check_admin_referer('groups_unban_member')) {
return false;
}
// Remove a ban for user.
if (!groups_unban_member($user_id, $bp->groups->current_group->id)) {
bp_core_add_message(__('There was an error when unbanning that user, please try again', 'buddypress'), 'error');
} else {
bp_core_add_message(__('User ban removed successfully', 'buddypress'));
}
do_action('groups_unbanned_member', $user_id, $bp->groups->current_group->id);
bp_core_redirect(bp_get_group_permalink(groups_get_current_group()) . 'admin/manage-members/');
}
if (bp_is_action_variable('remove', 1) && is_numeric(bp_action_variable(2))) {
$user_id = bp_action_variable(2);
// Check the nonce first.
if (!check_admin_referer('groups_remove_member')) {
return false;
}
// Remove a user.
if (!groups_remove_member($user_id, $bp->groups->current_group->id)) {
bp_core_add_message(__('There was an error removing that user from the group, please try again', 'buddypress'), 'error');
} else {
bp_core_add_message(__('User removed successfully', 'buddypress'));
}
do_action('groups_removed_member', $user_id, $bp->groups->current_group->id);
bp_core_redirect(bp_get_group_permalink(groups_get_current_group()) . 'admin/manage-members/');
}
}
do_action('groups_screen_group_admin_manage_members', $bp->groups->current_group->id);
bp_core_load_template(apply_filters('groups_template_group_admin_manage_members', 'groups/single/home'));
}
}