Changeset 12882


Ignore:
Timestamp:
01/14/12 11:50:47 (8 years ago)
Author:
mistic100
Message:

feature:2517 ability to change username. admins can change usernames, users are notified by mail

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/themes/default/template/profile_content.tpl

    r12877 r12882  
    66    <ul> 
    77      <li> 
    8         <span class="property">{'Username'|@translate}</span> 
     8        <span class="property"> 
     9          <label for="username">{'Username'|@translate}</label> 
     10        </span> 
     11      {if not $SPECIAL_USER} 
     12        <input type="text" name="username" id="username" value="{$USERNAME}"> 
     13      {else} 
    914        {$USERNAME} 
     15      {/if} 
    1016      </li> 
    11 {if not $SPECIAL_USER} {* can modify password + email*} 
     17    {if not $SPECIAL_USER} {* can modify password + email*} 
    1218      <li> 
    1319        <span class="property"> 
     
    1622        <input type="text" name="mail_address" id="mail_address" value="{$EMAIL}"> 
    1723      </li> 
    18 {if not $IN_ADMIN} {* admins do not need old password*} 
    19       <li> 
    20         <span class="property"> 
    21           <label for="password">{'Password'|@translate}</label> 
    22         </span> 
    23         <input type="password" name="password" id="password" value=""> 
    24       </li> 
    25 {/if} 
    2624      <li> 
    2725        <span class="property"> 
     
    3634        <input type="password" name="passwordConf" id="passwordConf" value=""> 
    3735      </li> 
    38 {/if} 
     36    {/if} 
    3937    </ul> 
    4038  </fieldset> 
  • trunk/language/en_UK/common.lang.php

    r12820 r12882  
    348348$lang['Username or email'] = 'Username or email'; 
    349349$lang['Username'] = "Username"; 
     350$lang['Username modification'] = 'Username modification'; 
    350351$lang['View'] = "View"; 
    351352$lang['Visits'] = "Visits"; 
     
    362363$lang['Your favorites'] = "Your favorites"; 
    363364$lang['Your Gallery Customization'] = "Your gallery customization"; 
     365$lang['Your username has been successfully changed to : %s'] = 'Your username has been successfully changed to : %s'; 
    364366$lang['Your password has been reset'] = 'Your password has been reset'; 
    365367$lang['square'] = "Square"; 
  • trunk/language/fr_CA/common.lang.php

    r12693 r12882  
    366366$lang['EXIF Metadata'] = 'Données EXIF'; 
    367367$lang['IPTC Metadata'] = 'Données IPTC'; 
     368$lang['Your username has been successfully changed to : %s'] = 'Votre nom d\'utilisateur a bien été changé par : %s'; 
     369$lang['Username modification'] = 'Modification du nom d\'utilisateur'; 
    368370 
    369371?> 
  • trunk/language/fr_FR/common.lang.php

    r12693 r12882  
    348348$lang['Username or email'] = 'Nom d\'utilisateur ou adresse email'; 
    349349$lang['Username'] = 'Nom d\'utilisateur'; 
     350$lang['Username modification'] = 'Modification du nom d\'utilisateur'; 
    350351$lang['View'] = 'Vue'; 
    351352$lang['Visits'] = 'Visites'; 
     
    362363$lang['Your favorites'] = 'Mes favorites'; 
    363364$lang['Your Gallery Customization'] = 'Personnalisation de votre affichage '; 
     365$lang['Your username has been successfully changed to : %s'] = 'Votre nom d\'utilisateur a bien été changé par : %s'; 
    364366$lang['Your password has been reset'] = 'Votre mot de passe a été réinitialisé'; 
    365367 
  • trunk/profile.php

    r12877 r12882  
    105105  { 
    106106    unset( 
     107      $_POST['username'], 
    107108      $_POST['mail_address'], 
    108109      $_POST['password'], 
     
    115116    $_POST['language'] = get_default_language(); 
    116117  } 
     118   
     119  if (!defined('IN_ADMIN')) 
     120  { 
     121    unset($_POST['username']); 
     122  } 
    117123 
    118124  if ($conf['allow_user_customization'] or defined('IN_ADMIN')) 
     
    197203        array_push($fields, $conf['user_fields']['password']); 
    198204        // password is encrpyted with function $conf['pass_convert'] 
    199         $data{$conf['user_fields']['password']} = 
    200           $conf['pass_convert']($_POST['use_new_pwd']); 
     205        $data{$conf['user_fields']['password']} = $conf['pass_convert']($_POST['use_new_pwd']); 
    201206      } 
     207       
     208      // username is updated only if allowed 
     209      if (!empty($_POST['username'])) 
     210      { 
     211        array_push($fields, $conf['user_fields']['username']); 
     212        $data{$conf['user_fields']['username']} = $_POST['username']; 
     213         
     214        // send email to the user 
     215        if ($_POST['username'] != $userdata['username']) 
     216        { 
     217          include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php'); 
     218          switch_lang_to($userdata['language']); 
     219           
     220          $keyargs_content = array( 
     221            get_l10n_args('Hello', ''), 
     222            get_l10n_args('Your username has been successfully changed to : %s', $_POST['username']), 
     223            ); 
     224             
     225          pwg_mail( 
     226            $_POST['mail_address'], 
     227            array( 
     228              'subject' => '['.$conf['gallery_title'].'] '.l10n('Username modification'), 
     229              'content' => l10n_args($keyargs_content), 
     230              'content_format' => 'text/plain', 
     231              ) 
     232            ); 
     233             
     234          switch_lang_back(); 
     235        } 
     236      } 
     237       
    202238      mass_updates(USERS_TABLE, 
    203                    array('primary' => array($conf['user_fields']['id']), 
    204                          'update' => $fields), 
     239                   array( 
     240                    'primary' => array($conf['user_fields']['id']), 
     241                    'update' => $fields 
     242                    ), 
    205243                   array($data)); 
    206244    } 
  • trunk/themes/default/template/profile_content.tpl

    r12877 r12882  
    99        {$USERNAME} 
    1010      </li> 
    11 {if not $SPECIAL_USER} {* can modify password + email*} 
     11    {if not $SPECIAL_USER} {* can modify password + email*} 
    1212      <li> 
    1313        <span class="property"> 
     
    1616        <input type="text" name="mail_address" id="mail_address" value="{$EMAIL}"> 
    1717      </li> 
    18 {if not $IN_ADMIN} {* admins do not need old password*} 
    1918      <li> 
    2019        <span class="property"> 
     
    2322        <input type="password" name="password" id="password" value=""> 
    2423      </li> 
    25 {/if} 
    2624      <li> 
    2725        <span class="property"> 
     
    3634        <input type="password" name="passwordConf" id="passwordConf" value=""> 
    3735      </li> 
     36    {/if} 
    3837    </ul> 
    39 {/if} 
    4038  </fieldset> 
    4139 
Note: See TracChangeset for help on using the changeset viewer.