Modding WP CodeFreeze to lock bbPress as well

Modding WP CodeFreeze to lock bbPress as well

CodeFreeze is a very handy plugin that helps you freeze the state of your WordPress website before and during a move (to a new server, for example).  CodeFreeze:

  • disables adding/editing/deleting new content, media, themes, etc.
  • disables installing/activating/deactivating/updating/deleting all plugins (except itself, to allow recovery)
  • disables new comments/trackbacks on all content items
  • removes the QuickPress widget and notices to upgrade core or plugins
  • provides notice to dashboard users that any changes will be lost
  • provides generally “read only” access to the dashboard – while still allowing exports, backups, etc

The only minus I found so far is that it doesn’t (yet) include support for the bbPress Wordpres plugin as well. Using CodeFreeze on a website also using bbPress will leave all forums open for new topics and replies.

Thankfully, making CodeFreeze handle bbPress as well only requires a couple of new lines of code. Edit the code-freeze/code-freeze.php file and locate

function cf_close_comments() {

In that function, find

add_filter( 'pings_open', 'cf_close_the_comments', 10, 2 );

and after that line add

add_filter( 'bbp_current_user_can_access_create_reply_form', cf_close_bbp_comments ); // MOD: also disable bbpress topic replies
add_filter( 'bbp_current_user_can_access_create_topic_form', cf_close_bbp_comments ); // MOD: also disable bbpress new topic
function cf_close_bbp_comments(){
return FALSE;
}

NOTE: Version 1.2.2 of the plugin includes this enhancement.

Leave a Reply