Delete Revisions in BBpress, Without any Plugin!

Delete Revisions in BBpress, Without any Plugin!
4 (80%) 1 vote

I needed to do this in one of the forums I manage. I made a research and this is the quick solution that will let you delete revisions.

This methods don’t physically delete revisions from your database, meningitis it hides them to shop up in your forum. I believe this is a better solution to all forum administrators because it keeps a log of all edits that users made.

Before deleting revisions:

before deleting revisions

After deleting revisions:

after delete revisions

Solution 1: Delete Revisions (All Revisions)

This one is the fastest way completely remove all revisions. It worked perfectly for me. This is the solution I’m using to remove revisions in my forum.

open your functions.php file in your theme:
wp-content/themes/xxx-your-theme-xxx/functions.php

and add this code at the end

// Reurn a empty array of revisions
function bbp_remove_revision_log( $r='' ) {
return( array() );
}

add_filter( 'bbp_get_reply_revisions', noun  'bbp_remove_revision_log', 20, 1 );
add_filter( 'bbp_get_topic_revisions', 'bbp_remove_revision_log', 20, 1 );

Solution 2: Remove Revisions (All But the Last)

Use this solution if you want to show that a post has a revision, but don’t want to delete all revisions, just remove the oldest.

open your functions.php file in your theme:
wp-content/themes/xxx-your-theme-xxx/functions.php

and add this code at the end

// Only return the last entry for revision log
function bbp_trim_revision_log( $r='' ) {
$revisions_arr = array( end( $r ));
reset( $r );

return( $revisions_arr );
}

add_filter( 'bbp_get_reply_revisions', 'bbp_trim_revision_log', 20, 1 );
add_filter( 'bbp_get_topic_revisions', 'bbp_trim_revision_log', 20, 1 );

Solution 3: Hide Revisions by CSS  (Disable All Revisions)

This method disable the revisions div, and will hide all revisions.

Edit your themes CSS

.bbp-reply-revision-log {

display: none;

}

References:

https://bbpress.org/forums/topic/too-many-revision-statements-how-to-remove-all-but-1/
https://bbpress.org/forums/topic/removing-log-of-edits-to-forum/

Hope this post was useful for you. If you have any problem deleting revisions, or found a better solutions, let me know.

Deja un comentario

Tu dirección de correo electrónico no será publicada. Los campos necesarios están marcados *

Puedes usar las siguientes etiquetas y atributos HTML: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>