bp_core_upgrade_signups

Update the signups table, adding `signup_id` column and drop `domain` index.

Description

bp_core_upgrade_signups(); 

This is necessary because WordPress's pre_schema_upgrade() function wraps table ALTER's in multisite checks, and other plugins may have installed their own sign-ups table; Eg: Gravity Forms User Registration Add On.


Usage

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

Defined (1)

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

/bp-core/admin/bp-core-admin-schema.php  
  1. function bp_core_upgrade_signups() { 
  2. global $wpdb; 
  3.  
  4. // Bail if global tables should not be upgraded. 
  5. if ( defined( 'DO_NOT_UPGRADE_GLOBAL_TABLES' ) ) { 
  6. return; 
  7.  
  8. // Never use bp_core_get_table_prefix() for any global users tables. 
  9. $wpdb->signups = $wpdb->base_prefix . 'signups'; 
  10.  
  11. // Attempt to alter the signups table. 
  12. $wpdb->query( "ALTER TABLE {$wpdb->signups} ADD signup_id BIGINT(20) NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST" ); 
  13. $wpdb->query( "ALTER TABLE {$wpdb->signups} DROP INDEX domain" );