Share » Forums » Developer » Change login name

Change login name

Change login name

Wednesday 24 September 2003 10:22:04 am - 3 replies

Author Message

Paul Leclercq

Tuesday 05 June 2007 3:00:13 am

I tested this on a 3.8.6 and it worked without resetting the passwords. This must have been fixed since you posted this.

This is very useful if you have an old users table and need to clean it up due to duplicate users in the login column with different email adresses.

$checkUser = eZUser::fetchByName($newLogin);
if (!is_object($checkUser))
{
$user->setAttribute("login",$newLogin);
$user->store();
}

Stefano Maffulli

Tuesday 28 August 2007 3:47:41 am

Hi,

I have to do something very similar: few users of our site asked to change their login. I have tried changing it fiddling via sql, altering the ezuser table.

The problem with that approach is that the user home folder keeps using the same old login name.

Would your code work in my case too? How do you use it: do I need a php page or a script?

thanks
stef

--
: Stefano Maffulli : https://www.fsfe.org/en/fellows/maffulli/
`--------+----------+--------------------------------------------------.
Join the Fellowship of FSFE http://fsfe.org

Joël LEGER

Friday 15 October 2010 12:42:23 am

Hi

i try to update the login this way :

$user->setAttribute("login",$newLogin);
$user->store();

impossible to change it , am i missing something ?

just after i update the user content object without problem :

$result = eZContentFunctions::updateAndPublishObject( $contentObject, $params );

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu