bp_core_maybe_install_signups

Check if the signups table needs to be created or upgraded.

Description

bp_core_maybe_install_signups(); 

Usage

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

Defined (1)

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

/bp-core/bp-core-update.php  
  1. function bp_core_maybe_install_signups() { 
  2. global $wpdb; 
  3.  
  4. // The table to run queries against. 
  5. $signups_table = $wpdb->base_prefix . 'signups'; 
  6.  
  7. // Suppress errors because users shouldn't see what happens next. 
  8. $old_suppress = $wpdb->suppress_errors(); 
  9.  
  10. // Never use bp_core_get_table_prefix() for any global users tables. 
  11. $table_exists = (bool) $wpdb->get_results( "DESCRIBE {$signups_table};" ); 
  12.  
  13. // Table already exists, so maybe upgrade instead? 
  14. if ( true === $table_exists ) { 
  15.  
  16. // Look for the 'signup_id' column. 
  17. $column_exists = $wpdb->query( "SHOW COLUMNS FROM {$signups_table} LIKE 'signup_id'" ); 
  18.  
  19. // 'signup_id' column doesn't exist, so run the upgrade 
  20. if ( empty( $column_exists ) ) { 
  21.  
  22. // Table does not exist, and we are a single site, so install the multisite 
  23. // signups table using WordPress core's database schema. 
  24. } elseif ( ! is_multisite() ) { 
  25.  
  26. // Restore previouserrorsuppression setting. 
  27. $wpdb->suppress_errors( $old_suppress );