Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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);
}
Comment | File | Size | Author |
---|---|---|---|
#2 | register_button_access_1909410_2.patch | 749 bytes | wjackson |
Comments
Comment #1
sarjeet.singh CreditAttribution: sarjeet.singh commentedComment #2
wjackson CreditAttribution: wjackson commentedThis is exactly what I needed!
Attached is a patch that applies your changes to the module.
Thank you, Sarjeet.singh!
Comment #3
kalabroMakes sense
Comment #4
SpleshkaThanks all, commited to 7.x-4.x.