aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--admin/themes/default/template/profile_content.tpl20
-rw-r--r--language/en_UK/common.lang.php2
-rw-r--r--language/fr_CA/common.lang.php2
-rw-r--r--language/fr_FR/common.lang.php2
-rw-r--r--profile.php46
-rw-r--r--themes/default/template/profile_content.tpl6
6 files changed, 59 insertions, 19 deletions
diff --git a/admin/themes/default/template/profile_content.tpl b/admin/themes/default/template/profile_content.tpl
index 8c0e913ad..24cf53abe 100644
--- a/admin/themes/default/template/profile_content.tpl
+++ b/admin/themes/default/template/profile_content.tpl
@@ -5,24 +5,22 @@
<input type="hidden" name="redirect" value="{$REDIRECT}">
<ul>
<li>
- <span class="property">{'Username'|@translate}</span>
+ <span class="property">
+ <label for="username">{'Username'|@translate}</label>
+ </span>
+ {if not $SPECIAL_USER}
+ <input type="text" name="username" id="username" value="{$USERNAME}">
+ {else}
{$USERNAME}
+ {/if}
</li>
-{if not $SPECIAL_USER} {* can modify password + email*}
+ {if not $SPECIAL_USER} {* can modify password + email*}
<li>
<span class="property">
<label for="mail_address">{'Email address'|@translate}</label>
</span>
<input type="text" name="mail_address" id="mail_address" value="{$EMAIL}">
</li>
-{if not $IN_ADMIN} {* admins do not need old password*}
- <li>
- <span class="property">
- <label for="password">{'Password'|@translate}</label>
- </span>
- <input type="password" name="password" id="password" value="">
- </li>
-{/if}
<li>
<span class="property">
<label for="use_new_pwd">{'New password'|@translate}</label>
@@ -35,7 +33,7 @@
</span>
<input type="password" name="passwordConf" id="passwordConf" value="">
</li>
-{/if}
+ {/if}
</ul>
</fieldset>
diff --git a/language/en_UK/common.lang.php b/language/en_UK/common.lang.php
index ac36d5c51..58227bedd 100644
--- a/language/en_UK/common.lang.php
+++ b/language/en_UK/common.lang.php
@@ -347,6 +347,7 @@ $lang['User: %s'] = "User: %s";
$lang['Username "%s" on gallery %s'] = 'Username "%s" on gallery %s';
$lang['Username or email'] = 'Username or email';
$lang['Username'] = "Username";
+$lang['Username modification'] = 'Username modification';
$lang['View'] = "View";
$lang['Visits'] = "Visits";
$lang['Webmaster'] = "Webmaster";
@@ -361,6 +362,7 @@ $lang['Your comment has been registered'] = "Your comment has been registered";
$lang['Your comment has NOT been registered because it did not pass the validation rules'] = "Your comment has NOT been registered because it did not pass the validation rules";
$lang['Your favorites'] = "Your favorites";
$lang['Your Gallery Customization'] = "Your gallery customization";
+$lang['Your username has been successfully changed to : %s'] = 'Your username has been successfully changed to : %s';
$lang['Your password has been reset'] = 'Your password has been reset';
$lang['square'] = "Square";
$lang['thumb'] = "Thumb";
diff --git a/language/fr_CA/common.lang.php b/language/fr_CA/common.lang.php
index 6a0cb7e24..3cb2f2fd3 100644
--- a/language/fr_CA/common.lang.php
+++ b/language/fr_CA/common.lang.php
@@ -365,5 +365,7 @@ $lang['Change my password'] = 'Changer mon mot de passe';
$lang['Enter your new password below.'] = 'Entrez votre nouveau mot de passe ci-dessous.';
$lang['EXIF Metadata'] = 'Données EXIF';
$lang['IPTC Metadata'] = 'Données IPTC';
+$lang['Your username has been successfully changed to : %s'] = 'Votre nom d\'utilisateur a bien été changé par : %s';
+$lang['Username modification'] = 'Modification du nom d\'utilisateur';
?> \ No newline at end of file
diff --git a/language/fr_FR/common.lang.php b/language/fr_FR/common.lang.php
index 75aae335d..f4081fcdc 100644
--- a/language/fr_FR/common.lang.php
+++ b/language/fr_FR/common.lang.php
@@ -347,6 +347,7 @@ $lang['User: %s'] = 'Utilisateur: %s';
$lang['Username "%s" on gallery %s'] = 'Utilisateur "%s" sur la galerie %s';
$lang['Username or email'] = 'Nom d\'utilisateur ou adresse email';
$lang['Username'] = 'Nom d\'utilisateur';
+$lang['Username modification'] = 'Modification du nom d\'utilisateur';
$lang['View'] = 'Vue';
$lang['Visits'] = 'Visites';
$lang['Webmaster'] = 'Webmestre';
@@ -361,6 +362,7 @@ $lang['Your comment has been registered'] = 'Votre commentaire a été enregistr
$lang['Your comment has NOT been registered because it did not pass the validation rules'] = 'Votre commentaire n\'a pas été enregistré parce qu\'il ne satisfait aux règles de validation';
$lang['Your favorites'] = 'Mes favorites';
$lang['Your Gallery Customization'] = 'Personnalisation de votre affichage ';
+$lang['Your username has been successfully changed to : %s'] = 'Votre nom d\'utilisateur a bien été changé par : %s';
$lang['Your password has been reset'] = 'Votre mot de passe a été réinitialisé';
?> \ No newline at end of file
diff --git a/profile.php b/profile.php
index acdf9822b..9e1820cef 100644
--- a/profile.php
+++ b/profile.php
@@ -104,6 +104,7 @@ function save_profile_from_post($userdata, &$errors)
if ($special_user)
{
unset(
+ $_POST['username'],
$_POST['mail_address'],
$_POST['password'],
$_POST['use_new_pwd'],
@@ -114,6 +115,11 @@ function save_profile_from_post($userdata, &$errors)
$_POST['theme'] = get_default_theme();
$_POST['language'] = get_default_language();
}
+
+ if (!defined('IN_ADMIN'))
+ {
+ unset($_POST['username']);
+ }
if ($conf['allow_user_customization'] or defined('IN_ADMIN'))
{
@@ -196,12 +202,44 @@ function save_profile_from_post($userdata, &$errors)
{
array_push($fields, $conf['user_fields']['password']);
// password is encrpyted with function $conf['pass_convert']
- $data{$conf['user_fields']['password']} =
- $conf['pass_convert']($_POST['use_new_pwd']);
+ $data{$conf['user_fields']['password']} = $conf['pass_convert']($_POST['use_new_pwd']);
+ }
+
+ // username is updated only if allowed
+ if (!empty($_POST['username']))
+ {
+ array_push($fields, $conf['user_fields']['username']);
+ $data{$conf['user_fields']['username']} = $_POST['username'];
+
+ // send email to the user
+ if ($_POST['username'] != $userdata['username'])
+ {
+ include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php');
+ switch_lang_to($userdata['language']);
+
+ $keyargs_content = array(
+ get_l10n_args('Hello', ''),
+ get_l10n_args('Your username has been successfully changed to : %s', $_POST['username']),
+ );
+
+ pwg_mail(
+ $_POST['mail_address'],
+ array(
+ 'subject' => '['.$conf['gallery_title'].'] '.l10n('Username modification'),
+ 'content' => l10n_args($keyargs_content),
+ 'content_format' => 'text/plain',
+ )
+ );
+
+ switch_lang_back();
+ }
}
+
mass_updates(USERS_TABLE,
- array('primary' => array($conf['user_fields']['id']),
- 'update' => $fields),
+ array(
+ 'primary' => array($conf['user_fields']['id']),
+ 'update' => $fields
+ ),
array($data));
}
diff --git a/themes/default/template/profile_content.tpl b/themes/default/template/profile_content.tpl
index 9736e101a..161203362 100644
--- a/themes/default/template/profile_content.tpl
+++ b/themes/default/template/profile_content.tpl
@@ -8,21 +8,19 @@
<span class="property">{'Username'|@translate}</span>
{$USERNAME}
</li>
-{if not $SPECIAL_USER} {* can modify password + email*}
+ {if not $SPECIAL_USER} {* can modify password + email*}
<li>
<span class="property">
<label for="mail_address">{'Email address'|@translate}</label>
</span>
<input type="text" name="mail_address" id="mail_address" value="{$EMAIL}">
</li>
-{if not $IN_ADMIN} {* admins do not need old password*}
<li>
<span class="property">
<label for="password">{'Password'|@translate}</label>
</span>
<input type="password" name="password" id="password" value="">
</li>
-{/if}
<li>
<span class="property">
<label for="use_new_pwd">{'New password'|@translate}</label>
@@ -35,8 +33,8 @@
</span>
<input type="password" name="passwordConf" id="passwordConf" value="">
</li>
+ {/if}
</ul>
-{/if}
</fieldset>
{if $ALLOW_USER_CUSTOMIZATION}