Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
05/25/2024 04:47:42 AM (23 months ago)
Author:
imath
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-groups/screens/single/admin/manage-members.php

    r13762 r13873  
    4949
    5050            /**
    51              * Fires before the redirect after a group member has been promoted.
    52              *
    53              * @since 1.0.0
     51             * Fires before the redirect.
     52             *
     53             * @since 1.0.0
     54             * @deprecated 14.0.0
    5455             *
    5556             * @param int $user_id ID of the user being promoted.
    56              * @param int $id      ID of the group user is promoted within.
    57              */
    58             do_action( 'groups_promoted_member', $user_id, $bp->groups->current_group->id );
     57             * @param int $id      ID of the group is promoted within.
     58             */
     59            do_action_deprecated( 'groups_promoted_member', array( $user_id, $bp->groups->current_group->id ), '14.0.0', 'group_member_promoted' );
    5960
    6061            bp_core_redirect( $redirect );
     
    8788             *
    8889             * @since 1.0.0
     90             * @deprecated 14.0.0
    8991             *
    9092             * @param int $user_id ID of the user being demoted.
    91              * @param int $id      ID of the group user is demoted within.
    92              */
    93             do_action( 'groups_demoted_member', $user_id, $bp->groups->current_group->id );
     93             * @param int $id      ID of the group is demoted within.
     94             */
     95            do_action_deprecated( 'groups_demoted_member', array( $user_id, $bp->groups->current_group->id ), '14.0.0', 'group_member_demoted' );
    9496
    9597            bp_core_redirect( $redirect );
     
    115117             *
    116118             * @since 1.0.0
     119             * @deprecated 14.0.0
    117120             *
    118121             * @param int $user_id ID of the user being banned.
    119122             * @param int $id      ID of the group user is banned from.
    120123             */
    121             do_action( 'groups_banned_member', $user_id, $bp->groups->current_group->id );
     124            do_action_deprecated( 'groups_banned_member', array( $user_id, $bp->groups->current_group->id ), '14.0.0', 'group_member_banned' );
    122125
    123126            bp_core_redirect( $redirect );
     
    143146             *
    144147             * @since 1.0.0
     148             * @deprecated 14.0.0
    145149             *
    146150             * @param int $user_id ID of the user being unbanned.
    147151             * @param int $id      ID of the group user is unbanned from.
    148152             */
    149             do_action( 'groups_unbanned_member', $user_id, $bp->groups->current_group->id );
     153            do_action_deprecated( 'groups_unbanned_member', array( $user_id, $bp->groups->current_group->id ), '14.0.0', 'group_member_unbanned' );
    150154
    151155            bp_core_redirect( $redirect );
     
    171175             *
    172176             * @since 1.2.6
     177             * @deprecated 14.0.0
    173178             *
    174179             * @param int $user_id ID of the user being removed.
    175180             * @param int $id      ID of the group the user is removed from.
    176181             */
    177             do_action( 'groups_removed_member', $user_id, $bp->groups->current_group->id );
     182            do_action_deprecated( 'groups_removed_member', array( $user_id, $bp->groups->current_group->id ), '14.0.0', 'group_member_removed' );
    178183
    179184            bp_core_redirect( $redirect );
Note: See TracChangeset for help on using the changeset viewer.