You are here

function group_group_member_operations in Group 7

Implements hook_group_member_operations().

Callbacks are situated in forms/group.members.inc.

File

./group.group.inc, line 170
Hook implementations for the Group module.

Code

function group_group_member_operations(Group $group) {
  $operations['remove'] = array(
    'label' => t('Remove selected members'),
    'callback' => 'group_membership_multiple_delete_confirm',
    'form callback' => TRUE,
  );
  $operations['approve'] = array(
    'label' => t('Approve selected membership requests'),
    'callback' => 'group_membership_approve',
    'optgroup' => t('Approve or decline membership requests'),
  );
  $operations['decline'] = array(
    'label' => t('Decline selected membership requests'),
    'callback' => 'group_membership_decline',
    'optgroup' => t('Approve or decline membership requests'),
  );
  $operations['block'] = array(
    'label' => t('Block selected members'),
    'callback' => 'group_membership_block',
    'optgroup' => t('Block or unblock selected members'),
  );
  $operations['unblock'] = array(
    'label' => t('Unblock selected members'),
    'callback' => 'group_membership_unblock',
    'optgroup' => t('Block or unblock selected members'),
  );
  foreach (group_type_load($group->type)
    ->getRoles(FALSE) as $group_role) {
    $operations["add-{$group_role->name}"] = array(
      'label' => $group_role
        ->label(),
      'callback' => 'group_membership_add_role',
      'callback arguments' => array(
        $group_role->name,
      ),
      'optgroup' => t('Add role to selected members'),
    );
    $operations["remove-{$group_role->name}"] = array(
      'label' => $group_role
        ->label(),
      'callback' => 'group_membership_remove_role',
      'callback arguments' => array(
        $group_role->name,
      ),
      'optgroup' => t('Remove role from selected members'),
    );
  }
  return $operations;
}