$wpfc_entry_views error

Issue #22 resolved
Phil Johnston created an issue

When I am viewing the single page of a sermon, it is giving an error that reads:

"Warning: Creating default object from empty value in .../wp-content/plugins/sermon-manager-for-wordpress/includes/entry-views.php on line 62"

You should do a check to see if that variable has a value before putting a value into it.

Example:

/ Set the post ID for later use because we wouldn't want a custom query to change this. / if (isset($wpfc_entry_views)) { $wpfc_entry_views->post_id = $post->ID; }

Fix for page: http://pastebin.com/RecDHpyP

Comments (7)

  1. Phil Johnston reporter

    Even if you put a filter in there so I can reset it via the theme or a plugin. It's not nice to have that error constantly showing up.

    It shows because I have wp_debug on

  2. Phil Johnston reporter

    What if you did this instead:

    if (isset($wpfc_entry_views->post_id)) { $wpfc_entry_views->post_id = $post->ID; }

    I don't understand how it could possibly break anything. All it would be doing is checking to see if it has a value.

    If it doesn't have a value, it's not counting anything anyway - so how could it break any counter?

    If it has a value than it continues as normal.

  3. Jon Blower Account Deactivated

    I have a fix for this, but for some reason getting access denied when I try to create a pull request.

    Moveplugins, I don't think it's a great idea to be running with wp_debug set to on in a live or production environment. When it's off the error doesn't show.

    This is also the same as issue #19. Can you link issues on bitbucket?

  4. Phil Johnston reporter

    I don't run wp_debug in a live environment. I run it in my production environment so that I catch errors as soon as they happen.

  5. Log in to comment