-$EXCLUDE_LIST = '';
-if (getConfig('def_refid') > 0) {
- $EXCLUDE_LIST = ' AND d.userid != {?def_refid?}';
-} // END - if
-
-// Check for more extensions
-if (isExtensionActive('beg')) $EXCLUDE_LIST .= ' AND d.userid != {?beg_userid?}';
-if (isExtensionActive('bonus')) $EXCLUDE_LIST .= ' AND d.userid != {?bonus_userid?}';
-if (isExtensionActive('doubler')) $EXCLUDE_LIST .= ' AND d.userid != {?doubler_userid?}';
-if (isExtensionInstalledAndNewer('holiday', '0.1.3')) $EXCLUDE_LIST .= " AND d.holiday_active='N'";
+$userExclusionSql = runFilterChain('user_exclusion_sql', ' ');
+if (isValidId(getDefRefid())) $userExclusionSql .= ' AND d.userid != {?def_refid?}';
+if (isExtensionActive('beg')) $userExclusionSql .= ' AND d.userid != {?beg_userid?}';
+if (isExtensionActive('bonus')) $userExclusionSql .= ' AND d.userid != {?bonus_userid?}';
+if (isExtensionActive('doubler')) $userExclusionSql .= ' AND d.userid != {?doubler_userid?}';
+if (isExtensionInstalledAndNewer('holiday', '0.1.3')) $userExclusionSql .= " AND `d`.`holiday_active`='N'";