Skip to:
Content
Pages
Categories
Search
Top
Bottom

WP Sweep and Topic changelogs

  • @ajtruckle

    Participant

    I use a plugin called WP Sweep. I have asked on their forum but no reply to date. And for the issues I did raise they were not willing to do anything.

    Their plugin is useful but when it sweeps all “revisions” it purges out all of the changelog history for various bbpress forum topics and replies. I would like the SW Sweep plugin to omit any bbPress changelog entries.

Viewing 13 replies - 1 through 13 (of 13 total)
  • @ajtruckle

    Participant

    The author told me to clone his plugin and extend it to support what we require. Oh well.

    Andrew

    @robin-w

    Moderator

    if you go into the plugin and find

    wp-sweep.php

    find line 557 which says

    foreach ( $query as $id ) {
    												wp_delete_post_revision( (int) $id );
    }

    and amend to

    foreach ( $query as $id ) {
    $post_parent_id = wp_get_post_parent_id ($id) ;
    $type = get_post_type ($post_parent_id) ;
    if ($type != 'topic' && $type != 'reply' ) 
    wp_delete_post_revision( (int) $id );
    }

    that should do it

    @ajtruckle

    Participant

    Thanks. I will try this on my beta site tomorrow.

    Will this work for both:

    Revision
    Tag

    ?

    Andy

    @robin-w

    Moderator

    Actually, this is the (I hope) correct code for revisions

    foreach ( $query as $id ) {
    $post_parent_id = wp_get_post_parent_id ($id) ;
    $type = get_post_type ($post_parent_id) ;
    if ($type != 'topic' && $type != 'reply' ) 
    wp_delete_post_revision( (int) $id );
    }

    @robin-w

    Moderator

    I can’t see an option for tags in the code

    @ajtruckle

    Participant

    Hi @robin-w

    Thanks for the revised code which I have yet to try.

    There are two aspects in general to consider with respects to the plugin:

    1. The actual sweeping (which you have been looking at)
    2. The actual stats provided on the plugin page.

    Both ideally need to be addressed. For example, you mention about the tags, but in his backend they are referred to as terms:

    View post on imgur.com

    I think terms are unused_terms in the function you referred to. But as mentioned, for this sweeping change to make sense the stats also need revising so they are not included in the counts or detail lists.

    @ajtruckle

    Participant

    Your new code is working fine for “revisions” 🙂

    It turns out that in the backend after I run your code I am left with two revisions. Both of which are forum posts 🙂 Cool .. well done.

    Maybe we can do the same for the terms (tags)?

    Andrew

    @robin-w

    Moderator

    the ‘term’ code deletes orphaned and unused stuff in the database. By definition these belong to nothing, so there is no bbpress relationship (or indeed other relationship) that you can select against

    @ajtruckle

    Participant

    Ok! Then I will go ahead and sweep those terms. Thanks.

    @ajtruckle

    Participant

    Here are the results after running the sweep for revisions:

    View post on imgur.com

    So 3 are good. I am not sure about the two “null” ones though?

    The terms are now purged. 🙂

    Thanks for your help.

    @robin-w

    Moderator

    no idea ! but I think you are there in terms of getting rid of 99.9999% !

    @ajtruckle

    Participant

    Yes, thanks though!

    @ajtruckle

    Participant

    I have delved into the database using php admin on my domain portal to see what is happening.

    All of the “null” entries are where we have revisions for “replies” to “topics”. So if a “topic” has a revision it is listed. But if it is a reply, it is not listed. I verified this by doing the sql query in the database and those fields are empty.

    So whilst it looks “odd” that there is these null items they are valid. Technically the wp sweep should be improved to obtain those names from the primary topic and list it rather than null.

    But at least we know why now.

Viewing 13 replies - 1 through 13 (of 13 total)
  • You must be logged in to reply to this topic.
Skip to toolbar