When I click on the number of comments link i.e. "x comments", I get an error

Invalid argument supplied for foreach() in /www/drupal/indic/sites/all/modules/facebook_stream/comments_display.tpl.php on line 7.

I checked the functioning of the module and it turns out that it should ask for permission first but apparently, it didn't do that in my case! Any idea why it maybe happening?

Comments

ravdeepchawla’s picture

Hi folks, I fixed the error but the issue is too small to create a patch for it...

The issue is with this line...
function fb_stream_get_post_comments() {
$post_id = $_POST['post_id']; // Returns a value "xxxxxxxxx_yyyyyyyyyyyy " Notice the white space at the end

I fixed it using a simple trim function in the next line...
- $comments = $fb->api_client->stream_getComments($post_id);
+ $comments = $fb->api_client->stream_getComments(trim($post_id));

ravdeepchawla’s picture

Status: Active » Needs review

Marking as needs review.. I guess the maintainer can test it out and mark it RTBC. Pretty minor change only...

pflame’s picture

Hi ravdeepchawla,

I will check total module code about this type of errors. Thanks for taking time and providing patch.

pflame’s picture

Status: Needs review » Fixed

Fixed this on the development release. It will take 24 hours to get updated on the development release

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.