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

247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
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
         *
         */
        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

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.