Changeset 13192
- Timestamp:
- 12/17/2021 07:34:03 PM (3 years ago)
- Location:
- trunk/src/bp-templates/bp-nouveau
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-templates/bp-nouveau/buddypress/common/js-templates/invites/index.php
r12513 r13192 7 7 * 8 8 * @since 3.0.0 9 * @version 6.0.09 * @version 10.0.0 10 10 */ 11 11 ?> … … 58 58 </div> 59 59 60 <# if ( undefined !== data.is_sent) { #>60 <# if ( 'invited' === data.scope ) { #> 61 61 <div class="item-meta"> 62 62 63 <# if ( undefined !== data.invited_by) { #>63 <# if ( data.invited_by.length > 0 ) { #> 64 64 <ul class="group-inviters"> 65 65 <li><?php esc_html_e( 'Invited by:', 'buddypress' ); ?></li> … … 83 83 84 84 <div class="action"> 85 <# if ( undefined === data.is_sent || ( false === data.is_sent && true === data.can_edit )) { #>85 <# if ( true === data.can_invite ) { #> 86 86 <button type="button" class="button invite-button group-add-remove-invite-button bp-tooltip bp-icons<# if ( data.selected ) { #> selected<# } #>" data-bp-tooltip="<# if ( data.selected ) { #><?php esc_attr_e( 'Cancel invitation', 'buddypress' ); ?><# } else { #><?php echo esc_attr_x( 'Invite', 'button', 'buddypress' ); ?><# } #>"> 87 87 <span class="icons" aria-hidden="true"></span> … … 96 96 <# } #> 97 97 98 <# if ( undefined !== data.can_edit &&true === data.can_edit ) { #>98 <# if ( true === data.can_edit ) { #> 99 99 <button type="button" class="button invite-button group-remove-invite-button bp-tooltip bp-icons" data-bp-tooltip="<?php echo esc_attr_x( 'Cancel invitation', 'button', 'buddypress' ); ?>"> 100 100 <span class=" icons" aria-hidden="true"></span> -
trunk/src/bp-templates/bp-nouveau/includes/groups/ajax.php
r13115 r13192 284 284 } 285 285 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 286 302 $request = bp_parse_args( 287 303 $_POST, -
trunk/src/bp-templates/bp-nouveau/includes/groups/functions.php
r13191 r13192 200 200 */ 201 201 function bp_nouveau_prepare_group_potential_invites_for_js( $user ) { 202 $bp = buddypress(); 202 $bp = buddypress(); 203 $scope = ''; 204 if ( isset( $bp->groups->invites_scope ) ) { 205 $scope = $bp->groups->invites_scope; 206 } 203 207 204 208 $response = array( 205 'id' => intval( $user->ID ), 206 'name' => $user->display_name, 207 'avatar' => htmlspecialchars_decode( bp_core_fetch_avatar( array( 208 'item_id' => $user->ID, 209 'object' => 'user', 210 'type' => 'thumb', 211 'width' => 50, 212 'height' => 50, 213 'html' => false ) 214 ) ), 215 ); 216 217 // Do extra queries only if needed 218 if ( ! empty( $bp->groups->invites_scope ) && 'invited' === $bp->groups->invites_scope ) { 219 $response['is_sent'] = (bool) groups_check_user_has_invite( $user->ID, bp_get_current_group_id() ); 220 221 $inviter_ids = bp_nouveau_groups_get_inviter_ids( $user->ID, bp_get_current_group_id() ); 222 223 foreach ( $inviter_ids as $inviter_id ) { 224 $class = false; 225 226 if ( bp_loggedin_user_id() === (int) $inviter_id ) { 227 $class = 'group-self-inviter'; 228 } 229 230 $response['invited_by'][] = array( 231 'avatar' => htmlspecialchars_decode( bp_core_fetch_avatar( array( 232 'item_id' => $inviter_id, 209 'id' => intval( $user->ID ), 210 'name' => $user->display_name, 211 'avatar' => htmlspecialchars_decode( 212 bp_core_fetch_avatar( 213 array( 214 'item_id' => $user->ID, 233 215 'object' => 'user', 234 216 'type' => 'thumb', 235 217 'width' => 50, 236 218 'height' => 50, 237 'html' => false, 238 'class' => $class, 239 ) ) ), 219 'html' => false 220 ) 221 ) 222 ), 223 'scope' => $scope, 224 'is_sent' => false, 225 'invited_by' => array(), 226 'can_invite' => 'invited' !== $scope, 227 ); 228 229 // Do extra queries only if needed 230 if ( 'invited' === $scope ) { 231 $response['is_sent'] = (bool) groups_check_user_has_invite( $user->ID, bp_get_current_group_id() ); 232 $inviter_ids = bp_nouveau_groups_get_inviter_ids( $user->ID, bp_get_current_group_id() ); 233 234 foreach ( $inviter_ids as $inviter_id ) { 235 $class = false; 236 237 if ( bp_loggedin_user_id() === (int) $inviter_id ) { 238 $class = 'group-self-inviter'; 239 } 240 241 $response['invited_by'][] = array( 242 'avatar' => htmlspecialchars_decode( 243 bp_core_fetch_avatar( 244 array( 245 'item_id' => $inviter_id, 246 'object' => 'user', 247 'type' => 'thumb', 248 'width' => 50, 249 'height' => 50, 250 'html' => false, 251 'class' => $class, 252 ) 253 ) 254 ), 240 255 'user_link' => bp_core_get_userlink( $inviter_id, false, true ), 241 256 'user_name' => bp_core_get_username( $inviter_id ), … … 243 258 } 244 259 245 if ( bp_is_item_admin() ) { 246 $response['can_edit'] = true; 247 } else { 248 $response['can_edit'] = in_array( bp_loggedin_user_id(), $inviter_ids, true ); 249 } 260 $response['can_edit'] = bp_is_item_admin() || in_array( bp_loggedin_user_id(), $inviter_ids, true ); 250 261 } 251 262
Note: See TracChangeset
for help on using the changeset viewer.