[buddypress-trac] [BuddyPress Trac] #9237: [Site Health Info Tab] Some "Active components" are incorrect while viewing the BuddyPress panel
buddypress-trac
noreply at wordpress.org
Tue Sep 24 20:02:36 UTC 2024
#9237: [Site Health Info Tab] Some "Active components" are incorrect while viewing
the BuddyPress panel
-------------------------+-------------------------------------------------
Reporter: emaralive | Owner: emaralive
Type: defect | Status: assigned
(bug) |
Priority: normal | Milestone: 14.2.0
Component: | Version: 14.1.0
Administration | Keywords: has-screenshots has-patch dev-
Severity: normal | feedback
-------------------------+-------------------------------------------------
While attempting to document the Site Health Info tab (see
[https://github.com/buddypress/bp-documentation/issues/4 bp-documentation
issue #4]), I noticed that some of the listed **Active components** appear
to be incorrectly labeled, as seen below and indicated by the ❌ (also see
screenshot - **site-health-info-bp-panel-15.0.png**):.
**NOTE:** This can be seen while visiting **{{{site.url/wp-admin/site-
health.php?tab=debug}}}** (**Tools** > **Site Health** > **Info** tab) and
expanding the !BuddyPress panel, all available components (**10**) are
active as set by **{{{site.url/wp-admin/options-general.php?page=bp-
components}}}** (**Settings** > **!BuddyPress** > **Components** tab)
||= **Active Components (10)** =||= **Notes** =||
|| Extended Profiles || ||
|| Settings || ❌ ||
|| Friend Connections || ||
|| Private Messages || ||
|| Activity Streams || ||
|| Notifications || ||
|| User Groups || ||
|| Site Directory || ❌ ||
|| Members || ||
|| Members Invitations || ❌ ||
This anomaly appears to have been introduced in **14.0** because the
following represents **12.5.1** and previous (also see screenshot -
**site-health-info-bp-panel-12.5.1.png**):
**NOTE**: Although the labeling for **12.5.1** match up with the
Components setting page, there are only **9** components listed when there
should have been **10**, i.e., the **!BuddyPress Core** component appears
to be missing.
||= **Active Components (9)** =||
|| Community Members ||
|| Extended Profiles ||
|| Account Settings ||
|| Friend Connections ||
|| Private Messaging ||
|| Activity Streams ||
|| Notifications ||
|| User Groups ||
|| Site Tracking ||
Reality, at least to me, would dictate that there should be a total of
**10** possible **Active Components** (**8** are **optional** and **2**
are **required/Must-Use**), as follows (additionally, see screenshot -
**bp_settings_components_tab.png**):
||= **Optional (8)** =|| **+** ||= **Must-Use (2)** =|| **=** ||=
**All (10)** =||
|| Extended Profiles || || !BuddyPress Core || || Extended Profiles
||
|| Account Settings || || Community Members || || Account Settings
||
|| Friend Connections || || || || Friend
Connections ||
|| Private Messaging || || || || Private Messaging
||
|| Activity Streams || || || || Activity Streams
||
|| Notifications || || || || Notifications
||
|| User Groups || || || || User Groups
||
|| Site Tracking || || || || Site Tracking
||
|| || || || || !BuddyPress Core
||
|| || || || || Community Members
||
The code that created the anomaly for **14.0** appears to be found in the
file **{{{src/bp-core/admin/bp-core-admin-tools.php}}}** around
[https://github.com/buddypress/buddypress/blob/master/src/bp-core/admin
/bp-core-admin-tools.php#L777 line 777] and the following is an example of
this line:
{{{
$active_components = wp_list_pluck( bp_core_get_active_components(
array(), 'objects' ), 'name', 'id' );
}}}
This produces the following **10** element associative array, of which
some of the values are incorrect, as previously mentioned and described:
{{{
array(10) {
["xprofile"]=>
string(17) "Extended Profiles"
["settings"]=>
string(8) "Settings"
["friends"]=>
string(18) "Friend Connections"
["messages"]=>
string(16) "Private Messages"
["activity"]=>
string(16) "Activity Streams"
["notifications"]=>
string(13) "Notifications"
["groups"]=>
string(11) "User Groups"
["blogs"]=>
string(14) "Site Directory"
["members"]=>
string(7) "Members"
["members_invitations"]=>
string(19) "Members Invitations"
}
}}}
For **12.5.1** a somewhat equivalent statement is as follows:
{{{
$active_components = array_intersect_key( bp_core_get_components(),
buddypress()->active_components );
}}}
This produces a **9** element associative array that is processed further
downstream to produce an intermediate associative array as follows:
{{{
array(9) {
["members"]=>
string(17) "Community Members"
["xprofile"]=>
string(17) "Extended Profiles"
["settings"]=>
string(16) "Account Settings"
["friends"]=>
string(18) "Friend Connections"
["messages"]=>
string(17) "Private Messaging"
["activity"]=>
string(16) "Activity Streams"
["notifications"]=>
string(13) "Notifications"
["groups"]=>
string(11) "User Groups"
["blogs"]=>
string(13) "Site Tracking"
}
}}}
Although, the labeling matches what appears to be standard for pre
**14.0**, the downside is that there are only **9** components indicated
when there should be **10**. What's missing is the **!BuddyPress Core**
component, just to reiterate what has been previously mentioned and
described.
Since this ticket is only addressing a regression that was introduced in
**14.0** (**12.5.1** was only indicated/described to represent a
contrast/comparison), a solution to the anomaly is represented by the
submitted patch, albeit, there are a number of ways to provide a remedy.
That stated the patch looks like the following, i.e., replacing line 777
with:
{{{
$all_components = array_merge( buddypress()->optional_components,
buddypress()->required_components );
$active_components = array_flip( array_diff( $all_components,
buddypress()->deactivated_components ) );
$active_components = wp_list_pluck( array_intersect_key(
bp_core_get_components(), $active_components ), 'title' );
}}}
This produces the following array, when all components are "**active**"
(**enabled**):
{{{
array(10) {
["core"]=>
string(15) "BuddyPress Core"
["members"]=>
string(17) "Community Members"
["xprofile"]=>
string(17) "Extended Profiles"
["settings"]=>
string(16) "Account Settings"
["friends"]=>
string(18) "Friend Connections"
["messages"]=>
string(17) "Private Messaging"
["activity"]=>
string(16) "Activity Streams"
["notifications"]=>
string(13) "Notifications"
["groups"]=>
string(11) "User Groups"
["blogs"]=>
string(13) "Site Tracking"
}
}}}
The proposed patch produces the results (**10** active components) as can
be seen by screenshot - **site-health-info-bp-panel-patch.png** or any
combination of "**Active**" components as set by the **!BuddyPress
Settings Components** tab.
--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/9237>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac
More information about the buddypress-trac
mailing list