actually enabling both rolesignup and invite modules causes the second not to work.

when the user clicks on the invitation link received by email, the invitation code fails to work (notice logged in the watchdog: "User name registration code failed"), and following actions of invite fail too (update invites list, ad invited user to buddy list, ... ).

anyone else experiencing / needing this? would this be easy enough to fix? thank you

Comments

sym’s picture

Yes, this is the case with 5 anyway. I assume 4.7 would have the same problems.

I really have no idea what to do about it. I use /user/register/[rid] for rolesignup and invite used /user/register/[invite id]. I don't think either have more of a 'right' to use that URL: they are both logical.

At the moment role signup looks for $_SESSION['role'] and checks if it is in the allowed roles list. I don't want to change this, otherwise it might be possible for someone to change the role ID and signup for an admin role.

I could make a special case for invite, but that's a slightly messy solution.

I'd welcome some ideas! I'll change the project to invite simply so they know about the problem. Please feel free to move it back to rolesignup if you think it's better there.

marcoBauli’s picture

Project: Role Signup » Invite

sym, thanks for considering. moving it to invite.module then, and crossing fingers!

marcoBauli’s picture

Project: Invite » Role Signup
Status: Active » Needs review
StatusFileSize
new952 bytes

a patch that solves the problem on 4.7 on the Role Signup side is attached here. Please review.

bsuttis’s picture

I was having the same problem with 5.1, but the patch for 4.7 above works from the limited testing I've done. I only had to make one change: module_exist had to change to module_exists

botum’s picture

On drupal 5 working with lots of modules, I applied the patch, changed to module_exists and also changed role_register_page() to look like below, in order to have the invitation take you, although, I'm not a programmer so I don't know if this is the best approach, but it just works!

function role_register_page() {
  $roles = user_roles(1, 'register for role');
  if (isset($roles[arg(3)])) {
    $_SESSION['role'] = arg(3);
    $url = 'user/register/'.$_SESSION['invite_code'];
    drupal_goto($url);
  }
  return theme('rolelist', $roles);
}

I added:

    $url = 'user/register/'.$_SESSION['invite_code'];
    drupal_goto($url);

withought this lines, it would tell me "invited users only" message.
hope it helps! finally got it to work!!!!

botum’s picture

Version: 4.7.x-1.x-dev » 5.x-1.x-dev

Also, my rolesignup_form_alter() end up being like this:

function rolesignup_form_alter($form_id, &$form) {
  if ($form_id == "user_register") {
    global $user;
    //Invite support
    if(module_exists('invite')) {
      if($invite_code=arg(2)) {
        $_SESSION['invite_code'] = $invite_code;
      }
    }
    if (!user_access('administer users') && !$_SESSION['role']) {
//      drupal_goto('user/register/role', drupal_get_destination());
      drupal_goto('user/register/role');
    } else {
      $form['role'] = array(
        '#type' => 'value',
        '#value' => $_SESSION['role'],
        );
    }
    $form['rolelink'] = array(
      '#value' => theme('select_role'),
      '#weight' => -11,
      );
  }
}

I think now it's working right.

Christefano-oldaccount’s picture

StatusFileSize
new1.52 KB

Here's a patch that includes all these changes.

cyberswat’s picture

Assigned: Unassigned » cyberswat
cyberswat’s picture

Status: Needs review » Closed (fixed)

closing old issues