WordPress.org

Ready to get started?Download WordPress

Forums

Jetpack by WordPress.com
[resolved] ShareDaddy error on author pages for authors without any posts. (4 posts)

  1. AllStruck
    Member
    Posted 1 year ago #

    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. :)

    Thanks!
    - David

    http://wordpress.org/extend/plugins/jetpack/

  2. Jeremy Herve
    Happiness Engineer
    Plugin Author

    Posted 1 year ago #

    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?

  3. AllStruck
    Member
    Posted 1 year ago #

    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":
    http://cl.ly/image/3w0A0Y3s3E2P

    This is the page showing the error:
    http://cl.ly/image/203N3r2Y240k

    The same error in the Debug Bar plugin:
    http://cl.ly/image/1b1i3Q053K18

    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:
    http://cl.ly/image/221X303P1l16

    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

  4. Jeremy Herve
    Happiness Engineer
    Plugin Author

    Posted 1 year ago #

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

    Thanks again for the report!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic