/** * complete the online-identity with the api json * * @author Matthias Pfefferle * @refactored weyandch * @param OnlineIdentity $pOnlineIdentity * @param Object $pObject */ public function completeOnlineIdentity(&$pOnlineIdentity, $pObject, $pUser, $pAuthIdentifier) { // delegate to ImportClient to avoid duplicate code $pOnlineIdentity->setUserId($pUser->getId()); $pOnlineIdentity->setAuthIdentifier($pAuthIdentifier); $pOnlineIdentity->setName($pObject->username); $pOnlineIdentity->setSocialPublishingEnabled(true); $pOnlineIdentity->setLocationRaw($pObject->city); $pOnlineIdentity->setPhoto($pObject->avatar); $pOnlineIdentity->save(); }
/** * complete the online-identity with the api json * * @param OnlineIdentity $pOnlineIdentity * @param Object $pObject */ public function completeOnlineIdentity(&$pOnlineIdentity, $pProfileArray, $pUser) { $pOnlineIdentity->setName($pProfileArray['first-name'] . " " . $pProfileArray['last-name']); $pOnlineIdentity->setSocialPublishingEnabled(true); $pOnlineIdentity->setUserId($pUser->getId()); if (isset($pProfileArray['date-of-birth']['year'])) { $pOnlineIdentity->setBirthdate($pProfileArray['date-of-birth']['year'] . '-' . $pProfileArray['date-of-birth']['month'] . '-' . $pProfileArray['date-of-birth']['day']); } $pOnlineIdentity->setLocationRaw($pProfileArray['location']['name']); $pOnlineIdentity->setPhoto($pProfileArray['pictureUrl']); $pOnlineIdentity->save(); // update user's birthdate if it's not set yet and provided by this identity if (is_null($pUser->getBirthdate()) && $pOnlineIdentity->getBirthdate()) { $pUser->setBirthdate($pOnlineIdentity->getBirthdate()); $pUser->save(); } }
/** * add a new OnlineIdentity object * * @author Matthias Pfefferle * @param string $pProfileUri * @param int $pOriginalId * @param string $pCommunity * @param int $pType */ public static function addOnlineIdentity($pProfileUri, $pOriginalId, $pCommunityId, $pAuthIdentifier = null) { // if the identifier is null return null if (!$pCommunityId || !$pOriginalId) { return null; } $lOIdentity = new OnlineIdentity(); $lOIdentity->setOriginalId($pOriginalId); $lOIdentity->setProfileUri($pProfileUri); $lOIdentity->setCommunityId($pCommunityId); if ($pAuthIdentifier) { $lOIdentity->setAuthIdentifier($pAuthIdentifier); } $lOIdentity->save(); $lOIdentity->scheduleImportJob(); return $lOIdentity; }
/** * complete the online-identity with the api json * * @param OnlineIdentity $pOnlineIdentity * @param Object $pObject */ public function completeOnlineIdentity(&$pOnlineIdentity, $pObject, $pUser, $pAuthIdentifier) { // delegate to ImportClient to avoid duplicate code /* signup,add new */ $pOnlineIdentity->setUserId($pUser->getId()); $pOnlineIdentity->setAuthIdentifier($pAuthIdentifier); $pOnlineIdentity->setName($pObject['display_name']); $pOnlineIdentity->setGender($pObject['gender']); // transform facebook format into $pOnlineIdentity->setBirthdate($pObject['birth_date']['year'] . '-' . $pObject['birth_date']['month'] . '-' . $pObject['birth_date']['day']); $pOnlineIdentity->setSocialPublishingEnabled(true); $pOnlineIdentity->setLocationRaw($pObject["business_address"]["city"]); $pOnlineIdentity->setPhoto($pObject["photo_urls"]["large"]); $pOnlineIdentity->save(); $pUser->setRelationshipState($pOnlineIdentity->getRelationshipState()); $pUser->setBirthdate($pOnlineIdentity->getBirthDate()); $pUser->save(); }
/** * complete the online-identity with the api json * * @param OnlineIdentity $pOnlineIdentity * @param Object $pObject */ public function completeOnlineIdentity(&$pOnlineIdentity, $pObject, $pUser, $pAuthIdentifier) { $pOnlineIdentity->setUserId($pUser->getId()); $pOnlineIdentity->setAuthIdentifier($pAuthIdentifier); $pOnlineIdentity->setSocialPublishingEnabled(true); $pOnlineIdentity->setName($pObject->nickname); $pOnlineIdentity->setProfileUri($pAuthIdentifier); if (isset($pObject->gender)) { $pOnlineIdentity->setGender($pObject->gender); } if (isset($pObject->birthday)) { $pOnlineIdentity->setBirthdate($pObject->birthday); } $pOnlineIdentity->save(); }
/** * complete the online-identity with the api json * * @param OnlineIdentity $pOnlineIdentity * @param Object $pObject */ public function completeOnlineIdentity(&$pOnlineIdentity, $pObject, $pUser, $pAuthIdentifier) { $pOnlineIdentity->setUserId($pUser->getId()); $pOnlineIdentity->setAuthIdentifier($pAuthIdentifier); $pOnlineIdentity->setSocialPublishingEnabled(true); $pOnlineIdentity->setPhoto($pObject->profile_image_url); if ($pObject->name) { $pOnlineIdentity->setName($pObject->name); } else { $pOnlineIdentity->setName($pObject->screen_name); } $pOnlineIdentity->setProfileUri("http://twitter.com/" . $pObject->screen_name); $pOnlineIdentity->setLocationRaw($pObject->location); $pOnlineIdentity->save(); }
/** * complete the online-identity with the api json * * @author Matthias Pfefferle * @refactored weyandch * @param OnlineIdentity $pOnlineIdentity * @param Object $pObject */ public function completeOnlineIdentity(&$pOnlineIdentity, $pObject, $pUser, $pAuthIdentifier) { // delegate to ImportClient to avoid duplicate code /* signup,add new */ $pOnlineIdentity->setUserId($pUser->getId()); $pOnlineIdentity->setAuthIdentifier($pAuthIdentifier); $pOnlineIdentity->setName($pObject->name); $pOnlineIdentity->setGender($pObject->gender); // transform facebook format into $lBirthday = explode('/', $pObject->birthday); if (count($lBirthday == 3 && $lBirthday[2] > 0 && $lBirthday[0] != '0000')) { // 3 parts and year is set $pOnlineIdentity->setBirthdate($lBirthday[2] . '-' . $lBirthday[0] . '-' . $lBirthday[1]); } $pOnlineIdentity->setRelationshipState(IdentityHelper::tranformRelationshipStringToClasskey($pObject->relationship_status)); $pOnlineIdentity->setSocialPublishingEnabled(true); $pOnlineIdentity->setLocationRaw($pObject->location->name); $pOnlineIdentity->setPhoto("https://graph.facebook.com/" . $pOnlineIdentity->getOriginalId() . "/picture"); $pOnlineIdentity->setProfileUri($pObject->link); $pOnlineIdentity->save(); $pUser->setRelationshipState($pOnlineIdentity->getRelationshipState()); $pUser->setBirthdate($pOnlineIdentity->getBirthDate()); $pUser->save(); }