+// Determine which user hash no more points left
+function SURFBAR_DETERMINE_DEPLETED_USERIDS() {
+ // Init array
+ $UIDs = array();
+
+ // Do we have a current user id?
+ if (IS_LOGGED_IN()) {
+ // Then add this as well
+ $UIDs[] = $GLOBALS['userid'];
+
+ // Get all userid except logged in one
+ $result = SQL_QUERY_ESC("SELECT userid FROM "._MYSQL_PREFIX."_surfbar_urls
+WHERE userid != %s AND status='CONFIRMED'
+GROUP BY userid
+ORDER BY userid ASC",
+ array($GLOBALS['userid']), __FILE__, __LINE__);
+ } else {
+ // Get all userid
+ $result = SQL_QUERY_ESC("SELECT userid FROM "._MYSQL_PREFIX."_surfbar_urls
+WHERE status='CONFIRMED'
+GROUP BY userid
+ORDER BY userid ASC", __FILE__, __LINE__);
+ }
+
+ // Load all userid
+ while (list($uid) = SQL_FETCHROW($result)) {
+ // Get total points
+ $points = GET_TOTAL_DATA($uid, "user_points", "points") - GET_TOTAL_DATA($uid, "user_data", "used_points");
+ //DEBUG_LOG(__FUNCTION__.":uid={$uid},points={$points}");
+
+ // Shall we add this to ignore?
+ if ($points <= 0) {
+ // Ignore this one!
+ $UIDs[] = $uid;
+ //DEBUG_LOG(__FUNCTION__.":uid={$uid} has depleted points amount!");
+ } // END - if
+ } // END - while
+
+ // Free result
+ SQL_FREERESULT($result);
+
+ // Debug message
+ //DEBUG_LOG(__FUNCTION__.":UIDs::count=".count($UIDs)." (with own userid=".$GLOBALS['userid'].")");
+
+ // Return result
+ return $UIDs;
+}