Allows admins to modify unregisterd users' ref birthdate (Closes #1554).
authorStéphane Jacob <sj@m4x.org>
Fri, 21 Oct 2011 09:34:51 +0000 (11:34 +0200)
committerStéphane Jacob <sj@m4x.org>
Fri, 21 Oct 2011 09:34:51 +0000 (11:34 +0200)
Signed-off-by: Stéphane Jacob <sj@m4x.org>
ChangeLog
modules/profile/general.inc.php
templates/profile/general.tpl

index 86d3f0c..826489c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -41,6 +41,7 @@ Bug/Wish:
         - #1381: Adds levels to medals                                     -JAC
         - #1446: Adds field for sports and hobbies                         -JAC
         - #1535: Moves and displays skills with mentoring informations     -JAC
+        - #1554: Allows admins to modify unregisterd users' ref birthdate  -JAC
 
     * Search:
         - #1284: If a country is chosen, only proposes its cities          -JAC
index 93302c9..dc9058d 100644 (file)
@@ -664,6 +664,7 @@ class ProfilePageGeneral extends ProfilePage
             $this->watched['freetext'] = true;
         }
 
+        Platal::page()->assign('is_registered', ($this->owner->perms ? true : false));
     }
 
     protected function _fetchData()
@@ -777,7 +778,7 @@ class ProfilePageGeneral extends ProfilePage
                 }
             }
         }
-        if ($this->orig['birthdate_ref'] == 0 && !S::user()->isMe($this->owner) && $this->changed['birthdate_ref']) {
+        if ($this->changed['birthdate_ref'] && S::admin() && !$this->owner->perms) {
             XDB::execute('UPDATE  profiles
                              SET  birthdate_ref = {?}
                            WHERE  pid = {?}',
index 117e8be..8a04c66 100644 (file)
       <span class="titre">Date de naissance de référence</span>
     </td>
     <td>
-    {if $birthdate_ref eq 0}
+    {if hasPerm('admin') && !$is_registered}
       <input type="text" {if $errors.birthdate_ref}class="error"{/if} name="birthdate_ref" value="{$birthdate_ref}" />
     {else}
       {$birthdate_ref}