Add "lost" users detection in default query.
authorFlorent Bruneau <florent.bruneau@polytechnique.org>
Sun, 22 Feb 2009 14:58:21 +0000 (15:58 +0100)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Sun, 22 Feb 2009 14:58:21 +0000 (15:58 +0100)
Signed-off-by: Florent Bruneau <florent.bruneau@polytechnique.org>
classes/user.php
templates/include/minifiche.tpl

index 3d8063e..d048e5a 100644 (file)
@@ -163,11 +163,15 @@ class User extends PlUser
                                       a.email_format, a.is_admin, a.state, a.type, a.skin,
                                       FIND_IN_SET(\'watch\', a.flags) AS watch, a.comment,
                                       a.weak_password IS NOT NULL AS weak_access,
-                                      a.token IS NOT NULL AS token_access ' . $fields . '
+                                      a.token IS NOT NULL AS token_access,
+                                      (e.email IS NULL AND NOT FIND_IN_SET(\'googleapps\', eo.storage)) AND a.state != \'pending\' AS lost
+                                      ' . $fields . '
                                 FROM  accounts AS a
                           INNER JOIN  account_types AS at ON (at.type = a.type)
                            LEFT JOIN  aliases AS af ON (af.id = a.uid AND af.type = \'a_vie\')
                            LEFT JOIN  aliases AS ab ON (ab.id = a.uid AND FIND_IN_SET(\'bestalias\', ab.flags))
+                           LEFT JOIN  emails AS e ON (e.uid = a.uid AND e.flags = \'active\')
+                           LEFT JOIN  email_options AS eo ON (eo.uid = a.uid)
                                    ' . $joins . '
                                WHERE  a.uid IN (' . implode(', ', $uids) . ')
                             GROUP BY  a.uid');
index 9a33366..3caa8b5 100644 (file)
   {/if}
 
   <div class="long">
-  {if $c.wasinscrit || !$c.dcd}
-    {if $c.web || $c.mobile || $c.countrytxt || $c.city || $c.region || $c.entreprise || $c.freetext || (!$c.dcd && !$c.actif )}
+  {if !$profile->deathdeate}
+    {if $c.web || $c.mobile || $c.countrytxt || $c.city || $c.region || $c.entreprise || (!$c.dcd && !$c.actif )}
     <table cellspacing="0" cellpadding="0">
       {if $c.web}
       <tr>
         </td>
       </tr>
       {/if}
-      {if $c.freetext}
+      {if $smarty.session.auth ge AUTH_COOKIE}
+      {if $user->state eq 'pending'}
       <tr>
-        <td class="lt">Commentaire&nbsp;:</td>
-        <td class="rt">{$c.freetext|nl2br}</td>
+        <td class="smaller" colspan="2">
+          {"Ce"|sex:"Cette":$user} camarade n'est pas {inscrit|sex:"inscrite":$user}.
+          <a href="marketing/public/{$user->login()}" class='popup'>Si tu connais son adresse email,
+          <strong>n'hésite pas à nous la transmettre !</a>
+        </td>
       </tr>
-      {/if}
-      {if !$c.dcd && (!$c.actif || !$c.wasinscrit) && $smarty.session.auth ge AUTH_COOKIE}
+      {elseif $user->state neq 'disabled' && $user->lost}
       <tr>
         <td class="smaller" colspan="2">
-          {if !$c.wasinscrit}
-          Ce{if $c.sexe}tte{/if} camarade n'est pas inscrit{if $c.sexe}e{/if}.
-          <a href="marketing/public/{$c.hruid}" class='popup'>Si tu connais son adresse email,
-          <strong>n'hésite pas à nous la transmettre !</a>
-          {elseif !$c.actif}
-          Ce{if $c.sexe}tte{/if} camarade n'a plus d'adresse de redirection valide.
-          <a href="marketing/broken/{$c.hruid}">
+          {"Ce"|sex:"Cette":$user} camarade n'a plus d'adresse de redirection valide.
+          <a href="marketing/broken/{$user->login()}">
             Si tu en connais une, <strong>n'hésite pas à nous la transmettre</strong>.
           </a>
-          {/if}
         </td>
       </tr>
       {/if}
+      {/if}
     </table>
     {/if}
   {/if}