Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
12/17/2021 07:34:03 PM (5 years ago)
Author:
imath
Message:

Stop using the && operator inside the Group invites JS templates

The BP Nouveau template pack's Invite UI is failing to render the fetched members when the active theme is supporting the WordPress Full Site editing. The reason is the underscore JS library weirdly doesn't recognize the && operator. To avoid this issue, we've edited the Nouveau Ajax actions/ Group Invites JS templates to set new properties making this operator useless.

This commit also improves the user feedback when invites are restricted to mods or admin (or both) and the current user is a regular group member.

See #8474

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-templates/bp-nouveau/includes/groups/ajax.php

    r13115 r13192  
    284284        }
    285285
     286        if ( ! bp_is_group_create() && ! bp_groups_user_can_send_invites( bp_get_current_group_id(), bp_loggedin_user_id() ) ) {
     287                $invite_status = bp_group_get_invite_status( bp_get_current_group_id() );
     288                if ( 'admins' === $invite_status ) {
     289                        $message = __( 'Inviting members to join this group is restricted to Group Administrators.', 'buddypress' );
     290                } else {
     291                        $message = __( 'Inviting members to join this group is restricted to Group Moderators and Administrators.', 'buddypress' );
     292                }
     293
     294                wp_send_json_error(
     295                        array(
     296                                'feedback' => $message,
     297                                'type'     => 'error',
     298                        )
     299                );
     300        }
     301
    286302        $request = bp_parse_args(
    287303                $_POST,
Note: See TracChangeset for help on using the changeset viewer.