You are here

function group_membership_approve in Group 7

Group membership approve callback.

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

File

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

Code

function group_membership_approve($mids) {
  global $user;
  $count = 0;
  foreach (group_membership_load_multiple($mids) as $group_membership) {
    if ($group_membership->status == 'requested') {
      $group_membership->status = 'active';
      $group_membership->approved_on = REQUEST_TIME;
      $group_membership->approved_by = $user->uid;
      $group_membership
        ->save();
      $count++;
    }
  }
  $message = format_plural($count, 'Approved 1 membership request.', 'Approved @count membership requests.');
  drupal_set_message($message);
}