bbp_version_updater

BbPress's version updater looks at what the current database version is, and runs whatever other code is needed.

Description

bbp_version_updater(); 

This is most-often used when the data schema changes, but should also be used to correct issues with bbPress meta-data silently on software update.


Usage

  1. if ( !function_exists( 'bbp_version_updater' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'bbpress/includes/core/update.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = bbp_version_updater(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/includes/core/update.php  
  1. function bbp_version_updater() { 
  2.  
  3. // Get the raw database version 
  4. $raw_db_version = (int) bbp_get_db_version_raw(); 
  5.  
  6. /** 2.0 Branch ************************************************************/ 
  7.  
  8. // 2.0, 2.0.1, 2.0.2, 2.0.3 
  9. if ( $raw_db_version < 200 ) { 
  10. // No changes 
  11.  
  12. /** 2.1 Branch ************************************************************/ 
  13.  
  14. // 2.1, 2.1.1 
  15. if ( $raw_db_version < 211 ) { 
  16.  
  17. /** 
  18. * Repair private and hidden forum data 
  19. * @link http://bbpress.trac.wordpress.org/ticket/1891 
  20. */ 
  21.  
  22. /** 2.2 Branch ************************************************************/ 
  23.  
  24. // 2.2 
  25. if ( $raw_db_version < 220 ) { 
  26.  
  27. // Remove the Moderator role from the database 
  28. remove_role( bbp_get_moderator_role() ); 
  29.  
  30. // Remove the Participant role from the database 
  31. remove_role( bbp_get_participant_role() ); 
  32.  
  33. // Remove capabilities 
  34.  
  35. /** 2.3 Branch ************************************************************/ 
  36.  
  37. // 2.3 
  38. if ( $raw_db_version < 230 ) { 
  39. // No changes 
  40.  
  41. /** All done! *************************************************************/ 
  42.  
  43. // Bump the version 
  44.  
  45. // Delete rewrite rules to force a flush