Skip to content
Snippets Groups Projects
Commit e1cbbbe0 authored by Eric Rasmussen's avatar Eric Rasmussen
Browse files

fix for CAS registration when peoplefinder privacy flag is set

parent 68bacab1
No related branches found
No related tags found
No related merge requests found
......@@ -133,9 +133,15 @@ class elggSimpleCas {
// User exists, return the user object
return $user;
} else {
// Valid login but user doesn't exist
// Valid CAS login but user hasn't been registered in Planet Red yet
// We end up going through here twice, first time grabs email from Peoplefinder and forwards to the getemail validation page to ask
// them if the email is correct, then when we return with the email we register the user in elgg
$pf_user_info = peoplefinderServices($casusername);
$name = $pf_user_info->cn;
if(!empty($pf_user_info->cn))
$name = $pf_user_info->cn;
else //A peoplefinder record does not exist because they've set their privacy flag so set display name to username so register_user below doesn't break
$name = $username;
if (empty($email)){
if($pf_user_info->mail)
......@@ -149,17 +155,19 @@ class elggSimpleCas {
if ($user_guid = register_user($username, $password, $name, $email, false, 0, '', true)) {
$thisuser = get_user($user_guid);
//pre-populate profile fields with data from Peoplefinder Services
$address = $pf_user_info->formatPostalAddress();
$thisuser->profile_country = 'USA';
$thisuser->profile_state = $address['region'];
$thisuser->profile_city = $address['locality'];
if($address['locality'] == 'Omaha') {
$thisuser->longitude = -95.9;
$thisuser->latitude = 41.25;
} else { //this is going to cover Lincoln and everyone else
$thisuser->longitude = -96.7;
$thisuser->latitude = 40.82;
if(!empty($pf_user_info->cn)){
//pre-populate profile fields with data from Peoplefinder Services if available
$address = $pf_user_info->formatPostalAddress();
$thisuser->profile_country = 'USA';
$thisuser->profile_state = $address['region'];
$thisuser->profile_city = $address['locality'];
if($address['locality'] == 'Omaha') {
$thisuser->longitude = -95.9;
$thisuser->latitude = 41.25;
} else { //this is going to cover Lincoln and everyone else
$thisuser->longitude = -96.7;
$thisuser->latitude = 40.82;
}
}
return $thisuser;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment