BP_Members_Admin::bp_update_registration_update_option()

Update site registrations options based on the WordPress settings on plugin activate.

Description

Parameters

$old_value

(Required)

$value

(Required)

Source

File: bp-members/classes/class-bp-members-admin.php

	function bp_update_registration_update_option() {

		if ( ! is_multisite() ) {
			$check_current_wp = (bool) bp_get_option('users_can_register', 0);
			$check_current_bp = (bool) bp_enable_site_registration();
			if ( true === $check_current_wp && false === $check_current_bp ) {
				bp_update_option( 'bp-enable-site-registration', 1 );
			} elseif ( false === $check_current_wp && true === $check_current_bp ) {
				update_option( 'users_can_register', 1 );
				bp_update_option( 'bp-enable-site-registration', 1 );
			}
		} else {
			$check_current_wp = get_site_option( 'registration', 'none' );
			$check_current_bp = (bool) bp_enable_site_registration();
			if ( ( 'all' === $check_current_wp || 'user' === $check_current_wp ) && false === $check_current_bp ) {
				bp_update_option( 'bp-enable-site-registration', 1 );
			} elseif ( ( 'all' !== $check_current_wp || 'user' !== $check_current_wp ) && true === $check_current_bp ) {
				update_site_option( 'registration', 'all' );
				bp_update_option( 'bp-enable-site-registration', 1 );
			}
		}

	}

Changelog

Changelog
Version Description
BuddyBoss 1.0.0 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.