Skyrider
04-23-2016, 09:17 AM
In regards of:
https://vborg.vbsupport.ru/showthread.php?p=2568256 ( YaAS-Automation-R4.zip )
There's this specific code in the file that handles the membergroupid's for giving automated awards.
// USERGROUP AWARDS
$usergroupAwards = $vbulletin->db->query_read("
SELECT *
FROM " . TABLE_PREFIX . "award_automation
WHERE (auto_active=1) AND (auto_type='usergroup')
");
while ($usergroupAwardsArray = $vbulletin->db->fetch_array($usergroupAwards))
{
$getUsersWithGroup = $vbulletin->db->query_read("
SELECT userid
FROM " . TABLE_PREFIX . "user
WHERE (usergroupid=$usergroupAwardsArray[auto_criteria])
OR " . $usergroupAwardsArray[auto_criteria] . " IN (membergroupids)
");
while ($array3 = $vbulletin->db->fetch_array($getUsersWithGroup))
{
$checkUsergroupAward = $vbulletin->db->query_read("
SELECT userid, award_id
FROM " . TABLE_PREFIX . "award_user
WHERE (userid=$array3[userid]) AND (award_id=$usergroupAwardsArray[auto_awardid])
");
$alreadyissued = $vbulletin->db->num_rows($checkUsergroupAward);
if (empty($alreadyissued)) {
// Issue New Usergroup Award
$vbulletin->db->query_write("INSERT INTO " . TABLE_PREFIX . "award_user (award_id, userid, issue_reason, issue_time, award_cgroup) VALUES ('$usergroupAwardsArray[auto_awardid]', '$array3[userid]', '" . addslashes($usergroupAwardsArray['auto_issuereason']) . "', " . time() . ", 'usergroup')");
}
}
}
However, for some reason when the user is in multiple secondary usergroups, its refusing to give out the awards. Sometimes there are problems as well where it doesn't give awards when the member is part of the secondary usergroup either, but works when the user is in primary. As such my question, is there any 'problem' within the code?
https://vborg.vbsupport.ru/showthread.php?p=2568256 ( YaAS-Automation-R4.zip )
There's this specific code in the file that handles the membergroupid's for giving automated awards.
// USERGROUP AWARDS
$usergroupAwards = $vbulletin->db->query_read("
SELECT *
FROM " . TABLE_PREFIX . "award_automation
WHERE (auto_active=1) AND (auto_type='usergroup')
");
while ($usergroupAwardsArray = $vbulletin->db->fetch_array($usergroupAwards))
{
$getUsersWithGroup = $vbulletin->db->query_read("
SELECT userid
FROM " . TABLE_PREFIX . "user
WHERE (usergroupid=$usergroupAwardsArray[auto_criteria])
OR " . $usergroupAwardsArray[auto_criteria] . " IN (membergroupids)
");
while ($array3 = $vbulletin->db->fetch_array($getUsersWithGroup))
{
$checkUsergroupAward = $vbulletin->db->query_read("
SELECT userid, award_id
FROM " . TABLE_PREFIX . "award_user
WHERE (userid=$array3[userid]) AND (award_id=$usergroupAwardsArray[auto_awardid])
");
$alreadyissued = $vbulletin->db->num_rows($checkUsergroupAward);
if (empty($alreadyissued)) {
// Issue New Usergroup Award
$vbulletin->db->query_write("INSERT INTO " . TABLE_PREFIX . "award_user (award_id, userid, issue_reason, issue_time, award_cgroup) VALUES ('$usergroupAwardsArray[auto_awardid]', '$array3[userid]', '" . addslashes($usergroupAwardsArray['auto_issuereason']) . "', " . time() . ", 'usergroup')");
}
}
}
However, for some reason when the user is in multiple secondary usergroups, its refusing to give out the awards. Sometimes there are problems as well where it doesn't give awards when the member is part of the secondary usergroup either, but works when the user is in primary. As such my question, is there any 'problem' within the code?