WordPress.org

Ready to get started?Download WordPress

Forums

Comments Evolved for WordPress
[resolved] Fatal error: Call to a member function find() on a non-object (5 posts)

  1. Chris M.
    Member
    Posted 1 year ago #

    Hey Brandon!

    On one of my sites I'm occasionally getting this error displaying on the front end of my site:

    Fatal error: Call to a member function find() on a non-object in /plugins/gplus-comments/includes/lib/frontend.php on line 87

    I'm running WP 3.6 and your Github revision 1.5.7.

    Any thoughts?

    ~ Chris

    http://wordpress.org/plugins/gplus-comments/

  2. Chris M.
    Member
    Posted 1 year ago #

    Line 87 being:

    $count_raw = $link_body->find('#widget_bounds > span', 0);

  3. Brandon Holtsclaw
    Member
    Plugin Author

    Posted 1 year ago #

    yea, its one of the comment services's is returning an empty string/error instead of the correct data or a zero if there are none ... and my silly persons has not put any error checking into that chunk of code yet to watch for it .... but before 1.5.8 is pushed i for sure will

    thanks

  4. Brandon Holtsclaw
    Member
    Plugin Author

    Posted 1 year ago #

    yea , its a bit crude and I'll fix it better in the next update but you can replace that whole line with this one below and it will check for that so it wont happen again when your server or google ( i'm guessing you server ) becomes to overwhelmed :P )


    if(!empty($link_body)) {
    $count_raw = $link_body->find('#widget_bounds > span', 0);
    }

    Cheers!

  5. Chris M.
    Member
    Posted 1 year ago #

    So, this (the whole section):

    function comments_evolved_get_gplus_count($url = "") {
      include_once COMMENTS_EVOLVED_LIB . '/simple_html_dom.php';
      if(empty($url)){ $url = get_permalink(); }
      $link = 'https://apis.google.com/_/widget/render/commentcount?bsv&href=' . urlencode($url);
      $link_body = get_transient('ce_'.$link);
      if (false === $link_body) {
        $link_body = wp_remote_retrieve_body(wp_remote_get($link));
        set_transient('ce_'.$link, $link_body, 60);
      }
      $link_body = str_get_html($link_body);
      if(!empty($link_body)) {
      $count_raw = $link_body->find('#widget_bounds > span', 0);
    }
      $count_arr = split(" ",$count_raw->plaintext);
      return trim($count_arr[0]);
    }

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic