Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
04/22/2022 05:42:45 AM (3 years ago)
Author:
imath
Message:

List the displayed user groups invites in member's front-end screen

As a site admin can view the displayed user groups invites, listed invites have to be the one of this user and not the ones of the site admin.

Adapt the Group Invites feature so that site admins can accept or reject on behalf of the displayed user the listed invites. These two actions made by an admin will generate a specific BP Email informing the user of it.

Props oztaser, dcavins, espellcaste

Closes https://github.com/buddypress/buddypress/pull/15
Fixes #8675

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-groups/screens/user/invites.php

    r12590 r13273  
    1414 */
    1515function groups_screen_group_invites() {
    16     $group_id = (int)bp_action_variable( 1 );
     16    $group_id = (int) bp_action_variable( 1 );
    1717
    1818    if ( bp_is_action_variable( 'accept' ) && is_numeric( $group_id ) ) {
     
    2222        }
    2323
    24         if ( !groups_accept_invite( bp_loggedin_user_id(), $group_id ) ) {
     24        if ( ! groups_accept_invite( bp_displayed_user_id(), $group_id ) ) {
    2525            bp_core_add_message( __('Group invite could not be accepted', 'buddypress'), 'error' );
    2626        } else {
     
    4242            $redirect_to = urldecode( $_GET['redirect_to'] );
    4343        } else {
    44             $redirect_to = trailingslashit( bp_loggedin_user_domain() . bp_get_groups_slug() . '/' . bp_current_action() );
     44            $redirect_to = trailingslashit( bp_displayed_user_domain() . bp_get_groups_slug() . '/' . bp_current_action() );
    4545        }
    4646
     
    5252            return false;
    5353
    54         if ( !groups_reject_invite( bp_loggedin_user_id(), $group_id ) ) {
     54        if ( ! groups_reject_invite( bp_displayed_user_id(), $group_id ) ) {
    5555            bp_core_add_message( __( 'Group invite could not be rejected', 'buddypress' ), 'error' );
    5656        } else {
     
    6161            $redirect_to = urldecode( $_GET['redirect_to'] );
    6262        } else {
    63             $redirect_to = trailingslashit( bp_loggedin_user_domain() . bp_get_groups_slug() . '/' . bp_current_action() );
     63            $redirect_to = trailingslashit( bp_displayed_user_domain() . bp_get_groups_slug() . '/' . bp_current_action() );
    6464        }
    6565
Note: See TracChangeset for help on using the changeset viewer.