WordPress.org

Support

Support » Plugins and Hacks » [Resolved] Getting the exact comment count

[Resolved] Getting the exact comment count

  • Boris Kuzmanovic
    Member

    @boris-kuzmanovic

    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 🙂

Viewing 1 replies (of 1 total)
  • Plugin Author Neoseifer22
    Member

    @neoseifer22

    Thank you Boris 🙂
    I’ve put your changes in 1.2.2.

Viewing 1 replies (of 1 total)
  • The topic ‘[Resolved] Getting the exact comment count’ is closed to new replies.