I created a custom registration form using the code I show below. It works on my test site, but on my live site, it returns an access denied error. I am not sure what the problem is.

function medical_reg_form_user_register_form_alter(&$form, &$form_state, $form_id) {
  $form['#theme'] = 'medical_register'; 
  $form['actions']['submit']['#value'] = t('Next');

The setup is the same so I am rather perplexed. The test site is local. Are there some configurations which make a big difference?


You will get a 403 on user/register if you are already logged in.

  • is there away to register if you are logged in. If you wanted to join different types of accounts it might be a good idea todo it while your logged in. Thanks for your answer – Alexander Dec 31 '12 at 16:13
  • 1
    If you want to create more than one account, you need to log out, and create the other account. Alternatively, users with the permission of administering user accounts can create accounts without logging out. – kiamlaluno Jan 2 '13 at 12:46
  • To register when logged in, you would need to use hook_menu_alter to remove or alter the access callback on user/register. Currently it checks user_register_access which requires anon user and site registration enabled. Not really recommended, better to just log out and register again. – David Thomas Jan 2 '13 at 21:04

It is because you are logged in, my suggest is you first logout user and ten redirect him/his to /user/register page So what you do to is in your custom module

// Implementation of hook_init 

function yourmodule_init(){
global $user;
if(current_path=='user/register' && $user->uid){ // if user is logged in and the current path is user/register

Also (if you familiar with rules modules) you can handle it by Rules

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.