bp_core_admin_get_active_components_from_submitted_settings( array $submitted,  $action = 'all' )

Calculates the components that should be active after save, based on submitted settings.

Description

The way that active components must be set after saving your settings must be calculated differently depending on which of the Components subtabs you are coming from:

  • When coming from All or Active, the submitted checkboxes accurately reflect the desired active components, so we simply pass them through
  • When coming from Inactive, components can only be activated – already active components will not be passed in the $_POST global. Thus, we must parse the newly activated components with the already active components saved in the $bp global

Parameters

$submitted

(array) (Required) This is the array of component settings coming from the POST global. You should stripslashes_deep() before passing to this function.

Return

(array) The calculated list of component settings

Source

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

function bp_core_admin_get_active_components_from_submitted_settings( $submitted, $action = 'all' ) {
	$current_action = $action;

	if ( isset( $_GET['action'] ) && in_array( $_GET['action'], array( 'active', 'inactive' ) ) ) {
		$current_action = $_GET['action'];
	}

	$current_components = buddypress()->active_components;

	switch ( $current_action ) {
		case 'inactive' :
			$components = array_merge( $submitted, $current_components );
			break;

		case 'all' :
		case 'active' :
		default :
			$components = $submitted;
			break;
	}

	return $components;
}

Changelog

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