Following documentation:


/**
 * Alter existing group admin menu items.
 *
 * @param $data
 *   The menu items passed by reference.
 * @param $gid
 *   The group being viewed.
 */
function hook_og_ui_get_group_admin_alter(&$data, $gid) {
  // Hijack the add people to use a custom implementation.
  $items['add_people']['href'] = 'admin/people/custom-add-user';
}

There is a typo, using $items instead of $data.

And in this very same example, we have a bad behaviour, because "admin/people/custom-add-user" will not pass through the hook_menu permission system, causing the "Group" tab showing everywhere, also in non-group nodes.

Can be resolved like this:

/**
 * Alter existing group admin menu items.
 *
 * @param $data
 *   The menu items passed by reference.
 * @param $context
 *   The entire OG context object
 */
function hook_og_ui_get_group_admin_alter(&$data, $context) {
  // Hijack the add people to use a custom implementation.
  if (og_ui_user_access_group('add user', $context['entity_type'], $context['etid'])) {
    $data['add_people']['href'] = 'admin/people/mass-add-user-filter';
  }
}

Patch attached.

Comments

paolomainardi’s picture

Up

amitaibu’s picture

Status: Needs review » Fixed

Committed, thanks.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.