WordPress.org

Ready to get started?Download WordPress

Forums

Simple Facebook Connect
Photo Browsing gets PHP Error when I try to connect (16 posts)

  1. MikeDacre
    Member
    Posted 2 years ago #

    Hi,

    When I try to connect to 'Facebook Images' when creating a new post I get the following error:

    Warning: Invalid argument supplied for foreach() in [hidden]/wp-content/plugins/simple-facebook-connect/sfc-photos.php on line 132

    Interestingly, the 'Connect with Facebook' button is still there and does work, I get the little facebook pop-up window. After I grant authorization, I am returned to the starting window, but no images appear, and that error remains there (as does the connect button).

    If I dig out the foreach loop referenced in the error it is:

    foreach ($albums as $album) {
    	echo '<td>';
    
    	$link = admin_url("media-upload.php?post_id=$post_id&type=$type&tab=$redir_tab&album={$album['id']}");
    	// retrieve the cover image for the album
    	if (false !== ($photo = sfc_photo_get_photo($album['cover_photo'], $user['access_token']) ) ) {
    		echo "<p><a href='$link'><img src='{$photo['images'][1]['source']}' /></a></p>";
    	} else {
    		// TODO cover not available
    	}   
    
    	echo "<p><a href='$link'>{$album['name']}</a></p>";
    	echo '</td>';
    
    	if ($i%3 == 0) echo '</tr><tr>';
    	$i++;
    }

    http://wordpress.org/extend/plugins/simple-facebook-connect/

  2. Samuel Wood (Otto)
    Tech Ninja
    Plugin Author

    Posted 2 years ago #

    Yes, it just started doing this to me too. I think Facebook changed something. I'll investigate it, but I likely won't be able to get a fix out until Monday.

  3. Cristiano
    Member
    Posted 2 years ago #

    Any news?

  4. Samuel Wood (Otto)
    Tech Ninja
    Plugin Author

    Posted 2 years ago #

    The OAuth2 broke this. I have a patch in trunk now if you want to try it.

    You'll need the newer sfc-base.php and sfc-photos.php files:

    http://plugins.svn.wordpress.org/simple-facebook-connect/trunk/

  5. Cristiano
    Member
    Posted 2 years ago #

    I got the newer sfc-base.php and sfc-photos.php and I still get this error:

    Warning: Invalid argument supplied for foreach() in /homepages/9/d245243236/htdocs/wp-content/plugins/simple-facebook-connect/sfc-photos.php on line 133
  6. Cristiano
    Member
    Posted 2 years ago #

    And one question, with this working I can get an album from a facebook page, or just from my profile?

  7. Samuel Wood (Otto)
    Tech Ninja
    Plugin Author

    Posted 2 years ago #

    Regarding the error: You may have to wait about 6 hours for the old transients to expire before it will try to get the photo albums again.

    And it only works with your profile at the moment.

  8. Cristiano
    Member
    Posted 2 years ago #

    I think I misunderstood that... I want to fetch a whole photo album from a fanpage and publish it on a wordpress page.

    Is it posible with this plugin? Maybe I can use the core code of the plugin to make the page-facebook connections and add some code just to get the album?

    Thanks again!

  9. Samuel Wood (Otto)
    Tech Ninja
    Plugin Author

    Posted 2 years ago #

    No, that module doesn't put whole albums on there as galleries at this time. It just lets you add photos from your FB account to the page content, similar to adding a normal photo.

    It also doesn't do albums from Pages, just your user's albums and photos.

  10. ialima7
    Member
    Posted 2 years ago #

    Same error to me.

    Warning: Invalid argument supplied for foreach() in /home/.../wp-content/plugins/simple-facebook-connect/sfc-photos.php on line 132

    I Love SFC. [:D]

  11. evilkalah
    Member
    Posted 2 years ago #

    I just updated from 0.X to 1.1 |

    wordpress version is 3.3

    and i'm getting
    Warning: Invalid argument supplied for foreach() in /usr/home/vftp/****************/***********/wp-content/plugins/simple-facebook-connect/sfc-photos.php on line 132

    any fix yet?

  12. Samuel Wood (Otto)
    Tech Ninja
    Plugin Author

    Posted 2 years ago #

    Does the development version of the plugin work for you? It seems to work okay for me on my site with WP 3.3. The FB images area is ugly, but functional.

    You can find the dev version of the plugin here:
    http://wordpress.org/extend/plugins/simple-facebook-connect/download/

  13. evilkalah
    Member
    Posted 2 years ago #

    that one is working :)

    thanks !!!

    takes a while to load ( seems normal to me as it needs to download it from facebook)

  14. evilkalah
    Member
    Posted 2 years ago #

    1 thing when you didn't approve facebook yet you will get the following
    Warning: Invalid argument supplied for foreach() in /usr/home/vftp/*****/********/wp-content/plugins/simple-facebook-connect/sfc-photos.php on line 133

    if you then click connect facebook there is no problem...

    Founded this one on my girlfriends account.

  15. Samuel Wood (Otto)
    Tech Ninja
    Plugin Author

    Posted 2 years ago #

    Fixed warning in dev. version.

    Speed is slow first time as it loads data, but it caches the result using transients. So speed after that will be faster but it may take a few hours for new photos on FB to appear there.

  16. alhertz
    Member
    Posted 2 years ago #

    Experienced a similar issue but resolved it thanks to this thread. Any possibility that adding photos from a page will be coming in future updates? :)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic