You are here

function invite_form_user_admin_settings_alter in Invite 7.4

Alter Account Settings form.

Add new registration mode 'by invitation only'. By prepending the option value with a numeric value, other modules still work as expected, as long as they are using the non-strict PHP comparison operator (since '1-inviteonly' == 1 yields TRUE). To determine the real setting use invite_user_registration_by_invite_only().

However, setting the new mode is only allowed if no other module has overridden the menu access handler for the user registration form.

Parameters

array $form: Array with form.

aray $form_state: Array with form state.

string $form_id: The ID of form.

File

./invite.module, line 297

Code

function invite_form_user_admin_settings_alter(&$form, &$form_state, $form_id) {
  $item = menu_get_item('user/register');
  if (in_array($item['access_callback'], array(
    'user_register_access',
    'invite_user_register_access',
  ))) {
    $form['registration_cancellation']['user_register']['#options'][USER_REGISTER_INVITATION_ONLY] = t('Invitees only');
  }

  // Clear menu cache on submit to allow our custom access handler to snap in.
  $form['#submit'][] = 'menu_rebuild';
}