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,13 +121,16 @@ 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;
$n = $GLOBALS['pdo']->prepare("INSERT INTO users_invited(invitedUser,whoInvited,whenAccepted) VALUES(:inviteduser,:whoinvited,UNIX_TIMESTAMP())"); if (ReferralProgram::IsMember($whoinvited)) //double check they are currently in the program
$n->bindParam(":inviteduser", $newuser, PDO::PARAM_INT); {
$n->bindParam(":whoinvited", $whoinvited, PDO::PARAM_INT); $n = $GLOBALS['pdo']->prepare("INSERT INTO users_invited(invitedUser,whoInvited,whenAccepted) VALUES(:inviteduser,:whoinvited,UNIX_TIMESTAMP())");
$n->execute(); $n->bindParam(":inviteduser", $newuser, PDO::PARAM_INT);
$n->bindParam(":whoinvited", $whoinvited, PDO::PARAM_INT);
$n->execute();
if (ReferralProgram::DeleteUserKey($key)){ if (ReferralProgram::DeleteUserKey($key)){
return true; return true;
}
} }
} }
return false; return false;