Title: Patch for missing access_token
Last modified: August 21, 2016

---

# Patch for missing access_token

 *  [pepe](https://wordpress.org/support/users/pputzer/)
 * (@pputzer)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/patch-for-missing-access_token/)
 * This patch fixes the missing data (URL) in the WordPress comments, caused by 
   a missing access_token, and adds a filter for setting the post URL to something
   else (e.g. to use `http://example.org/some-post` instead of `https://example.
   org/some-post`).
 *     ```
       --- old/seo-facebook-comments/seofacebook.php	2013-08-28 09:44:01.049463455 +0200
       +++ seo-facebook-comments/seofacebook.php	2014-01-11 19:46:15.202779871 +0100
       @@ -470,6 +470,11 @@
                {
                    global $wpdb;
   
       +            /**
       +             * Allow filtering of the $postUrl to (for example) always use the non-SSL version for comments.
       +             */
       +            $postUrl = apply_filters ('fbseocomments_post_url', $postUrl, $postId);
       +
                    if( empty($postUrl) || empty($postId) )
                        echo __('You must insert an valid Url and Post ID', $this->_fwork);
   
       @@ -482,16 +487,18 @@
                    'FROM comment '.
                    'WHERE object_id in (SELECT comments_fbid FROM link_stat WHERE url ="'.$postUrl.'")', # '.$postUrl.'
                        'q2' => 'SELECT post_fbid, fromid, object_id, text, time FROM comment WHERE object_id in (SELECT post_fbid FROM #q1)',
       -                'q3' => 'SELECT name, id, url, pic_square FROM profile WHERE id in (SELECT fromid FROM #q1) or id in (SELECT fromid FROM #q2)',
       +                'q3' => 'SELECT name, id, url, username, type, pic_square FROM profile WHERE id in (SELECT fromid FROM #q1) or id in (SELECT fromid FROM #q2)',
                    );
   
                    $queries = json_encode($queries);
                    $fbquery = array( "method" => "fql.multiquery", "queries" => $queries );
       +            $access_token = $facebook->getAccessToken();
                    $result = $facebook->api($fbquery);
   
                    # Fetch the Authors of the comments
                    $comments['authors'] = $result[2]['fql_result_set'];
   
       +
                    # Fetch the comments
                    $comments['comments'] = $result[0]['fql_result_set'];
       ```
   
 * [http://wordpress.org/plugins/seo-facebook-comments/](http://wordpress.org/plugins/seo-facebook-comments/)

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [bemcapaz](https://wordpress.org/support/users/bemcapaz/)
 * (@bemcapaz)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/patch-for-missing-access_token/#post-4493259)
 * Hi,
 * The filter will be present in version 1.5.1 of the plugin.
 * The access token is also a nice idea, however looks like there are still some
   code missing from the fix above, could you check it please?
 * Thanks for the feedback!
 *  Thread Starter [pepe](https://wordpress.org/support/users/pputzer/)
 * (@pputzer)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/patch-for-missing-access_token/#post-4493264)
 * If you mean the line `+ 'q3' => 'SELECT name, id, url, username, type, pic_square
   FROM profile WHERE id in (SELECT fromid FROM #q1) or id in (SELECT fromid FROM#
   q2)',`, that was mainly to facility debugging for me. You can ignore that change
   for the moment. The access_token will automatically be (re-)used by the API call,
   no need to do anything besides getting it.
 *  When I’ve got the time, I’ll add some additional queries to get the user mail
   address as well (using the “user” table in FQL).

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Patch for missing access_token’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/seo-facebook-comments_251815.svg)
 * [SEO Facebook Comment](https://wordpress.org/plugins/seo-facebook-comments/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/seo-facebook-comments/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/seo-facebook-comments/)
 * [Active Topics](https://wordpress.org/support/plugin/seo-facebook-comments/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/seo-facebook-comments/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/seo-facebook-comments/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [pepe](https://wordpress.org/support/users/pputzer/)
 * Last activity: [12 years, 5 months ago](https://wordpress.org/support/topic/patch-for-missing-access_token/#post-4493264)
 * Status: not resolved