Skip to:
Content

BuddyPress.org

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#8550 closed defect (bug) (fixed)

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

Reported by: niftythree's profile niftythree Owned by: dcavins's profile 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 3 years ago.
Introduce bp_get_groups_invitations_allowed().
8550.2.patch (16.4 KB) - added by imath 3 years ago.

Download all attachments as: .zip

Change History (17)

#1 @imath
3 years 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
3 years 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
3 years ago

  • Keywords reporter-feedback removed

#4 @imath
3 years 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 as well as the Group manage screen are 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?

Last edited 3 years ago by imath (previous) (diff)

#5 @niftythree
3 years 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 years ago

#7 @dcavins
3 years ago

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

#8 @dcavins
3 years 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
3 years ago

Introduce bp_get_groups_invitations_allowed().

#9 @imath
3 years ago

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

@imath
3 years ago

#10 @imath
3 years 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 3 years ago by imath (previous) (diff)

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


3 years ago

#12 @dcavins
3 years 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.


3 years ago

#14 follow-up: @ramirocastro
3 years ago

Quick one team, will this fix be included in the next Buddypress release? - as I saw this bug a while ago, I thought it was just me, until I googled this and found your thread.

Cheers
Rami

#15 in reply to: ↑ 14 @dcavins
3 years ago

Replying to ramirocastro:

Quick one team, will this fix be included in the next Buddypress release? - as I saw this bug a while ago, I thought it was just me, until I googled this and found your thread.

Cheers
Rami

Yep, it's in v10, which is available from a plugin repo near you as of today.

Note: See TracTickets for help on using tickets.