feature:2517 ability to change username, add test to avoid existing usernames

git-svn-id: http://piwigo.org/svn/trunk@12884 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
mistic100 2012-01-14 12:08:34 +00:00
parent af2302c1db
commit 34a70eceec

View file

@ -92,7 +92,7 @@ SELECT '.implode(',', $fields).'
//------------------------------------------------------ update & customization
function save_profile_from_post($userdata, &$errors)
{
global $conf;
global $conf, $page;
$errors = array();
if (!isset($_POST['validate']))
@ -207,6 +207,13 @@ function save_profile_from_post($userdata, &$errors)
// username is updated only if allowed
if (!empty($_POST['username']))
{
if ($_POST['username'] != $userdata['username'] and get_userid($_POST['username']))
{
array_push($page['errors'], l10n('this login is already used'));
unset($_POST['redirect']);
}
else
{
array_push($fields, $conf['user_fields']['username']);
$data{$conf['user_fields']['username']} = $_POST['username'];
@ -234,6 +241,7 @@ function save_profile_from_post($userdata, &$errors)
switch_lang_back();
}
}
}
mass_updates(USERS_TABLE,
array(