Hi,

I get some php notices in facebook_pull-feed.tpl.php. Messages or descriptions are not always present in the feed which means $item->message or $item->description are not always defined when printed.

You'll find a patch attached.

CommentFileSizeAuthor
php_notices_template_pull_feed.patch896 bytesAnonymous (not verified)
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jpshayes’s picture

Title: php notices in facebook_pull-feed.tpl.php » php notice Undefined property: stdClass::$message in include() from facebook_pull-feed.tpl.php

I was getting the same errors. Applied patch cleanly, errors are gone. Thanks.

I updated the title with a little more description.

jpshayes’s picture

Status: Active » Needs review

Marking as "Needs Review"

Khalor’s picture

Status: Needs review » Reviewed & tested by the community

Applies cleanly, fixes the error.

aidanlis’s picture

Status: Reviewed & tested by the community » Fixed

Thanks, I've applied the patch to the 6.x and 7.x branches.

Anonymous’s picture

Cool!

Status: Fixed » Closed (fixed)

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

TomSherlock’s picture

The most recent version on the project page does not include the patch.

marcus178’s picture

I have applied this patch but still getting an error of

Notice: Undefined property: stdClass::$name in include() (line 10 of /modules/contrib/facebook_pull/facebook_pull-feed.tpl.php).

Also it's not actually displaying the messages just the Page name and time of post.

petergus’s picture

that patch was not applied in the latest version. applying removes the error message, however the base problem remains.... there are no messages coming in. i only see the pictures, name, and time.

i think could be related to which "Object type" to choose....?

valderama’s picture

patch works.

It would be nice to make a new release of the module?

phai’s picture

To solve your problem you should edit that file (see filename inside patch).
Replace
echo l($item->name, $item->link);
writing
if(isset($item->name)) echo l($item->name, $item->link);

ErikU’s picture

Perfect! #11 needs to be applied to the next release!

jweedman’s picture

Thank you! I always like to make small changes like this manually rather than a patch ... seems overkill.

ALSO: For others who might be getting more "NOTICES:" than just the one from $item->name variable - make sure you check that the $item->message and $item->description variables are set before you try to print them out as well.

I was getting 4 notices from the facebook_pull-feed.tpl.php file. Like #11 said, but use if(isset(...)) to check those variables exist before you print them, and notices should clear up. Thanks again, guys.

kyuubi’s picture

This problem is still happing when downloading the lastest release.

Basically I had to apply 2 patches for this module to work properly, this one and this one https://drupal.org/node/1989030

Can you commit to a release?

shiervermont’s picture

Issue summary: View changes

The solution posted by "toonketels" works fine. Thanks.

JoshuaHartmann’s picture

Just a heads up I am still having this error issue post recommended patch with the latest d7 version. Also notice it seems to be pulling & displaying blank posts when it errors.
As I only display the latest post I have worked around this by displaying 2 and using this js to do some hiding.

var fb_feed = $('.facebook-feed li:nth-child(1) .facebook-feed-message').text().length;
if (fb_feed < 20) {
  $('.facebook-feed li:nth-child(1)').hide();
}
else{
  $('.facebook-feed li:nth-child(2)').hide();
}

Not a fix, just a work around.

nedjo’s picture

Status: Closed (fixed) » Needs review

Reopening as the follow-up change suggested in #11 addresses a remaining bug and has not yet been addressed.

  • daveferrara1 committed 84d3afc on 7.x-1.x, develop authored by phai
    Issue #1349408 by phai: php notice Undefined property: stdClass::$...
daveferrara1’s picture

Status: Needs review » Closed (fixed)

daveferrara1’s picture

Status: Needs review » Closed (fixed)