bp_update_to_5_0()

5.0.0 update routine.


Description Description

  • Make sure the custom visibility is disabled for the default profile field.
  • Create the invitations table.
  • Migrate requests and invitations to the new table.

Source Source

File: bp-core/bp-core-update.php

function bp_update_to_5_0() {
	/**
	 * The xProfile component is active by default on new installs, even if it
	 * might be inactive during this update, we need to set the custom visibility
	 * for the default field, in case the Administrator decides to reactivate it.
	 */
	global $wpdb;
	$bp_prefix = bp_core_get_table_prefix();
	$field_id  = $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$bp_prefix}bp_xprofile_fields WHERE name = %s", addslashes( bp_get_option( 'bp-xprofile-fullname-field-name' ) ) ) );

	$wpdb->insert(
		$bp_prefix . 'bp_xprofile_meta',
		array(
			'object_id'   => $field_id,
			'object_type' => 'field',
			'meta_key'    => 'allow_custom_visibility',
			'meta_value'  => 'disabled'
		),
		array(
			'%d',
			'%s',
			'%s',
			'%s'
		)
	);

	bp_core_install_invitations();

	if ( bp_is_active( 'groups' ) ) {
		bp_groups_migrate_invitations();
	}
}

Top ↑

Changelog Changelog

Changelog
Version Description
5.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.