Support » Plugin: Jetpack by » ShareDaddy error on author pages for authors without any posts.

  • Resolved AllStruck


    I was creating customized author templates when I ran across this error on any author archive page where the author does not have any published posts.

    Here is the error I see:

    NOTICE: wp-content/plugins/jetpack/modules/sharedaddy/sharing-service.php:497 – Trying to get property of non-object

    To get rid of this I wrapped that line of code in a test to make sure $post is set, like so:

    if (isset($post)) {
    		$switched_status = get_post_meta( $post->ID, 'sharing_disabled', false );

    Hope that helps, I really hope this is resolved in the next release to avoid worrying about this when I update. 🙂

    – David

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Jeremy Herve


    Jetpack Mechanic 🚀

    Thanks for the report.

    I wasn’t able to reproduce the issue on my end: do you manually insert sharing buttons to the Author archive page? If so, wouldn’t it be possible to avoid displaying the sharing function when there are no posts to display?

    Hey Jeremy,

    I should have mentioned I have wp_debug set to true on this site while I’m working…

    As far as the sharing buttons, they are set (in settings) to show only on Posts and a custom post type of Projects that I have… I’m not trying to add them here (on the author archive pages) at all, and they aren’t showing on these pages when there are posts to show, but the error doesn’t show up if the author being viewed has posts.

    While I don’t believe it makes any difference, you might notice that I have the author page permalinks rewritten to /hacker/ rather than /author/.

    Here is a screenshot of the Sharing settings for “Show button on”:

    This is the page showing the error:

    The same error in the Debug Bar plugin:

    I noticed a warning popping up on this page too (again only for authors without any posts) related to the Gravatar module of Jetpack:

    wp-content/plugins/jetpack/modules/gravatar-hovercards.php:144 – get_userdatabylogin is deprecated since version 3.3! Use get_user_by(‘login’) instead.

    Here is a screenshot of that error in the Debug Bar:

    That one of course could be fixed by using get_user_by( ‘slug’, $author ), assuming that doesn’t break something else! I’ve made the update to my install on 3.5.1 😉

    NOTE: Since I have made updates to the Jetpack code on my install these errors will not show if you try to browse it right now.

    Other potentially helpful information:
    – Active theme: Headway Child (my custom child theme of Headway).
    – Active plugins: Jetpack, WordPress SEO, BackupBuddy, Custom Post Type Archive Menu (modified), Debug Bar, Google Analytics for WordPress, Permalink Editor, Recent Custom Posts, ShortCodes UI, Types – Complete Solution for Custom Fields and Types
    , Ultimate TinyMCE, Wordfence Security, WP-Memory-Usage, WP Super Cache (not currently caching), WP Views, and Wufoo Shortcode Plugin.

    The only one of those I think could make much difference is the Headway plugin, which is generating the templates (rather than custom coding).

    Hope that all helps to reproduce what I’m seeing! I’ll be happy to provide more info and debugging as needed.

    – David

    Plugin Contributor Jeremy Herve


    Jetpack Mechanic 🚀

    We fixed the issue in r669918. the fix will be available in the next Jetpack release.

    Thanks again for the report!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘ShareDaddy error on author pages for authors without any posts.’ is closed to new replies.