invite module is providing option to assign role when invited user gets registered when Auto Assign Role is enabled.

But it would be nice make to protect assign path so that only invited user gets assigned that instead of anybody who know the path gets the role assigned.

Also there is a https://www.drupal.org/project/protected_pages module which could be used to protect pages but don't how that works with this module.

Comments

Sylense’s picture

I know this is somewhat old but for anyone looking for a solution to this I managed to implement something relatively simple for this. You can use hook_form_alter() and simply check for $_SESSION for the invite code. If it's not set, just redirect them to the normal register page.

if ($form_id === 'user_register_form')  {
    $path = current_path();
    if($path == 'CUSTOM/REGISTER/PATH' && !isset($_SESSION['invite_code'])) {
        drupal_goto('user/register');
    }
}
mike.davis’s picture

Hi @Sylense,

Thanks for your comments on this thread and welcome any patches to help deal with this issue.

Thanks
Mike

pramod_patil’s picture

Assigned: Unassigned » pramod_patil
pramod_patil’s picture

Assigned: pramod_patil » Unassigned
Status: Active » Needs review
StatusFileSize
new1.13 KB

Added patch for this fix. Please review.