You are here

function group_membership_block in Group 7

Group membership block callback.

1 string reference to 'group_membership_block'
group_group_member_operations in ./group.group.inc
Implements hook_group_member_operations().

File

admin/group_membership.inc, line 426
Group membership overview admin UI.

Code

function group_membership_block($mids) {
  global $user;
  $count = 0;
  foreach (group_membership_load_multiple($mids) as $group_membership) {
    if ($group_membership->status != 'blocked') {
      $group_membership->blocked_status = $group_membership->status;
      $group_membership->status = 'blocked';
      $group_membership->blocked_on = REQUEST_TIME;
      $group_membership->blocked_by = $user->uid;
      $group_membership
        ->save();
      $count++;
    }
  }
  $message = format_plural($count, 'Blocked 1 member.', 'Blocked @count members.');
  drupal_set_message($message);
}