The MU forums have moved to WordPress.org

get_last_updated and comments (13 posts)

  1. cori
    Member
    Posted 17 years ago #

    Asking for a sanity-check here.

    Can anybody think of a reason that it wouldn't be good to stop updating last_updated when a comment or pingback is added or deleted?

    I have a headshot that appears on a different site with a link to the last blog posted to. I'm using get_last_updated() to get the last blog, but that feature returns the last blog with any activity at all, including comments, so I've used a plugin to remove the actions that updated the wp_blogs table for comment-related activity.

    I understand that anything that relies on wp_blogs->last_updated for displaying blog activity *including* comments wouldn't work, but we're not interested in counting comments in a blog's activity measures. I've had a walk through the code to see if anything else relies on this bit of data and don't see anything obvious.

  2. drmike
    Member
    Posted 17 years ago #

    Can anybody think of a reason that it wouldn't be good to stop updating last_updated when a comment or pingback is added or deleted

    None that I can think of myself but that's really a Donncha question since he knows the code best out of all of us.

    I'm hoping he'll give us a reply on the subject.

  3. suleiman
    Member
    Posted 17 years ago #

    cori would you mind making your plugin available? I know that I for one would love to get rid of that pesky comments updating recent activity issue.

    OFFTOPIC!
    Also, did you manage to get that image manager working on your site again? I've been having some trouble with it.

  4. andrewbillits
    Member
    Posted 17 years ago #

    I can't even begin to tell you how many requests i've had to "fix" my plugins so that comments don't count as a blog being updated. I've also looked through the code and found nothing that would be dependant on that field.

  5. cori
    Member
    Posted 17 years ago #

    What I did (it doesn't even really count as a plugin, as far as I'm concerned) was to include the following:

    <?php
    remove_action( 'comment_post', 'wpmu_update_blogs_date' );
    remove_action( 'delete_comment', 'wpmu_update_blogs_date' );
    remove_action( 'wp_set_comment_status', 'wpmu_update_blogs_date' );
    remove_action( 'trackback_post', 'wpmu_update_blogs_date' );
    ?>

    in a file placed in mu-plugins - I have a plugin that copies a few files on the wpmu_new_blog hook that I stuck them in, but it should work just as well in a file of its own. It reverses lines 14, 16, 20, and 21 in wp-includes/wpmu-functions.php.

    I debated also removing the call to wpmu_update_blogs_date for deleting posts, but it seemed to me that logically the comment-based functions aren't really updates to the blog itself and I could argue that they shouldn't alter wp_blogs->last_updated. Deleting a post, however, is a different story. I figure I can create a plugin to update a different column in a new table if we later decide we want to track active-ness of blogs.

    There are similar functions for pages in wp-content/mu-plugins/misc.php on lines 119 - 126, but we don't use pages much, so that's not that important to us.

  6. drmike
    Member
    Posted 17 years ago #

    Might be quicker just to delete the code directly from source. :)

    I'm big on the fewer the plugins the better myself. Just means additional calls every single time something goes though.

    I'm off to a volenteer gig shortly. If someone bumps this up in an hour or so, I'll add it in to the FAQ over on trac. Heck, someone might even want to add it in as a ticket. Maybe we can convince Donncha to remove this or give us his thoughts on why this is why it is. (Maybe we're missing something here.)

  7. cori
    Member
    Posted 17 years ago #

    proably would be speedier to do so, but I'm of the "avoid altering core when possible" school of thought (which I think you're not, right drmike?).

    I'll file a ticket and see if Donncha bites.

  8. mrjcleaver
    Member
    Posted 17 years ago #

  9. drmike
    Member
    Posted 17 years ago #

    I'd also like to hear about this from Donncha before I write out a FAQ.

    Ticket:
    http://trac.mu.wordpress.org/ticket/159

  10. cori
    Member
    Posted 17 years ago #

    d'oh. I started a tcket a few hours back and just finished it. Didn't search again before I posted... http://trac.mu.wordpress.org/ticket/160 (closed as duplicate)

  11. donncha
    Key Master
    Posted 17 years ago #

    I deleted those actions that worked off comment and trackbacks so last_updated shouldn't be updated. Should make it easier to backup blogs if you use that field as an indicator of newness!

  12. drmike
    Member
    Posted 17 years ago #

    Actually for me it was theme demo blogs that kept getting on that list. :)

    Since I don't update them, they'll never show up anymore and those blogs that do actually update will be there.

    Thanks Donncha.

  13. cori
    Member
    Posted 17 years ago #

    Thanks much, Donncha!

About this Topic