You are here

function group_group_member_operation_links in Group 7

Implements hook_group_member_operation_links().

File

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

Code

function group_group_member_operation_links(GroupMembership $group_membership) {
  $operations = array();

  // Retrieve the destination url.
  $destination = drupal_get_destination();

  // Load the group the member belongs to.
  $group = group_load($group_membership->gid);

  // Add membership management links.
  if (group_access('administer members', $group)) {
    $operations['edit-membership'] = array(
      'title' => t('edit'),
      'href' => 'group/' . $group->gid . '/member/' . $group_membership->uid . '/edit',
      'query' => $destination,
    );
    $operations['cancel-membership'] = array(
      'title' => t('cancel'),
      'href' => 'group/' . $group->gid . '/member/' . $group_membership->uid . '/cancel',
      'query' => $destination,
    );
  }

  // Add the membership metadata link.
  if (group_access('access member metadata', $group)) {
    $operations['membership-metadata'] = array(
      'title' => t('metadata'),
      'href' => 'group/' . $group->gid . '/member/' . $group_membership->uid . '/metadata',
    );
  }
  return $operations;
}