Role Signup is not working

module is enabled.
access control is given to all user roles.

on user/register page
roles are listed

but while clicking on the certain role it remains on the same page

Comments

firebus’s picture

me too.

it seems to pick one group and stay there. you can't change it. deleting cookies doesn't help. very strange!

pfaocle’s picture

Having very similar problems trying this module today: the page output by the seems to be stuck with the first role I picked, and doesn't change, even after removing said role from the list of permissible roles. However, following the process through led to the user being assigned the correct role - it just isn't changing in the "You are registering for the 'rolename' account type." message.

pfaocle’s picture

These problems seem to relate to caching of the user register page?

I tried fiddling with the hook_menu, to not much avail. As I was editing, I wondered why a session variable is being used at all. Is there a reason for this? I may have missed a glaring security problem, but what's to stop the module being simply something like:

  function rolesignup_perm() {
    return array('register for role');
  }

  /**
   * Implementation of hook_form_alter()
   */
  function rolesignup_form_alter($form_id, &$form) {
    if ($form_id == 'user_register') {
      $roles = user_roles(1, 'register for role');
    
      $form['rolechoice'] = array(
        '#type' => 'select',
        '#title' => t('Please select a role'),
        '#options' => $roles,
      );
    }
  } 

  /**
   * Implementation of hook_user()
   */
  function rolesignup_user($op, &$edit, &$account, $category = NULL) {
    switch ($op) {
      case 'insert':    
        $roles = user_roles(1, 'register for role');
        if (array_key_exists($edit['rolechoice'], $roles)) {
          db_query("INSERT INTO {users_roles} (uid, rid) VALUES (%d, %d)", $account->uid, $edit['rolechoice']);
        }
    }
  }

I don't see how this differs, apart from registration is now a one-step process with a role select box, rather than a two-step process: choose your role, then fill in the registration form.

Users are still automatically given the role they choose, which frightens me a little.

firebus’s picture

Title: Role Signup is not working » role signup does not work if caching is enabled.

iirc there's some integration between role signup and node profile such that different registration options are available depending on the role you choose.

that's one reason to have a two-step.

cyberswat’s picture

Assigned: Unassigned » cyberswat
cyberswat’s picture

Status: Active » Fixed

The original module should have never used session variables ... I modified it to use Drupal's hooks properly ... please evaluate the dev snapshot of http://drupal.org/project/autoassignrole as I believe it fixes this problem and would like to get it into a release asap

Anonymous’s picture

Status: Fixed » Closed (fixed)

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