Ticket #5367: 5367.required.diff
File 5367.required.diff, 4.2 KB (added by , 11 years ago) |
---|
-
bp-members/bp-members-admin.php
122 122 $this->signups_page = ''; 123 123 $this->users_url = bp_get_admin_url( 'users.php' ); 124 124 $this->users_screen = bp_core_do_network_admin() ? 'users-network' : 'users'; 125 126 // Specific config: BuddyPress is not network activated 127 $this->subsite_activated = (bool) is_multisite() && ! bp_is_network_activated() && bp_is_root_blog(); 125 128 } 126 129 127 130 /** … … 298 301 } ?> 299 302 300 303 <ul id="profile-nav" class="nav-tab-wrapper"> 301 <li class="nav-tab<?php echo esc_attr( $wp_active ); ?>"><a href="<?php echo esc_url( $wordpress_url );?>"><?php _e( 'WordPress Profile', 'buddypress' ); ?></a></li> 304 <?php 305 /** 306 * In configs where BuddyPress is not network activated, as regular 307 * admins do not have the capacity to edit other users, we must add 308 * this check. 309 */ 310 ?> 311 <?php if ( current_user_can( 'edit_user' ) ) :?> 312 <li class="nav-tab<?php echo esc_attr( $wp_active ); ?>"><a href="<?php echo esc_url( $wordpress_url );?>"><?php _e( 'WordPress Profile', 'buddypress' ); ?></a></li> 313 <?php endif ;?> 302 314 <li class="nav-tab<?php echo esc_attr( $bp_active ); ?>"><a href="<?php echo esc_url( $community_url );?>"><?php _e( 'Community Profile', 'buddypress' ); ?></a></li> 303 315 304 316 <?php do_action( 'bp_members_admin_profile_nav', $active, $user ); ?> … … 609 621 </div><!-- #minor-publishing-actions --> 610 622 611 623 <div id="misc-publishing-actions"> 612 <div class="misc-pub-section" id="comment-status-radio"> 613 <label class="approved"><input type="radio" name="user_status" value="ham" <?php checked( bp_is_user_spammer( $user->ID ), false ); ?>><?php esc_html_e( 'Active', 'buddypress' ); ?></label><br /> 614 <label class="spam"><input type="radio" name="user_status" value="spam" <?php checked( bp_is_user_spammer( $user->ID ), true ); ?>><?php esc_html_e( 'Spammer', 'buddypress' ); ?></label> 615 </div> 624 <?php 625 /** 626 * In configs where BuddyPress is not network activated, regular admins 627 * cannot mark a user as a spammer on front end. 628 */ 629 ?> 630 <?php if ( empty( $this->subsite_activated ) || ( ! empty( $this->subsite_activated ) && current_user_can( 'manage_network_users' ) ) ) : ?> 631 <div class="misc-pub-section" id="comment-status-radio"> 632 <label class="approved"><input type="radio" name="user_status" value="ham" <?php checked( bp_is_user_spammer( $user->ID ), false ); ?>><?php esc_html_e( 'Active', 'buddypress' ); ?></label><br /> 633 <label class="spam"><input type="radio" name="user_status" value="spam" <?php checked( bp_is_user_spammer( $user->ID ), true ); ?>><?php esc_html_e( 'Spammer', 'buddypress' ); ?></label> 634 </div> 635 <?php endif ;?> 616 636 617 637 <div class="misc-pub-section curtime misc-pub-section-last"> 618 638 <?php … … 709 729 return $actions; 710 730 } 711 731 732 // Prevent a regular admin to edit a super admin 733 if( in_array( $user->user_login, get_super_admins() ) ) { 734 return $actions; 735 } 736 712 737 $edit_profile = add_query_arg( array( 713 738 'user_id' => $user->ID, 714 739 'wp_http_referer' => urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), 715 740 ), $this->edit_profile_url ); 716 741 717 $edit_action = $actions['edit']; 718 unset( $actions['edit'] ); 742 $edit_profile_link = '<a href="' . esc_url( $edit_profile ) . '">' . esc_html__( 'Profile', 'buddypress' ) . '</a>'; 719 743 720 $new_edit_actions = array( 721 'edit' => $edit_action, 722 'edit-profile' => '<a href="' . esc_url( $edit_profile ) . '">' . esc_html__( 'Profile', 'buddypress' ) . '</a>' 723 ); 744 /** 745 * If BuddyPress is not network activated the regular admin 746 * cannot edit users. We need to first check the edit action 747 * is available 748 */ 749 if ( ! empty( $actions['edit'] ) ) { 750 $edit_action = $actions['edit']; 751 unset( $actions['edit'] ); 752 753 $new_edit_actions = array( 754 'edit' => $edit_action, 755 'edit-profile' => $edit_profile_link, 756 ); 757 } else { 758 $new_edit_actions = array( 'edit-profile' => $edit_profile_link ); 759 } 724 760 725 761 return array_merge( $new_edit_actions, $actions ); 726 762 }