Skip to:
Content

BuddyPress.org

Opened 6 weeks ago

Closed 5 weeks ago

Last modified 5 weeks ago

#9158 closed defect (bug) (fixed)

Group members not notified that they have been promoted in Nouveau

Reported by: needle's profile needle Owned by: imath's profile imath
Milestone: 14.0.0 Priority: normal
Severity: normal Version:
Component: Groups Keywords: has-patch has-unit-tests
Cc:

Description

When using BP Nouveau:

  • Navigate to "Some Group" -> "Manage" -> "Members"
  • Promote a member from "Member" to "Administrator"
  • No email notification is sent

The groups_notification_promoted_member() function is hooked to groups_promoted_member but none of this family of actions (e.g. groups_demoted_member, groups_banned_member etc) fires because Nouveau routes via the BP REST API instead of groups_screen_group_admin_manage_members().

BP Classic still fires these actions and works as expected.

Not firing these actions also affects plugins that perform tasks based on the status of group members.

Change History (11)

#1 @needle
6 weeks ago

Additionally, Nouveau allows me to demote all group admins so that there are none left. BP Classic does not allow this. I don't think Nouveau should either.

#2 @imath
6 weeks ago

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

Hi @needle

Thanks a lot for your report. I agree with your diagnostic. I will work on it shortly.

#3 @needle
6 weeks ago

@imath Thanks for looking into this. I would have added a patch, but I wasn't sure about the preferred approach - i.e. whether the groups_*_member actions should be added to the REST API or whether they should be deprecated.

This ticket was mentioned in PR #293 on buddypress/buddypress by imath.


5 weeks ago
#4

  • Keywords has-patch has-unit-tests added; needs-patch removed

Hi @needle

Just checked, I believe we actually need to update BuddyPress and the BP REST API.

  • BuddyPress: it shouldn't use the current hooks as there can be situations where the hook is fired although the requested action failed.
  • BuddyPress groups_$action_member() function should be usable outside of the Web version using the BP REST API for instance. It's not currently the case and I suspect it to be the reason why we were directly using BP_Groups_Member->$action()
  • The BP REST API should absolutely use groups_$action_member() functions to be sure cache is cleared or group activities are deleted when it's needed. It's currently not the case. I'll soon submit a PR to the BP REST API GH repo.

Trac ticket: https://buddypress.trac.wordpress.org/ticket/9158

#5 @imath
5 weeks ago

FYI here's the BP REST API PR that should bring the notifications back to Nouveau:
https://github.com/buddypress/BP-REST/pull/507

#6 @needle
5 weeks ago

Looks great - thanks for the speedy fix @imath

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


5 weeks ago

#9 @imath
5 weeks ago

@needle FYI

Additionally, Nouveau allows me to demote all group admins so that there are none left. BP Classic does not allow this. I don't think Nouveau should either.

We'll deal about this issue from #9163, I'll focus on your ticket description here.

#10 @imath
5 weeks ago

  • Owner set to imath
  • Resolution set to fixed
  • Status changed from new to closed

In 13873:

Groups: improve group membership management functions

  • Make the functions handling the 5 available group membership actions (promote, demote, ban, unban, remove) usable outside of the BuddyPress Web version. Doing so, the BP REST API will be able to use them so that current hooks used to perform custom code/clear group cache are still fired within this specific context.
  • In BP Nouveau, the group members management interface (which is using the BP REST API) will soon benefit from this work once the BP REST API has been updated. The hook used to notify a group member has been promoted will then be fired and BP Nouveau behavior will be consistent with the BP Legacy one about group membership management.
  • Deprecate some misleading hooks, which were firing even if the group membership action had failed, in favor of new ones which do fire at the right "place".

Props needle

Fixes #9158

Note: See TracTickets for help on using tickets.