protected function _postPublish_getUserOptionChanges(bdSocialShare_Shareable_Abstract $shareable, array $viewingUser = null) { $this->standardizeViewingUserReference($viewingUser); $changes = array(); if (bdSocialShare_Option::hasPermissionFacebook($viewingUser)) { $optionFacebookNeeded = false; if ($shareable->isPublished('facebook')) { $published = $shareable->getPublishedExtraData('facebook'); // notice the use of original_target_id instead of target_id here // sometimes (page posting), target_id will be extracted from original_target_id // through a series of parsing. The original is the important bit that worth // saving. $optionFacebookNeeded = $published['original_target_id']; } else { $optionFacebookNeeded = ''; } if (!isset($viewingUser['bdsocialshare_facebook']) or strval($viewingUser['bdsocialshare_facebook']) !== strval($optionFacebookNeeded)) { $changes['bdsocialshare_facebook'] = $optionFacebookNeeded; } } if (bdSocialShare_Option::hasPermissionTwitter($viewingUser)) { $optionTwitterNeeded = false; if ($shareable->isPublished('twitter')) { $published = $shareable->getPublishedExtraData('twitter'); // the usage of original_target_id is similar to Facebook routine above $optionTwitterNeeded = $published['original_target_id']; } else { $optionTwitterNeeded = ''; } if (!isset($viewingUser['bdsocialshare_twitter']) or strval($viewingUser['bdsocialshare_twitter']) !== strval($optionTwitterNeeded)) { $changes['bdsocialshare_twitter'] = $optionTwitterNeeded; } } return $changes; }