incorrect time && no count && is it possible to pull commenter avatar too ?
-
sorry to make many post – but i cant append in previous post
—–
1. incorrect time – why time is incorrect ?
i have go to add time offset in$createdDateTime->modify($timeOffsetToLocal.'25200 seconds');
—-
2. no comment count (number) display
– it show only “0 Responses” IF that post only have comment from facebook plugin
– it will show count number (ex. 8 Responses) only IF that post has at least 1 comment from blog’s comment system– if you comment from blog you will see number but if only post comment from plugin, you wont see any number
—
3. is it possible to pull commenter avatar too ?
now you use only graph api , try FQL also work
https://developers.facebook.com/docs/reference/fql/comment/
https://developers.facebook.com/docs/reference/fql/this is example code from other plugin that they use simple api to pull user avatar
public function fb_get_comments($post,$params=array()) { ## https://developers.facebook.com/docs/reference/fql/comment/ ## https://developers.facebook.com/docs/reference/fql/link_stat/ $link = (!empty($params['xid'])) ? $params['xid'] : (($post->ID) ? get_permalink($post->ID) : $this->currentURI); $migrated = (!empty($params['migrated'])) ? $params['migrated'] : get_option($this->ns.'fbtools_comments_migrated'); ## FQL Query $fql = 'SELECT fromid, text, time, username, id FROM comment WHERE xid = \''.urlencode($link).'\''; if($migrated) { $href = (!empty($params['href'])) ? $params['href'] : $this->currentURI; $fql = 'SELECT fromid, text, time, username, id FROM comment WHERE object_id IN (SELECT comments_fbid FROM link_stat WHERE url = \''.urlencode($href).'\')'; } $res = $this->fb_query($fql); $xml = new SimpleXMLElement($res); ## Put Comments into Array $comments = array(); if(isset($xml->comment)) { foreach($xml->comment as $comment) { $item = array( 'text' => (string) $comment->text, 'time' => (int) $comment->time, 'commenter' => $this->fb_graph((int) $comment->fromid), 'commenter_photo' => (string) 'https://graph.facebook.com/'.(int) $comment->fromid.'/picture' ); array_push($comments,$item); } } return $comments; }
https://developers.facebook.com/docs/reference/api/
we know user id from graph api so we can use pull image
- The topic ‘incorrect time && no count && is it possible to pull commenter avatar too ?’ is closed to new replies.