/** * see if they have the same username as an existing account in member_social_id table, * if so, use the member id associated with it * if not, try and find a simliar member_social_id and use that */ public function getMemberIdWithSocialId(MemberEntity $memberEnt) { // for now only do for instagram and twitter. could be made into a loop $memberSocialId = $memberEnt->getMemberSocialId(); foreach (self::getSocialSiteIdArr() as $socialSiteKey => $socialSiteName) { // Get member id for SAME social id but different from source member came from if ($socialSiteKey != $memberEnt->getSource()) { // eg. if 'twitter' != 'instagram' // eg. if current member is from instagram, look for same memberSocialId from twitter $arr = $this->memberSocialObj->getMemberIdsWithMemberSocialIds(array($memberSocialId), $socialSiteKey); if (count($arr) == 1) { return array_shift($arr); } // Get member id with SIMILAR social id $memberId = $this->getMemberIdWithSimilarSocialId($memberSocialId, $socialSiteKey); if ($memberId) { return $memberId; } } } return 0; }