Skip to:
Content

BuddyPress.org

Opened 4 weeks ago

Closed 3 weeks ago

Last modified 3 weeks ago

#9245 closed defect (bug) (fixed)

[Site Health Info Tab] Resolve Multiple Issues with the BuddyPress Constants panel

Reported by: emaralive's profile emaralive Owned by: emaralive's profile 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.

Attachments (2)

site-health-bp-constants-php8x.png (91.0 KB) - added by emaralive 4 weeks ago.
site-health-bp-constants-php8x.png
9245.01.patch (6.0 KB) - added by emaralive 4 weeks ago.
Initial patch

Download all attachments as: .zip

Change History (6)

@emaralive
4 weeks ago

site-health-bp-constants-php8x.png

@emaralive
4 weeks ago

Initial patch

#1 @imath
4 weeks ago

  • Keywords commit added; dev-feedback removed

Hi @emaralive

Thanks a lot for your work on it. Patch looks good 💪. I'll commit it shortly.

#2 @imath
3 weeks ago

In 14049:

Resolve Multiple Issues with the BuddyPress Constants panel

  • Make sure the BP_XPROFILE_BASE_GROUP_NAME & BP_XPROFILE_FULLNAME_FIELD_NAME are defined before using them
  • Use the right option name to set the BP_XPROFILE_BASE_GROUP_NAME
  • Include BP_EMBED_DISABLE_ACTIVITY into the BuddyPress Constants panel
  • Remove the deprecated mention from BP_FORUMS_PARENT_FORUM_ID, BP_FORUMS_SLUG & BP_SEARCH_SLUG constants.

Props emaralive

See #9245 (trunk)

#3 @imath
3 weeks ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 14050:

Resolve Multiple Issues with the BuddyPress Constants panel

  • Make sure the BP_XPROFILE_BASE_GROUP_NAME & BP_XPROFILE_FULLNAME_FIELD_NAME are defined before using them
  • Use the right option name to set the BP_XPROFILE_BASE_GROUP_NAME
  • Include BP_EMBED_DISABLE_ACTIVITY into the BuddyPress Constants panel
  • Remove the deprecated mention from BP_FORUMS_PARENT_FORUM_ID, BP_FORUMS_SLUG & BP_SEARCH_SLUG constants.

Props emaralive

Fixes #9245 (branch 14.0)

#4 @imath
3 weeks ago

  • Milestone changed from 14.2.0 to 14.2.1

Milestone renamed

Note: See TracTickets for help on using tickets.