Adds optional $profile parameter for Facebookclient constructor and uses that for the foreign_link lookup if provided instead of the notice's poster.
*/
function onEndFavorNotice(Profile $profile, Notice $notice)
{
- $client = new Facebookclient($notice);
+ $client = new Facebookclient($notice, $profile);
$client->like();
return true;
*/
function onEndDisfavorNotice(Profile $profile, Notice $notice)
{
- $client = new Facebookclient($notice);
+ $client = new Facebookclient($notice, $profile);
$client->unLike();
return true;
protected $notice = null; // The user's notice
protected $user = null; // Sender of the notice
- function __construct($notice)
+ /**
+ *
+ * @param Notice $notice the notice to manipulate
+ * @param Profile $profile local user to act as; if left empty, the notice's poster will be used.
+ */
+ function __construct($notice, $profile=null)
{
$this->facebook = self::getFacebook();
$this->notice = $notice;
+ $profile_id = $profile ? $profile->id : $notice->profile_id;
$this->flink = Foreign_link::getByUserID(
- $notice->profile_id,
+ $profile_id,
FACEBOOK_SERVICE
);