From 61d4709eb855827e8d15a3e873760e4ad797b45b Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Fri, 29 Jan 2010 20:43:16 -0500 Subject: Pass username and nickname to autoregister so auth plugins can set the nickname correct when creating a new user. Continues fixing what Eric Helgeson pointed out in 01eb4e8f003bf62575ec16dfb6127d7534be9c88 --- lib/authenticationplugin.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/authenticationplugin.php b/lib/authenticationplugin.php index f7f8f8655..5be3ea5b9 100644 --- a/lib/authenticationplugin.php +++ b/lib/authenticationplugin.php @@ -69,13 +69,17 @@ abstract class AuthenticationPlugin extends Plugin /** * Automatically register a user when they attempt to login with valid credentials. * User::register($data) is a very useful method for this implementation - * @param username + * @param username username (that is used to login and find the user in the authentication provider) of the user to be registered + * @param nickname nickname of the user in the SN system. If nickname is null, then set nickname = username * @return mixed instance of User, or false (if user couldn't be created) */ - function autoRegister($username) + function autoRegister($username, $nickname = null) { + if(is_null($nickname)){ + $nickname = $username; + } $registration_data = array(); - $registration_data['nickname'] = $username ; + $registration_data['nickname'] = $nickname ; return User::register($registration_data); } @@ -132,7 +136,7 @@ abstract class AuthenticationPlugin extends Plugin //someone already exists with the suggested nickname //not much else we can do }else{ - $user = $this->autoRegister($nickname); + $user = $this->autoRegister($nickname, $suggested_nickname); if($user){ User_username::register($user,$nickname,$this->provider_name); return false; -- cgit v1.2.3-54-g00ecf