Skip to:
Content

BuddyPress.org

Opened 8 months ago

Closed 8 months ago

#9013 closed defect (bug) (fixed)

Invitations missing from BuddyPress Member logged in menu items [BP 12.0.0.beta3]

Reported by: emaralive's profile emaralive Owned by: dcavins's profile dcavins
Milestone: 12.0.0 Priority: normal
Severity: normal Version:
Component: Members Keywords: needs-patch commit
Cc:

Description

With any compatible WP branch (example screenshots are with WP 6.3.2), BP 12.0.0.beta3, any compatible PHP version (example screenshots are with PHP 7.4.33) and the following:

Active components:
Community Members, Extended Profiles, Account Settings, Friend Connections, Private Messaging, Activity Streams, Notifications, User Groups, Site Tracking

Active template pack:
BuddyPress Nouveau

Parent Theme:
Twenty Eleven (twentyeleven)

Scenario with BP Classic plugin activated and with BuddyPress Settings->options, the Invitations checkbox is checked/enabled:

[Back-end] The BuddyPress Member Invitation menu item (appearance->menu) is visible/present (see screenshot-win10-me-2023.10.24-11_34_16.png).
[Front-end] The BuddyPress Member Invitation menu item is visible/present (see screenshot-win10-me-2023.10.24-12_23_57.png).

Scenario with BP Classic plugin deactivated and with BuddyPress Settings->options, the Invitations checkbox is checked/enabled:

[Back-end] The BuddyPress Member Invitation menu item (appearance->menu) is missing/not present (see screenshot-win10-me-2023.10.24-12_35_45.png).
[Front-end] The BuddyPress Member Invitation menu item is missing/not present (see screenshot-win10-me-2023.10.24-12_46_29.png).

BTW, the same applies to the theme customizer (appearance->customize->menus->your_menu->add items); moving along, the function bp_nav_menu_get_loggedin_pages (found around line 2801 in bp-core/bp-core-functions.php) is where we find the call to bp_get_component_navigations (found around line 2815) which is used to retrieve the active components navigation data (main_nav) to help construct the menu items found in the BuddyPress Member metabox. Unfortunately, Invitations is not a component but is, apparently, a feature of the "members" component, thus, will not be not found via the call to bp_get_component_navigations. Given this strategy of active components navigation retrieval, it seems that Invitations should, possibly, be handled the same as the Log Out menu item of which the comments read (starting on line 2835):

// Some BP nav menu items will not be represented in bp_nav, because
// they are not real BP components. We add them manually here.

If this is the way that "not real BP components" are to be included as BP nav menu items then, OK, simple enough, except, I would add the following within the else statement after the foreach loop:

if ( bp_get_members_invitations_allowed() ) {
	$invitations_slug = bp_get_members_invitations_slug();
	$bp_menu_items[]  = array(
		'name' => __( 'Invitations', 'buddypress' ),
		'slug' => $invitations_slug,
		'link' => bp_loggedin_user_url( bp_members_get_path_chunks( array( $invitations_slug ) ) ),
	);
}

As to how this issue gets fixed is up to whomever is assigned, the example provided is just one way of providing such fix.

Attachments (5)

screenshot-win10-me-2023.10.24-11_34_16.png (121.4 KB) - added by emaralive 8 months ago.
screenshot-win10-me-2023.10.24-11_34_16.png
screenshot-win10-me-2023.10.24-12_23_57.png (79.2 KB) - added by emaralive 8 months ago.
screenshot-win10-me-2023.10.24-12_23_57.png
screenshot-win10-me-2023.10.24-12_35_45.png (112.9 KB) - added by emaralive 8 months ago.
screenshot-win10-me-2023.10.24-12_35_45.png
screenshot-win10-me-2023.10.24-12_46_29.png (81.2 KB) - added by emaralive 8 months ago.
screenshot-win10-me-2023.10.24-12_46_29.png
9013.01.patch (11.9 KB) - added by dcavins 8 months ago.
First pass at a slim component that just handles the nav items.

Download all attachments as: .zip

Change History (12)

@emaralive
8 months ago

screenshot-win10-me-2023.10.24-11_34_16.png

@emaralive
8 months ago

screenshot-win10-me-2023.10.24-12_23_57.png

@emaralive
8 months ago

screenshot-win10-me-2023.10.24-12_35_45.png

@emaralive
8 months ago

screenshot-win10-me-2023.10.24-12_46_29.png

#1 @imath
8 months ago

  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to 12.0.0

Thanks a lot for your report @emaralive 👍

I guess I forgot to take this specific case in charge. I will work on a fix asap.

#2 @imath
8 months ago

  • Keywords dev-feedback added

@dcavins I've been looking at it. It's not just about the Member's Dynamic menu. The invitations slugs are not included into the customizable slugs.

As the Invitations feature is using a Primary nav menu, an easy and logical fix would be to implement a BP_Member_Invitations_Component extending BP_Component() to deal with it.

What do you think?

#3 @dcavins
8 months ago

  • Owner set to dcavins
  • Status changed from new to assigned

Ha ha @imath When I was building that feature, several people thought it shouldn't be a full component, which I think is how I first approached it. I don't really remember, but I'll look back and see what the arguments against making it a component were. There's not really any discussion of that issue in #8139. Hmm.

Thanks, @emaralive, for starting this ticket!

#4 @imath
8 months ago

I probably was one of them! I'm not sure we need to make it a "full" component. I was thinking about adding a BP_Member_Invitations_Component into the bp-members/classes/ directory.

This ticket was mentioned in Slack in #buddypress by imath. View the logs.


8 months ago

@dcavins
8 months ago

First pass at a slim component that just handles the nav items.

#6 @imath
8 months ago

  • Keywords commit added; dev-feedback removed

Thanks a lot @dcavins Patch looks great!

I just tested it and it's working great.

  • I was able to add a dynamic Member's menu item (invitations) using the Customizer.
  • I was able to customize primary and secondary invitations slugs.

Great job 💪, feel free to commit it!

#7 @dcavins
8 months ago

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

In 13629:

Introduce BP_Members_Invitations_Component.

Introduce a slim BP_Members_Invitations_Component
to handle the addition and management of member and admin bar navigation items for the member invitations feature.

Fixes #9013.

Note: See TracTickets for help on using tickets.