WordPress.org

Support

Support » Plugins and Hacks » Facebook Comments to WordPress » [Plugin: Facebook Comments to WordPress] Warning: Invalid argument supplied for foreach() in /home/s

[Plugin: Facebook Comments to WordPress] Warning: Invalid argument supplied for foreach() in /home/s

  • Been getting this error:
    Warning: Invalid argument supplied for foreach() in /home/safezone/dudelol.com/wp-content/plugins/facebook-import-comments/classes/FacebookCommentImporter.php on line 187

    The fix to make this error go away is to change:

    foreach ($comments as $num => $comment) {
                $this->importComment($comment, $parentCommentId);
            }

    to this:

    if(isset($comments))
    	{
    
            foreach ($comments as $num => $comment) {
                $this->importComment($comment, $parentCommentId);
            }
    
        }

    I am currently running this plugin on my funny pictures website and I am not sure if this plugin will continue getting comments into the database or not, this will at least make the error msg go away.

    http://wordpress.org/extend/plugins/facebook-import-comments/

Viewing 8 replies - 1 through 8 (of 8 total)
  • actually no, this fix didn’t work at ALL. In fact, I figured out that all of my comments have been getting DELETED from the wordpress database

    ok I figured out the fix, the comments were getting deleted because facebook made a change to the API

    Disregard the first post changes and change:

    line 39
    if (is_array($locComments) && is_array($locComments['data']))

    TO:
    if (is_array($locComments) && is_array($locComments['comments']['data']))

    and line 43
    $helper->import($comments['data'], $this->importMode);

    TO:
    $helper->import($comments['comments']['data'], $this->importMode);

    I fixed the plugin and re-uploaded it to the wordpress repository if anyone wants to use it.

    http://wordpress.org/extend/plugins/import-facebook-comments-to-wordpress/

    I tried to download your plugin but there were no files 🙁

    Hey buddy, your plugin doesnt have any files…. Are you going to fix it? Alot of people are eagerly wanting to use it. If it works its a major thing for big sites with facebook comments.

    I tried the other version and its working fine but the additional functionality of importing old comments is what i want as well adn I need to know whats the best way to attach more post-types to it.

    flauius

    @flauius

    Any insights?
    I will deactivate this plugin… and search for any other…

    There is no seo benefits in keeping the comments if every time I load a post I have a error message like this:

    Warning: Invalid argument supplied for foreach() in /home/directory/domain/wp-content/plugins/facebook-import-comments/classes/FacebookCommentImporter.php on line 185

    Same bug in current 1.5 version. produces php error log. needs to be fixed for wp3.5

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘[Plugin: Facebook Comments to WordPress] Warning: Invalid argument supplied for foreach() in /home/s’ is closed to new replies.
Skip to toolbar