Skip to:
Content

BuddyPress.org

Opened 4 months ago

Closed 4 months ago

#8362 closed defect (bug) (fixed)

View buttons can be incorrectly visible on Pages settings

Reported by: johnjamesjacoby Owned by: johnjamesjacoby
Milestone: 7.0.0 Priority: normal
Severity: minor Version: 2.0
Component: Settings Keywords: has-patch
Cc:

Description

On my local installation, in Settings > BuddyPress > Pages, I am seeing "View" buttons even though each component has "None" selected.

Screen shot imminent.

Attachments (2)

jjj-sc-2020-09-11 at 14.13.41@2x.png (105.0 KB) - added by johnjamesjacoby 4 months ago.
8362.1.patch (678 bytes) - added by johnjamesjacoby 4 months ago.

Download all attachments as: .zip

Change History (6)

#1 @johnjamesjacoby
4 months ago

This happens if the bp-pages option exists and has pages in it, but those pages are trashed and deleted after BuddyPress is deactivated. The pages are gone, but the option remains with those pages inside of it.

Patch imminent.

#2 @johnjamesjacoby
4 months ago

  • Keywords has-patch added
  • Milestone changed from Awaiting Review to 7.0.0

#3 @johnjamesjacoby
4 months ago

1.patch adds a get_post() check to the condition that decides whether to show the "View" button. This function call will usually come at no additional cost, because wp_dropdown_pages() will have already cached those IDs.

A more complex approach to avoiding cache misses would involve a change to bp_core_get_directory_page_ids() instead, to use get_blog_post() (or some BuddyPress abstraction) to remove missing pages from its results.

I kinda think both changes would be good ones, but I think it's OK to make sure the UI is correct first and determine if a deeper change can be done without breaking anything else later.

#4 @johnjamesjacoby
4 months ago

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

In 12718:

Settings: Do not show "View" links for missing pages.

This commit adds get_post() checks to an existing comparison to ensure that some UI elements are not incorrectly shown. This bug could arise if component pages are trashed & deleted after BuddyPress is deactivated, causing a mismatch between the bp-pages option and the pages that exist on the site.

Fixes #8362.

Note: See TracTickets for help on using tickets.