Skip to:
Content

BuddyPress.org

Changeset 8432


Ignore:
Timestamp:
05/20/2014 03:33:49 PM (10 years ago)
Author:
johnjamesjacoby
Message:

Member Admin:

  • Allow admins to edit other admins.
  • Allow admins to edit their own profiles.
  • Replace our custom tabbed UL/LI interface with WordPress core H2 navigation (and update admin.css accordingly.)

See #5623.

Location:
trunk/src/bp-members
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-members/admin/css/admin-rtl.css

    r8386 r8432  
    66
    77div#profile-page.wrap form#your-profile h3:first-of-type {
    8     margin-top:6em;
     8    margin-top:5em;
    99}
    1010
    11 div#profile-page.wrap form#your-profile ul#profile-nav {
    12     position:absolute;
    13     top:-6em;
    14     border-bottom:solid 1px #ccc;
    15     width:100%;
     11div#profile-page.wrap form#your-profile #profile-nav {
     12    position: absolute;
     13    top: -3.65em;
     14    width: 97%;
    1615}
    1716
    18 div#community-profile-page ul#profile-nav {
    19     border-bottom:solid 1px #ccc;
    20     width:100%;
    21     margin-top:1em;
    22     margin-bottom:1em;
    23     padding:1em 0;
    24     padding-bottom: 0;
    25     height:2.4em;
     17div#community-profile-page #profile-nav {
     18    margin-bottom: 1em;
    2619}
    2720
    28 form#your-profile ul#profile-nav li,
    29 div#community-profile-page ul#profile-nav li {
    30     margin-right:0.4em;
    31     float:right;
    32     font-weight: bold;
    33     font-size: 15px;
    34     line-height: 24px;
     21#bp_members_admin_user_stats ul {
     22    margin-bottom: 0;
    3523}
    36 
    37 form#your-profile ul#profile-nav li a,
    38 div#community-profile-page ul#profile-nav li a {
    39     text-decoration: none;
    40     color:#888;
    41 }
    42 
    43 form#your-profile ul#profile-nav li a:hover,
    44 form#your-profile ul#profile-nav li.nav-tab-active a,
    45 div#community-profile-page ul#profile-nav li a:hover,
    46 div#community-profile-page ul#profile-nav li.nav-tab-active a {
    47     text-decoration: none;
    48     color:#000;
    49 }
    50 
    5124div#community-profile-page li.bp-members-profile-stats:before,
    5225div#community-profile-page li.bp-friends-profile-stats:before,
     
    5427div#community-profile-page li.bp-blogs-profile-stats:before,
    5528div#community-profile-page a.bp-xprofile-avatar-user-admin:before {
    56     font-family: 'dashicons';
    57     font-size: 18px;
    58     vertical-align: bottom;
    59     margin-left:5px;
     29    font: normal 20px/1 'dashicons';
     30    speak: none;
     31    display: inline-block;
     32    padding: 0 0 0 2px;
     33    top: 0;
     34    right: -1px;
     35    position: relative;
     36    vertical-align: top;
     37    -webkit-font-smoothing: antialiased;
     38    -moz-osx-font-smoothing: grayscale;
     39    text-decoration: none !important;
     40    color: #888;
    6041}
    6142
  • trunk/src/bp-members/admin/css/admin.css

    r8246 r8432  
    66
    77div#profile-page.wrap form#your-profile h3:first-of-type {
    8     margin-top:6em;
     8    margin-top:5em;
    99}
    1010
    11 div#profile-page.wrap form#your-profile ul#profile-nav {
    12     position:absolute;
    13     top:-6em;
    14     border-bottom:solid 1px #ccc;
    15     width:100%;
     11div#profile-page.wrap form#your-profile #profile-nav {
     12    position: absolute;
     13    top: -3.65em;
     14    width: 97%;
    1615}
    1716
    18 div#community-profile-page ul#profile-nav {
    19     border-bottom:solid 1px #ccc;
    20     width:100%;
    21     margin-top:1em;
    22     margin-bottom:1em;
    23     padding:1em 0;
    24     padding-bottom: 0;
    25     height:2.4em;
     17div#community-profile-page #profile-nav {
     18    margin-bottom: 1em;
    2619}
    2720
    28 form#your-profile ul#profile-nav li,
    29 div#community-profile-page ul#profile-nav li {
    30     margin-left:0.4em;
    31     float:left;
    32     font-weight: bold;
    33     font-size: 15px;
    34     line-height: 24px;
     21#bp_members_admin_user_stats ul {
     22    margin-bottom: 0;
    3523}
    36 
    37 form#your-profile ul#profile-nav li a,
    38 div#community-profile-page ul#profile-nav li a {
    39     text-decoration: none;
    40     color:#888;
    41 }
    42 
    43 form#your-profile ul#profile-nav li a:hover,
    44 form#your-profile ul#profile-nav li.nav-tab-active a,
    45 div#community-profile-page ul#profile-nav li a:hover,
    46 div#community-profile-page ul#profile-nav li.nav-tab-active a {
    47     text-decoration: none;
    48     color:#000;
    49 }
    50 
    5124div#community-profile-page li.bp-members-profile-stats:before,
    5225div#community-profile-page li.bp-friends-profile-stats:before,
     
    5427div#community-profile-page li.bp-blogs-profile-stats:before,
    5528div#community-profile-page a.bp-xprofile-avatar-user-admin:before {
    56     font-family: 'dashicons';
    57     font-size: 18px;
    58     vertical-align: bottom;
    59     margin-right:5px;
     29    font: normal 20px/1 'dashicons';
     30    speak: none;
     31    display: inline-block;
     32    padding: 0 2px 0 0;
     33    top: 0;
     34    left: -1px;
     35    position: relative;
     36    vertical-align: top;
     37    -webkit-font-smoothing: antialiased;
     38    -moz-osx-font-smoothing: grayscale;
     39    text-decoration: none !important;
     40    color: #888;
    6041}
    6142
  • trunk/src/bp-members/bp-members-admin.php

    r8318 r8432  
    318318        } ?>
    319319
    320         <ul id="profile-nav" class="nav-tab-wrapper">
     320        <h2 id="profile-nav" class="nav-tab-wrapper">
    321321            <?php
    322322            /**
     
    326326             */
    327327            ?>
    328             <?php if ( current_user_can( 'edit_user' ) ) :?>
    329                 <li class="nav-tab<?php echo esc_attr( $wp_active ); ?>"><a href="<?php echo esc_url( $wordpress_url );?>"><?php _e( 'Profile', 'buddypress' ); ?></a></li>
    330             <?php endif ;?>
    331             <li class="nav-tab<?php echo esc_attr( $bp_active ); ?>"><a href="<?php echo esc_url( $community_url );?>"><?php _e( 'Extended Profile', 'buddypress' ); ?></a></li>
    332 
    333             <?php do_action( 'bp_members_admin_profile_nav', $active, $user ); ?>
    334         </ul>
     328            <?php if ( current_user_can( 'edit_user' ) ) : ?>
     329                <a class="nav-tab<?php echo esc_attr( $wp_active ); ?>" href="<?php echo esc_url( $wordpress_url );?>"><?php _e( 'Profile', 'buddypress' ); ?></a>
     330            <?php endif; ?>
     331            <a class="nav-tab<?php echo esc_attr( $bp_active ); ?>" href="<?php echo esc_url( $community_url );?>"><?php _e( 'Extended Profile', 'buddypress' ); ?></a>
     332        </h2>
    335333
    336334        <?php
     
    351349        if ( ! $user_id = intval( $_GET['user_id'] ) ) {
    352350            wp_die( __( 'No users were found', 'buddypress' ) );
    353         }
    354 
    355         // only edit others profile
    356         if ( get_current_user_id() == $user_id ) {
    357             bp_core_redirect( get_edit_user_link( $user_id ) );
    358351        }
    359352
     
    632625                <div id="misc-publishing-actions">
    633626                    <?php
     627
     628                    // Get the spam status once here to compare against below
     629                    $is_spammer = bp_is_user_spammer( $user->ID );
     630
    634631                    /**
    635                      * In configs where BuddyPress is not network activated, regular admins
    636                      * cannot mark a user as a spammer on front end. This prevent them to do
    637                      * it in backend.
     632                     * In configs where BuddyPress is not network activated,
     633                     * regular admins cannot mark a user as a spammer on front
     634                     * end. This prevent them to do it in backend.
     635                     *
     636                     * Also prevent admins from marking themselves or other
     637                     * admins as spammers.
    638638                     */
    639                     ?>
    640                     <?php if ( empty( $this->subsite_activated ) || ( ! empty( $this->subsite_activated ) && current_user_can( 'manage_network_users' ) ) ) : ?>
     639                    if ( ( get_current_user_id() !== $user->ID ) && ( ! in_array( $user->user_login, get_super_admins() ) ) &&  empty( $this->subsite_activated ) || ( ! empty( $this->subsite_activated ) && current_user_can( 'manage_network_users' ) ) ) : ?>
    641640                        <div class="misc-pub-section" id="comment-status-radio">
    642                             <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 />
    643                             <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>
     641                            <label class="approved"><input type="radio" name="user_status" value="ham" <?php checked( $is_spammer, false ); ?>><?php esc_html_e( 'Active', 'buddypress' ); ?></label><br />
     642                            <label class="spam"><input type="radio" name="user_status" value="spam" <?php checked( $is_spammer, true ); ?>><?php esc_html_e( 'Spammer', 'buddypress' ); ?></label>
    644643                        </div>
    645644                    <?php endif ;?>
     
    737736     */
    738737    public function row_actions( $actions = '', $user = null ) {
    739         // only edit others profile
    740         if ( get_current_user_id() == $user->ID ) {
    741             return $actions;
    742         }
    743 
    744         // Prevent a regular admin to edit a super admin
    745         if( in_array( $user->user_login, get_super_admins() ) ) {
    746             return $actions;
    747         }
    748738
    749739        $edit_profile = add_query_arg( array(
     
    752742        ), $this->edit_profile_url );
    753743
    754         $edit_profile_link = '<a href="' . esc_url( $edit_profile ) . '">' . esc_html__( 'Extended Profile', 'buddypress' ) . '</a>';
     744        $edit_profile_link = sprintf( '<a href="%1$s">%2$s</a>',  esc_url( $edit_profile ), esc_html__( 'Extended', 'buddypress' ) );
    755745
    756746        /**
Note: See TracChangeset for help on using the changeset viewer.