If a user is invited to join the site, but they go straight to the site and sign up without using the invite link, the invitations for that user aren't processed. If invite_user('insert') doesn't find a reg code in the session, it could query the invite table by email address to see if one exists and use it. I actually made this patch to 2.x-dev and 1.12. There are probably corner cases that I'm not thinking of where this wouldn't work, but here it is to think about anyway.
Replace this:
function invite_user($op, &$edit, &$account, $category = NULL) {
switch ($op) {
case 'insert':
if ($invite = invite_load_from_session()) {
With this:
function invite_user($op, &$edit, &$account, $category = NULL) {
switch ($op) {
case 'insert':
$invite = invite_load_from_session();
if (!$invite) {
$reg_code = db_result(db_query("select reg_code from {invite} where email = '%s'", $account->mail));
if($reg_code) {
$invite = invite_load($reg_code);
}
}
if ($invite) {
Comments
Comment #1
vaelen commentedWhoops, forgot the code tags:
Replace this:
With this:
Comment #2
smk-ka commentedSounds sane. Added to CVS, thanks a lot.
http://drupal.org/cvs?commit=100445
Comment #3
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.