private function createMemberAccount($memberID, $facebook) { $success = false; try { $param = array('method' => 'users.getinfo', 'uids' => $memberID, 'fields' => FacebookConstants::FB_FIRST_NAME . ',' . FacebookConstants::FB_LAST_NAME . ',' . FacebookConstants::FB_MUSIC . ',' . FacebookConstants::FB_BIRTHDATE . ',' . FacebookConstants::FB_GENDER . ',' . FacebookConstants::FB_HOMETOWN_LOCATION . ',' . FacebookConstants::FB_CURRENT_LOCATION . ',' . FacebookConstants::FB_PROFILE_PIC, 'callback' => ''); $userDetails = $facebook->api($param); if ($userDetails != null) { $countryName = null; $stateName = null; $cityName = null; if ($userDetails[0][FacebookConstants::FB_CURRENT_LOCATION] !== null) { if (isset($userDetails[FacebookConstants::FB_CURRENT_LOCATION][FacebookConstants::FB_CITY])) { $cityName = $userDetails[FacebookConstants::FB_CURRENT_LOCATION][FacebookConstants::FB_CITY]; } if (isset($userDetails[FacebookConstants::FB_CURRENT_LOCATION][FacebookConstants::FB_STATE])) { $stateName = $userDetails[FacebookConstants::FB_CURRENT_LOCATION][FacebookConstants::FB_STATE]; } if (isset($userDetails[FacebookConstants::FB_CURRENT_LOCATION][FacebookConstants::FB_COUNTRY])) { $countryName = $userDetails[FacebookConstants::FB_CURRENT_LOCATION][FacebookConstants::FB_COUNTRY]; } } if ($userDetails[0][FacebookConstants::FB_HOMETOWN_LOCATION] !== null) { if ($cityName == null) { $cityName = $userDetails[0][FacebookConstants::FB_HOMETOWN_LOCATION][FacebookConstants::FB_CITY]; } if ($stateName == null) { $stateName = $userDetails[0][FacebookConstants::FB_HOMETOWN_LOCATION][FacebookConstants::FB_STATE]; } if ($countryName == null) { $countryName = $userDetails[0][FacebookConstants::FB_HOMETOWN_LOCATION][FacebookConstants::FB_COUNTRY]; } } $countryID = LocationUtilities::getCountryID($countryName); $stateID = LocationUtilities::getStateID($countryID, $stateName); $cityID = LocationUtilities::getCityID($countryID, $stateID, $cityName); $regionID = 0; $memberDetails = new Member(); $memberDetails->setVariable(Member::MEMBER_ID, $memberID); $memberDetails->setVariable(LocationConstants::COUNTRY_ID, $countryID); $memberDetails->setVariable(LocationConstants::STATE_ID, $stateID); $memberDetails->setVariable(LocationConstants::CITY_ID, $cityID); $memberDetails->setVariable(LocationConstants::REGION_ID, $regionID); $memberDetails->setVariable(Member::AGE_RANGE_ID, AgeUtilities::getAgeRangeID($userDetails[0][FacebookConstants::FB_BIRTHDATE])); $memberDetails->setVariable(Member::GENDER_ID, AgeUtilities::getAgeRangeID($userDetails[0][FacebookConstants::FB_GENDER])); $memberDetails->setVariable(Member::FIRST_NAME, $userDetails[0][FacebookConstants::FB_FIRST_NAME]); $memberDetails->setVariable(Member::LAST_NAME, $userDetails[0][FacebookConstants::FB_LAST_NAME]); $memberDetails->setVariable(Member::MUSIC, $userDetails[0][FacebookConstants::FB_MUSIC]); // $memberDetails->setVariable(Member::EMAIL, $userDetails[0][FacebookConstants::FB_EMAIL]); $memberDetails->setVariable(Member::PROFILE_PIC, $userDetails[0][FacebookConstants::FB_PROFILE_PIC]); $success = MemberDao::insertMember($memberDetails, $dbConnection); } } catch (Exception $ex) { $success = false; } return $success; }