PDA

View Full Version : How to make Referral field in registration required?


digitalSite
01-14-2004, 01:41 AM
Anyone know how to make the referral link in registration required or at least to not allow people signing up who were not referred?

I would like to also prevent someone from stealing an email with a referral link and trying to sign up that way. Basically, I only want intended recipients accessing the referral link and not someone else.

Any ideas or help on this?? ANY suggestions is GREATLY appreciated. Thanks!

Freddie Bingham
01-14-2004, 04:35 AM
Anyone know how to make the referral link in registration required or at least to not allow people signing up who were not referred?

I would like to also prevent someone from stealing an email with a referral link and trying to sign up that way. Basically, I only want intended recipients accessing the referral link and not someone else.

Any ideas or help on this?? ANY suggestions is GREATLY appreciated. Thanks!
To require referrals, edit register.php and find this code: if ($_POST['referrername'])
{
if (!$testreferrerid = $DB_site->query_first("SELECT userid FROM " . TABLE_PREFIX . "user WHERE username = '" . addslashes(htmlspecialchars_uni($_POST['referrername'])) . "'"))
{
eval('$errors[130] = "' . fetch_phrase('badreferrer', PHRASETYPEID_ERROR) . '";');
}
}

add this after it:

else
{
$errors[131] = 'You must be referred by an existing user to register';
}
Untested though.

Link14716
01-14-2004, 09:56 AM
freddie: I believe digitalSite wants this for vB2, hence why it is in the vB2 Requests forum. ;)

Freddie Bingham
01-14-2004, 01:14 PM
freddie: I believe digitalSite wants this for vB2, hence why it is in the vB2 Requests forum. ;)
Oh, well he has a reason to upgrade now.

digitalSite
09-25-2005, 07:07 PM
To require referrals, edit register.php and find this code: if ($_POST['referrername'])
{
if (!$testreferrerid = $DB_site->query_first("SELECT userid FROM " . TABLE_PREFIX . "user WHERE username = '" . addslashes(htmlspecialchars_uni($_POST['referrername'])) . "'"))
{
eval('$errors[130] = "' . fetch_phrase('badreferrer', PHRASETYPEID_ERROR) . '";');
}
}

add this after it:

else
{
$errors[131] = 'You must be referred by an existing user to register';
}
Untested though.


Hi:

I have since upgraded to 3.x, and tried the code above just to see if it works...it doesn't work. So I 'm still trying to figure out how to make the referral field required AND check to make sure the username EXISTS.