WordPress.org

Forums

Facebook Comments Importer
[resolved] Getting the exact comment count (2 posts)

  1. Boris Kuzmanovic
    Member
    Posted 1 year ago #

    I've been using your plugin for a while now and it has worked great for me.

    In fbci.class.php of the latest version (1.2.1) there are several lines that refer to count($item["comments"]).

    If you want to get the exact comment count, you should use count($item["comments"]["data"]).

    This is what I have at around line 135:

    if(!isset($item["comments"]) || !isset($item["comments"]["data"])) {
    	$this->test_result .= "<td>" . __('No comment', 'facebook-comments-importer') . "</td>" ;
    } else {
    	$this->test_result .= "<td>" . sizeof($item["comments"]["data"]) . " " . __('comments', 'facebook-comments-importer') . "</td>" ;
    }
    $nb_imported_comments = $this->get_imported_comment_number($post_id);
    if(!isset($item['link']) || ($post_id == 0)){
    	$this->test_result .= "<td style=\"color:red\">" . __('Impossible', 'facebook-comments-importer') . "</td>" ;
    } elseif($nb_imported_comments == 0 && (!isset($item["comments"]) || !isset($item["comments"]["data"]))){
    	$this->test_result .= "<td>-</td>" ;
    } elseif($nb_imported_comments == 0){
    	$this->test_result .= "<td>" . __('Not yet', 'facebook-comments-importer') . "</td>" ;
    } else {
    	$this->test_result .= "<td style=\"color:green\">" . $nb_imported_comments . " " . __('comments', 'facebook-comments-importer') . "</td>" ;
    }

    Hope it helps :)

  2. Neoseifer22
    Member
    Plugin Author

    Posted 1 year ago #

    Thank you Boris :)
    I've put your changes in 1.2.2.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Facebook Comments Importer
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags

No tags yet.