bbp_version_updater()
Forums’ version updater looks at what the current database version is, and runs whatever other code is needed.
Description
This is most-often used when the data schema changes, but should also be used to correct issues with Forums meta-data silently on software update.
Source
File: bp-forums/core/update.php
function bbp_version_updater() {
// Get the raw database version
$raw_db_version = (int) bbp_get_db_version_raw();
/** 2.0 Branch ************************************************************/
// 2.0, 2.0.1, 2.0.2, 2.0.3
if ( $raw_db_version < 200 ) {
// No changes
}
/** 2.1 Branch ************************************************************/
// 2.1, 2.1.1
if ( $raw_db_version < 211 ) {
/**
* Repair private and hidden forum data
*
* @link http://bbpress.trac.wordpress.org/ticket/1891
*/
bbp_admin_repair_forum_visibility();
}
/** 2.2 Branch ************************************************************/
// 2.2
if ( $raw_db_version < 220 ) {
// Remove the Moderator role from the database
remove_role( bbp_get_moderator_role() );
// Remove the Participant role from the database
remove_role( bbp_get_participant_role() );
// Remove capabilities
bbp_remove_caps();
}
/** 2.3 Branch ************************************************************/
// 2.3
if ( $raw_db_version < 230 ) {
// No changes
}
/** All done! *************************************************************/
// Bump the version
bbp_version_bump();
// Delete rewrite rules to force a flush
bbp_delete_rewrite_rules();
}
Changelog
| Version | Description |
|---|---|
| bbPress (r4104) | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.