From f97cfa79d9ee6f942ab8c8629f0a347ddf27cbd5 Mon Sep 17 00:00:00 2001 From: Friendika Date: Tue, 26 Apr 2011 17:17:34 -0700 Subject: [PATCH] tracking through issues with FB likes --- addon/facebook/facebook.php | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/addon/facebook/facebook.php b/addon/facebook/facebook.php index e3b15c52..b7244df9 100644 --- a/addon/facebook/facebook.php +++ b/addon/facebook/facebook.php @@ -405,7 +405,12 @@ function facebook_post_hook(&$a,&$b) { $fb_token = get_pconfig(local_user(),'facebook','access_token'); logger('facebook: $fb_post: ' . $fb_post . ' $fb_enable: ' . $fb_enable . ' $fb_token: ' . $fb_token,LOGGER_DEBUG); - if($fb_post && $fb_token && ($fb_enable || $b['private'])) { + + // post to facebook if it's a public post and we've ticked the 'post to Facebook' box, + // or it's a private message with facebook participants + // or it's a reply or likes action to an existing facebook post + + if($fb_post && $fb_token && ($fb_enable || $b['private'] || $reply)) { logger('facebook: able to post'); require_once('library/facebook.php'); require_once('include/bbcode.php'); @@ -444,10 +449,15 @@ function facebook_post_hook(&$a,&$b) { logger('Facebook post: msg=' . $msg, LOGGER_DATA); - $postvars = array( - 'access_token' => $fb_token, - 'message' => $msg - ); + if($likes) { + $postvars = array('access_token' => $fb_token); + } + else { + $postvars = array( + 'access_token' => $fb_token, + 'message' => $msg + ); + } if(($b['private']) && (! $b['parent'])) { $postvars['privacy'] = '{"value": "CUSTOM", "friends": "SOME_FRIENDS"';