Hi, I have the module working fine but my profile picture in the feed is just showing as a box with a ? in it.

I have tried using a different feed which works on another of my sites and I get the same issue.

Any ideas?

Many thanks.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dpape’s picture

I'm experiencing the same issue.

Looking at the facebook_pul-feed.tpl.php file and the "$item->from->id" and "$item->from->name" arent being populated. I'm diggin around to see whats going on.

darvanen’s picture

Priority: Normal » Major

Part of the problem lies in the fact that this module is no longer keeping up with the facebook API.

For instance this section of code returns a URL in the format "https://graph.facebook.com/[id]/[type]?access_token=[token]&limit=[limit]"

/**
 * Pull data from a facebook feed
 */
function _facebook_pull_feed($graph_id, $type, $token, $options = array()) {
  $qs = http_build_query($options, '', '&');
  $url = "https://graph.facebook.com/%s/%s?%s&%s";
  $fullurl = sprintf($url, $graph_id, $type, $token, $qs);

When it should now be in the format "https://graph.facebook.com/[version]/[type]?id=[id]&access_token=[token]..."

The caching system and simple admin UI make this module well worth keeping, but the interface with FB needs an overhaul.

darvanen’s picture

The Graph API no longer returns full Post objects for a feed edge.

Here's a patch that updates the Graph API call to take version into account (via settings form), with a stripped back template file to show only the fields that are returned.

Next steps if you need the profile pictures would probably be to create a sub-module that iterates through the post IDs returned by the feed edge call and populates the required fields.

This patch also incorporates Issue #1587598: Use drupal_http_request() instead of file_get_contents().

darvanen’s picture

Oops, here's the file.

bwporter’s picture

Hi,

I appreciate the patch, but when I tried to apply it I got the following:
git apply -v facebook_pull-profile_pictures-2541316-3.patch
fatal: corrupt patch at line 140

darvanen’s picture

Just tried it again on a fresh copy of the dev version, works fine for me.

Just want to check that you are:

  • applying it to the latest dev version?
  • using the command "patch -p1 < /location/filename" ?

Note that it's a pretty hacky patch only intended to get things working again, not a final solution.

bwporter’s picture

@Darvanen - thank you for the quick response. I pulled a fresh copy of the module (btw, couldn't find a dev version) and a fresh copy of your patch and applied the patch as you suggested. It is working as expected for me now. Thank you.

darvanen’s picture

Good to hear!

It looks like you can only get the dev version via git at the moment.

darvanen’s picture

Status: Active » Needs work
Related issues: -#1587598: Use drupal_http_request() instead of file_get_contents()
FileSize
5.77 KB

New patch for recent dev version, no longer includes the related issue's code as that has been committed.

The template files need a lot of work - I haven't even touched the notes template.

ptsimard’s picture

Hello all. While trying to use this module I came across the same issues. I applied Darvanen's patch #9 which improved things but also added my own customization on top.

Namely:

Facebook Fields support:

Added a "fields" field in the admin interface so users can input which facebook fields they need pulled.

Changed the url syntax

Now using the documented api syntax: https://graph.facebook.com/[api version]/[object id]/[object type]?[access_token]&[limit]&[fields]

Tested it with API v2.5

Changed the feed template file

Now makes use of the 'picture' field

    <?php if (isset($item->picture)): ?>
    <span class="facebook-feed-picture"><img alt="" src="<?php echo $item->picture ?>" /></span>
    <?php endif; ?>

Also added a check_markup() on the message field so it renders links.

Disclaimer: I only tested this with a feed of posts from a page and it works perfectly. I'll let you test with the other things you might need it for.

ptsimard’s picture

Wow. My mouse quadruple-clicked the summit button.. weird. Edited*

ptsimard’s picture

Wow. My mouse quadruple-clicked the summit button.. weird. Edited*

ptsimard’s picture

Wow. My mouse quadruple-clicked the summit button.. weird. Edited*

daveferrara1’s picture

This can't patch can't be committed at this time like this.

The main reason is the api version requirement. That needs to be set by default to a value that is consistent with what is returned by Facebook now. Looks to me like someone upgrading module versions would have to go set that value or it fails. About ~1000 sites use the module so we have to consider someone upgrading.

This is more like a new version than an update - maybe we make it an alpha.

darvanen’s picture

I thoroughly agree.

ptsimard’s picture

Hello,

While I understand your concerns and would prefer to be fully compatible, I currently don't have the time to improve it in a backward compatible way (crunch time). But I wanted to contribute back the latest some improvements I did. Hopefully you can find them useful.

Also I understand that this tread might not be the best place for random improvements, but since my work used Darvanen's patch as a starting point I feel I should post this next patch here.

Bottom line for patch #16 is:

  • Improves the previous one a bit, especially regarding the graph item types like message, story and link.
  • Adds a fully working Bean plugin. (Since I don't use Box and needed multiple feeds). Each bean instance inherits and is able to override the global settings except the app token and secret.
darvanen’s picture

Thanks for the work you *have* done, my patch was a very rough beginning.

I think Dave is suggesting that it should be the basis for a new major version (7.x-3.0 alpha 1), for reasons beyond your control, and it is that which I agree with.

fabienlege’s picture

Patch not working anymore, same on develop branch. Any news for this bug ?

daveferrara1’s picture

Plans is to use this patch as an example for a new D7 version. I wouldn't path the current release with it and expect it to work. Also a D8 version in the works as well. January probably on both of those.