This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit

eZ Community » Forums » General » Php : How to log user in a certain...

Php : How to log user in a certain siteaccess ?

Php : How to log user in a certain siteaccess ?

Wednesday 06 July 2011 4:29:27 pm - 2 replies


How can i log a user in a certain siteacces using the php api ?

There is eZUser::loginUser() but it only log people in current siteaccess.

Is there a way to login people in a different siteaccess which is on the same ezpublish install ?

Thursday 08 March 2012 5:22:37 pm


I don't know if this is still actual, but in case anybody is interested :



// First change your siteaccess to the one that you want to log the user on

eZSiteAccess::change(array( 'name' => 'your_siteaccess_name', 'type' => eZSiteAccess::TYPE_DEFAULT  ));

// Force changing the db to current siteacces db

$db = eZDB::instance(false, false, true);


// Get the user that you want to log in by it's username

$userToLogin = eZUser::fetchByName('your_username');

// Finally log in the user




Modified on Thursday 08 March 2012 5:23:05 pm by Bogdan Vâlsan

Thursday 08 March 2012 6:08:45 pm

Great thank you !

Gonna try that solution.


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

36 542 Users on board!

Forums menu

Proudly Developed with from