referral program member check

This commit is contained in:
Astrologies 2021-12-12 18:27:45 -05:00
parent 60721376c3
commit 7e244634ae
1 changed files with 9 additions and 9 deletions

View File

@ -14,14 +14,11 @@ namespace Alphaland\Users {
{ {
public static function IsMember(int $userid) public static function IsMember(int $userid)
{ {
/*
if (isInGroup($userid, 22)) //id 22 is the official referral program group if (isInGroup($userid, 22)) //id 22 is the official referral program group
{ {
return true; return true;
} }
return false; return false;
*/
return true;
} }
public static function IsUserGeneratedKey(string $key) public static function IsUserGeneratedKey(string $key)
@ -124,6 +121,8 @@ namespace Alphaland\Users {
$userkey->execute(); $userkey->execute();
if ($userkey->rowCount() > 0) { if ($userkey->rowCount() > 0) {
$whoinvited = $userkey->fetch(PDO::FETCH_OBJ)->userGen; $whoinvited = $userkey->fetch(PDO::FETCH_OBJ)->userGen;
if (ReferralProgram::IsMember($whoinvited)) //double check they are currently in the program
{
$n = $GLOBALS['pdo']->prepare("INSERT INTO users_invited(invitedUser,whoInvited,whenAccepted) VALUES(:inviteduser,:whoinvited,UNIX_TIMESTAMP())"); $n = $GLOBALS['pdo']->prepare("INSERT INTO users_invited(invitedUser,whoInvited,whenAccepted) VALUES(:inviteduser,:whoinvited,UNIX_TIMESTAMP())");
$n->bindParam(":inviteduser", $newuser, PDO::PARAM_INT); $n->bindParam(":inviteduser", $newuser, PDO::PARAM_INT);
$n->bindParam(":whoinvited", $whoinvited, PDO::PARAM_INT); $n->bindParam(":whoinvited", $whoinvited, PDO::PARAM_INT);
@ -133,6 +132,7 @@ namespace Alphaland\Users {
return true; return true;
} }
} }
}
return false; return false;
} }
} }