Index: /elgg/trunk/auth/sso/lib.php =================================================================== --- /elgg/trunk/auth/sso/lib.php (revision 55) +++ /elgg/trunk/auth/sso/lib.php (revision 170) @@ -65,7 +65,30 @@ if (record_exists('users','username',$username)) { // onid usernames are unique, so if it's already in the db, we're good to go - return true; + + //since a user name have been created by being defined as a member of a project without having previously logged in + //we check if they have a name defined and if not, we update from sso. + if($temp = get_record('users','username',$username, 'name', '')) {//if the username exists, but the name is blank + + $user = new StdClass; + $user->ident = $temp->ident; + $user->email = $user_info["email"]; + $user->name = $user_info["firstname"]; + $user->name = $user->name . " " . $user_info["lastname"]; + $user->username = $username; + $user->password = md5($password); + $user->user_type = 'person'; + $user->owner = -1; + + update_record('users',$user); + //Since this is the first time the user has logged in, do normal user creation stuff + $rssresult = run("weblogs:rss:publish", array($user->ident, false)); + $rssresult = run("files:rss:publish", array($user->ident, false)); + $rssresult = run("profile:rss:publish", array($user->ident, false)); + user_flag_set("emailnotifications", '1', $user->ident); + + } + return true; } else { - // Everythink OK, create user + // Everything OK, create user $user = new StdClass; $user->email = $user_info["email"]; @@ -83,4 +106,5 @@ $rssresult = run("files:rss:publish", array($user_id, false)); $rssresult = run("profile:rss:publish", array($user_id, false)); + user_flag_set("emailnotifications", '1', $user_id); } else { // User creation failed