Only show new players from the last 45 days
authorArun Persaud <arun@nubati.net>
Sun, 9 Mar 2014 06:23:39 +0000 (22:23 -0800)
committerArun Persaud <arun@nubati.net>
Sun, 9 Mar 2014 06:26:07 +0000 (22:26 -0800)
should be enough to get them playing in new games.

include/db.php
include/user.php

index 33f0fff..2ea2ac0 100644 (file)
@@ -507,7 +507,9 @@ function DB_get_names_of_new_logins($N)
 {
   $names  = array();
 
-  $result = DB_query("SELECT fullname FROM User ORDER BY create_date DESC, id DESC LIMIT $N");
+  $result = DB_query("SELECT fullname FROM User".
+                    " WHERE create_date >=(NOW() - interval 45 day)".
+                    " ORDER BY create_date DESC, id DESC LIMIT $N");
   while($r = DB_fetch_array($result))
     $names[] = $r[0];
 
index 764c694..7acf726 100644 (file)
@@ -314,11 +314,14 @@ else
        if($count<10)
          echo '<p class="newbiehint">'._('You can start new games using the link in the top right corner!')."</p>\n";
 
-       /* display last 5 users that have signed up to e-DoKo */
+       /* display last 5 users that have signed up to e-DoKo within the 45 days */
        $names = DB_get_names_of_new_logins(5);
-       echo '<h4>'._('New Players').":</h4>\n<p>\n";
-       echo implode(", ",$names).",...\n";
-       echo "</p>\n";
+        if ($names)
+         {
+           echo '<h4>'._('New Player(s)').":</h4>\n<p>\n";
+           echo implode(", ",$names).",...\n";
+           echo "</p>\n";
+         };
 
        /* display last 5 users that logged on */
        echo '<h4>'._('Players last logged in').":</h4>\n<p>\n";