#9245 closed defect (bug) (fixed)
[Site Health Info Tab] Resolve Multiple Issues with the BuddyPress Constants panel
Reported by: | emaralive | Owned by: | emaralive |
---|---|---|---|
Milestone: | 14.2.1 | Priority: | normal |
Severity: | normal | Version: | 14.1.0 |
Component: | Administration | Keywords: | has-screenshots has-patch commit |
Cc: |
Description
This ticket resolves multiple issues with Site Health Info tab - BuddyPress Constants panel:
- PHP errors
- A missing BuddyPress Constant
- Inadvertent mislabeling of 3 BuddyPress Constants
NOTE: Since the BuddyPress Constants panel for the Site Health Info tab was introduced with 14.0, I consider these issues to be a regression.
PHP errors
Support forum topic BuddyPress causing fatal error when upgrading to PHP 8.2 brought light to the issue of PHP errors were being generated as reported by @usercba.
The Constants BP_XPROFILE_BASE_GROUP_NAME
and BP_XPROFILE_FULLNAME_FIELD_NAME
are defined within the BP_XProfile_Component
class which is loaded when the Extended Profiles
component is activated (site.url/wp-admin/options-general.php?page=bp-components
). Thus, when the Extended Profiles
component is deactivated, the aforementioned Constants do not get defined therefore, depending on which PHP version is in use, a visit to the Site Health Info tab site.url/wp-admin/site-health.php?tab=debug
will generate PHP errors for PHP versions 7.4.33 and 8.x.x. The steps to reproduce are:
- Deactivate the
Extended Profiles
component, if it is activated. - Visit the Site Health Info tab
site.url/wp-admin/site-health.php?tab=debug
The results for PHP 7.4.33 are the following PHP errors:
Warning: Use of undefined constant BP_XPROFILE_FULLNAME_FIELD_NAME - assumed 'BP_XPROFILE_FULLNAME_FIELD_NAME' (this will throw an Error in a future version of PHP) in /wp-content/plugins/buddypress/src/bp-core/admin/bp-core-admin-tools.php on line 948 Warning: Use of undefined constant BP_XPROFILE_BASE_GROUP_NAME - assumed 'BP_XPROFILE_BASE_GROUP_NAME' (this will throw an Error in a future version of PHP) in /wp-content/plugins/buddypress/src/bp-core/admin/bp-core-admin-tools.php on line 944
The result for PHP 8.x.x, e.g., 8.0.30, is the following (also see screenshot - site-health-bp-constants-php8x.png):
Fatal error: Uncaught Error: Undefined constant "BP_XPROFILE_BASE_GROUP_NAME" in /var/www/html/git_wp/Plugins/buddypress/src/bp-core/admin/bp-core-admin-tools.php:944
The proposed patch corrects this issue by checking whether the aforementioned Constants are defined prior to providing an appropriate output.
A missing BuddyPress Constant
The BP_EMBED_DISABLE_ACTIVITY
Constant was inadvertently omitted from the initial listing of Constants. The proposed patch corrects this omission with the inclusion of the BP_EMBED_DISABLE_ACTIVITY
Constant.
Inadvertent mislabeling of 3 BuddyPress Constants
The following Constants were inadvertently labeled as deprecated:
BP_FORUMS_PARENT_FORUM_ID
BP_FORUMS_SLUG
BP_SEARCH_SLUG
The proposed patch corrects this mislabeling by removing the deprecated text from the aforementioned Constants and positions the remaining deprecated Constants as the last 12 in the panel (at this time, there are only 12 Constants that have been determined to be deprecated).
See the initial proposed patch for the totality of corrections.
site-health-bp-constants-php8x.png