Skip to:
Content

BuddyPress.org

Opened 4 months ago

Closed 2 weeks ago

Last modified 2 weeks ago

#8550 closed defect (bug) (fixed)

"Invitations" tab visible to users when they're not able to send invitations.

Reported by: niftythree Owned by: dcavins
Milestone: 10.0.0 Priority: normal
Severity: normal Version: 1.0
Component: Groups Keywords: has-patch
Cc:

Description

Hello,

We’ve noticed a bit of a quirk in BuddyPress. When the “Friend Connections” component is turned off, but the “User Groups” component is still turned on, users will still see the “Invitations” tab under groups in their own profiles, even though no user can send them an invitation to a group.

We’ve done some testing and can’t work out an obvious reason why this tab would still be visible/available to users when it’s not possible to send invitations to other users.

We're running BuddyPress version 9, and occurs when all other plugins are deactivated and a default theme is used.

Thanks.

Attachments (2)

8550.1.patch (12.1 KB) - added by dcavins 2 weeks ago.
Introduce bp_get_groups_invitations_allowed().
8550.2.patch (16.4 KB) - added by imath 2 weeks ago.

Download all attachments as: .zip

Change History (15)

#1 @imath
4 months ago

  • Keywords reporter-feedback added

Hi,

if you're using the BP Nouveau template pack, it's a feature 😉. This template pack comes with a Group Invites UI allowing users to invite any other to join their group. If you want to disable it you can use:

add_filter( 'bp_nouveau_groups_disallow_all_members_invites', '__return_true' );

https://cldup.com/3wsn9GB40d.png

Are you using the BP Nouveau template pack (see Settings > BuddyPress > Options)?

#2 @niftythree
4 months ago

Hi @imath,

Thanks for getting back to us so quickly! :)

We're using the BP Legacy template pack; regardless, we thought we'd try the code anyway, but the "Invitations" tab was still visible.

Thanks.

#3 @niftythree
4 months ago

  • Keywords reporter-feedback removed

#4 @imath
3 months ago

  • Keywords 2nd-opinion added
  • Milestone changed from Awaiting Review to 10.0.0
  • Version changed from 9.0.0 to 1.0

Thanks for your feedback @niftythree I now fully understand the issue. I agree we should improve this part of the Groups invite feature.

Historically Groups invite required the Friends component to be active. BP Nouveau added an exception to this allowing members to invite any others.

If we use BP Legacy having the friends component inactive:

  • The single Group invite nav is not showing ✅
  • The Group settings create screen is showing a setting to let the Group creator choose which Group roles can invite people ❌
  • The single Member's Pending invites nav is showing (what you reported) ❌

If we use BP Nouveau it's not possible to disable the Groups Invite feature even if we do add_filter( 'bp_nouveau_groups_disallow_all_members_invites', '__return_true' );
Using this filter is only making an effect when the friends component is active.

We should fix red crosses 🤔. @dcavins I'd like to have your opinion about it. What do you think?

Version 0, edited 3 months ago by imath (next)

#5 @niftythree
3 months ago

Hi @imath

Thanks for the update and all of the information; that really helps us to understand the context. 😊

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


3 months ago

#7 @dcavins
3 months ago

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

#8 @dcavins
2 weeks ago

I'm attaching a patch that adds a new function bp_get_groups_invitations_allowed(). This centralizes the check if group invitations are enabled generally or not, rather than tying it directly to whether the friends component is enabled. This offers the advantage that a dev could choose to disable invitations even if they want to have friendships enabled. (Or disable them entirely if using Nouveau.)

@imath please make sure I've got the check right for Nouveau. Thanks!

@dcavins
2 weeks ago

Introduce bp_get_groups_invitations_allowed().

#9 @imath
2 weeks ago

Sure thanks for working on it @dcavins I'm looking at it asap.

@imath
2 weeks ago

#10 @imath
2 weeks ago

  • Keywords has-patch added; 2nd-opinion removed

@dcavins great idea about using a component feature for Group invitations 👍.

I think we don't need to introduce bp_get_groups_invitations_allowed() and we shouldn't use bp_nouveau_.. functions into Core files.

The invitations feature should only be added if the friends component is active. The Nouveau template pack can filter bp_is_groups_invitations_active to activate the Invitations feature if inviting any member is allowed (meaning bp_nouveau_groups_disallow_all_members_invites is not filtered to true).

I've tested in legacy & nouveau and it works pretty well. I even tested using add_filter( 'bp_is_groups_invitations_active', '__return_true' ) with Legacy and found a fatal into the send-invites template before fixing it.

If you're ok with my suggestions, feel free to commit and fix the ticket ;)

Last edited 2 weeks ago by imath (previous) (diff)

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


2 weeks ago

#12 @dcavins
2 weeks ago

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

In 13156:

Declare invitations as feature of groups component.

Centralize the logic which determines whether
group invitations are active by declaring
invitations as a feature of the groups
component. This also makes it easy for
developers to filter that value using the
bp_is_groups_invitations_active filter hook.

Props imath.

Fixes #8550.

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


2 weeks ago

Note: See TracTickets for help on using tickets.