This module override user module settings for register if Anonymous user has not access to register.
user module code.

if (variable_get('user_register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL)) {
    $items[] = l(t('Create new account'), 'user/register', array('attributes' => array('title' => t('Create a new user account.'))));
  }

Override by this module.

 // Add register button.
  if (in_array('register', $links_enabled) && $form_id != 'user_register_form') {
    $options['attributes']['title'] = t('Create new account');
    $links[] = l(t('Create new account'), 'ajax_register/register/nojs', $options);
  }

Need to add extra condition for register button.

// Add register button.
  if (in_array('register', $links_enabled) && $form_id != 'user_register_form' && variable_get('user_register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL)) {
    $options['attributes']['title'] = t('Create new account');
    $links[] = l(t('Create new account'), 'ajax_register/register/nojs', $options);
  }
CommentFileSizeAuthor
#2 register_button_access_1909410_2.patch749 byteswjackson
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

sarjeet.singh’s picture

Version: 7.x-4.0-rc9 » 7.x-4.0-rc13
wjackson’s picture

This is exactly what I needed!

Attached is a patch that applies your changes to the module.

Thank you, Sarjeet.singh!

kalabro’s picture

Status: Active » Needs review

Makes sense

Spleshka’s picture

Version: 7.x-4.0-rc13 » 7.x-4.x-dev
Status: Needs review » Closed (fixed)

Thanks all, commited to 7.x-4.x.