-if (isExtensionActive('beg')) $EXCLUDE_LIST .= " AND d.userid != ".getConfig('beg_userid')."";
-if (isExtensionActive('bonus')) $EXCLUDE_LIST .= " AND d.userid != ".getConfig('bonus_userid')."";
-if (isExtensionActive('doubler')) $EXCLUDE_LIST .= " AND d.userid != ".getConfig('doubler_userid')."";
-if (isExtensionInstalledAndNewer('holiday', '0.1.3')) $EXCLUDE_LIST .= " AND d.holiday_active='N'";
+$EXCLUDE_LIST = '';
+if (isValidUserId(getDefRefid())) $EXCLUDE_LIST .= ' AND d.userid != {?def_refid?}';
+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'";