$whereStatement = '';
// Shall we exclude webmaster's own userid?
+ // @TODO Rewrite these if() blocks to a filter
if ((!isBegIncludeOwnEnabled()) && (isValidId(getBegUserid()))) {
// Exclude it
- $whereStatement .= ' AND `userid` != {?beg_userid?}';
+ $whereStatement .= ' AND `d`.`userid` != {?beg_userid?}';
} // END - if
// Let's check if there are some points left we can pay...
if ((isExtensionActive('autopurge')) && (isBegActiveEnabled()) && ((getApInactiveSince() > 0))) {
// Okay, include last online timestamp
- $whereStatement .= ' AND (UNIX_TIMESTAMP() - `last_online`) < {?ap_inactive_since?}';
+ $whereStatement .= ' AND (UNIX_TIMESTAMP() - `d`.`last_online`) < {?ap_inactive_since?}';
+ } // END - if
+
+ // Is ext-holiday installed?
+ if (isExtensionActive('holiday')) {
+ // Exclude those as well
+ $whereStatement .= " AND `d`.`holiday_active`='N'";
} // END - if
// SQL string to check for accounts
$result_main = SQL_QUERY("SELECT
- `userid`,
- `beg_points`
+ `d`.`userid`,
+ `d`.`beg_points`
FROM
- `{?_MYSQL_PREFIX?}_user_data`
+ `{?_MYSQL_PREFIX?}_user_data` AS `d`
WHERE
- `status`='CONFIRMED'
+ `d`.`status`='CONFIRMED'
" . $whereStatement . "
" . runFilterChain('user_exclusion_sql', ' ') . " AND
- `beg_points` > 0
+ `d`.`beg_points` > 0
ORDER BY
- `beg_points` DESC,
- `userid` ASC
+ `d`.`beg_points` DESC,
+ `d`.`userid` ASC
LIMIT {?beg_ranks?}", __FILE__, __LINE__);
if (!SQL_HASZERONUMS($result_main)) {