bp_core_upgrade_signups()

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

Description

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.

See also

Source

File: bp-core/admin/bp-core-admin-schema.php

function bp_core_upgrade_signups() {
	global $wpdb;

	// Bail if global tables should not be upgraded.
	if ( defined( 'DO_NOT_UPGRADE_GLOBAL_TABLES' ) ) {
		return;
	}

	// Never use bp_core_get_table_prefix() for any global users tables.
	$wpdb->signups = $wpdb->base_prefix . 'signups';

	// Attempt to alter the signups table.
	$wpdb->query( "ALTER TABLE {$wpdb->signups} ADD signup_id BIGINT(20) NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST" );
	$wpdb->query( "ALTER TABLE {$wpdb->signups} DROP INDEX domain" );
}

Changelog

Changelog
Version Description
BuddyPress 2.0.1 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.