As I was investigating adding some promotion capabilities to my activity hack, I found that all promotions are started by the query
Code:
$promotions = $DB_site->query("
SELECT user.joindate, user.userid, user.membergroupids, user.posts, user.reputation,
user.usergroupid, user.displaygroupid, user.customtitle, user.username,
userpromotion.joinusergroupid, userpromotion.reputation AS jumpreputation, userpromotion.posts AS jumpposts,
userpromotion.date AS jumpdate, userpromotion.type, userpromotion.strategy,
usergroup.title, usergroup.usertitle AS ug_usertitle
FROM " . TABLE_PREFIX . "user AS user
LEFT JOIN " . TABLE_PREFIX . "userpromotion AS userpromotion ON (user.usergroupid = userpromotion.usergroupid)
LEFT JOIN " . TABLE_PREFIX . "usergroup AS usergroup ON (userpromotion.joinusergroupid = usergroup.usergroupid)
" . iif(VB_AREA != 'AdminCP', "WHERE user.lastactivity >= " . (TIMENOW - $nextrun))
);
and that there doesn't seem to be another comparable query in the system. If I read this query right, when it left joins user and userpromotion on usergroupid, the result will always be either 0 or 1 sets of userpromotion data for that user. If there were, say, both a promotion promotion and a demotion promotion from the same group, where is that handled?