<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[BuddyPress][8432] trunk/src/bp-members: Member Admin:</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://buddypress.trac.wordpress.org/changeset/8432">8432</a></dd>
<dt>Author</dt> <dd>johnjamesjacoby</dd>
<dt>Date</dt> <dd>2014-05-20 15:33:49 +0000 (Tue, 20 May 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>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 <a href="http://buddypress.trac.wordpress.org/ticket/5623">#5623</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcbpmembersadmincssadminrtlcss">trunk/src/bp-members/admin/css/admin-rtl.css</a></li>
<li><a href="#trunksrcbpmembersadmincssadmincss">trunk/src/bp-members/admin/css/admin.css</a></li>
<li><a href="#trunksrcbpmembersbpmembersadminphp">trunk/src/bp-members/bp-members-admin.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcbpmembersadmincssadminrtlcss"></a>
<div class="modfile"><h4>Modified: trunk/src/bp-members/admin/css/admin-rtl.css (8431 => 8432)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/bp-members/admin/css/admin-rtl.css 2014-05-20 15:29:53 UTC (rev 8431)
+++ trunk/src/bp-members/admin/css/admin-rtl.css 2014-05-20 15:33:49 UTC (rev 8432)
</span><span class="lines">@@ -5,58 +5,39 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> div#profile-page.wrap form#your-profile h3:first-of-type {
</span><del>- margin-top:6em;
</del><ins>+ margin-top:5em;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-div#profile-page.wrap form#your-profile ul#profile-nav {
- position:absolute;
- top:-6em;
- border-bottom:solid 1px #ccc;
- width:100%;
</del><ins>+div#profile-page.wrap form#your-profile #profile-nav {
+ position: absolute;
+ top: -3.65em;
+ width: 97%;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-div#community-profile-page ul#profile-nav {
- border-bottom:solid 1px #ccc;
- width:100%;
- margin-top:1em;
- margin-bottom:1em;
- padding:1em 0;
- padding-bottom: 0;
- height:2.4em;
</del><ins>+div#community-profile-page #profile-nav {
+ margin-bottom: 1em;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-form#your-profile ul#profile-nav li,
-div#community-profile-page ul#profile-nav li {
- margin-right:0.4em;
- float:right;
- font-weight: bold;
- font-size: 15px;
- line-height: 24px;
</del><ins>+#bp_members_admin_user_stats ul {
+ margin-bottom: 0;
</ins><span class="cx"> }
</span><del>-
-form#your-profile ul#profile-nav li a,
-div#community-profile-page ul#profile-nav li a {
- text-decoration: none;
- color:#888;
-}
-
-form#your-profile ul#profile-nav li a:hover,
-form#your-profile ul#profile-nav li.nav-tab-active a,
-div#community-profile-page ul#profile-nav li a:hover,
-div#community-profile-page ul#profile-nav li.nav-tab-active a {
- text-decoration: none;
- color:#000;
-}
-
</del><span class="cx"> div#community-profile-page li.bp-members-profile-stats:before,
</span><span class="cx"> div#community-profile-page li.bp-friends-profile-stats:before,
</span><span class="cx"> div#community-profile-page li.bp-groups-profile-stats:before,
</span><span class="cx"> div#community-profile-page li.bp-blogs-profile-stats:before,
</span><span class="cx"> div#community-profile-page a.bp-xprofile-avatar-user-admin:before {
</span><del>- font-family: 'dashicons';
- font-size: 18px;
- vertical-align: bottom;
- margin-left:5px;
</del><ins>+ font: normal 20px/1 'dashicons';
+ speak: none;
+ display: inline-block;
+ padding: 0 0 0 2px;
+ top: 0;
+ right: -1px;
+ position: relative;
+ vertical-align: top;
+ -webkit-font-smoothing: antialiased;
+ -moz-osx-font-smoothing: grayscale;
+ text-decoration: none !important;
+ color: #888;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> div#community-profile-page li.bp-members-profile-stats:before {
</span></span></pre></div>
<a id="trunksrcbpmembersadmincssadmincss"></a>
<div class="modfile"><h4>Modified: trunk/src/bp-members/admin/css/admin.css (8431 => 8432)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/bp-members/admin/css/admin.css 2014-05-20 15:29:53 UTC (rev 8431)
+++ trunk/src/bp-members/admin/css/admin.css 2014-05-20 15:33:49 UTC (rev 8432)
</span><span class="lines">@@ -5,58 +5,39 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> div#profile-page.wrap form#your-profile h3:first-of-type {
</span><del>- margin-top:6em;
</del><ins>+ margin-top:5em;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-div#profile-page.wrap form#your-profile ul#profile-nav {
- position:absolute;
- top:-6em;
- border-bottom:solid 1px #ccc;
- width:100%;
</del><ins>+div#profile-page.wrap form#your-profile #profile-nav {
+ position: absolute;
+ top: -3.65em;
+ width: 97%;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-div#community-profile-page ul#profile-nav {
- border-bottom:solid 1px #ccc;
- width:100%;
- margin-top:1em;
- margin-bottom:1em;
- padding:1em 0;
- padding-bottom: 0;
- height:2.4em;
</del><ins>+div#community-profile-page #profile-nav {
+ margin-bottom: 1em;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-form#your-profile ul#profile-nav li,
-div#community-profile-page ul#profile-nav li {
- margin-left:0.4em;
- float:left;
- font-weight: bold;
- font-size: 15px;
- line-height: 24px;
</del><ins>+#bp_members_admin_user_stats ul {
+ margin-bottom: 0;
</ins><span class="cx"> }
</span><del>-
-form#your-profile ul#profile-nav li a,
-div#community-profile-page ul#profile-nav li a {
- text-decoration: none;
- color:#888;
-}
-
-form#your-profile ul#profile-nav li a:hover,
-form#your-profile ul#profile-nav li.nav-tab-active a,
-div#community-profile-page ul#profile-nav li a:hover,
-div#community-profile-page ul#profile-nav li.nav-tab-active a {
- text-decoration: none;
- color:#000;
-}
-
</del><span class="cx"> div#community-profile-page li.bp-members-profile-stats:before,
</span><span class="cx"> div#community-profile-page li.bp-friends-profile-stats:before,
</span><span class="cx"> div#community-profile-page li.bp-groups-profile-stats:before,
</span><span class="cx"> div#community-profile-page li.bp-blogs-profile-stats:before,
</span><span class="cx"> div#community-profile-page a.bp-xprofile-avatar-user-admin:before {
</span><del>- font-family: 'dashicons';
- font-size: 18px;
- vertical-align: bottom;
- margin-right:5px;
</del><ins>+ font: normal 20px/1 'dashicons';
+ speak: none;
+ display: inline-block;
+ padding: 0 2px 0 0;
+ top: 0;
+ left: -1px;
+ position: relative;
+ vertical-align: top;
+ -webkit-font-smoothing: antialiased;
+ -moz-osx-font-smoothing: grayscale;
+ text-decoration: none !important;
+ color: #888;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> div#community-profile-page li.bp-members-profile-stats:before {
</span></span></pre></div>
<a id="trunksrcbpmembersbpmembersadminphp"></a>
<div class="modfile"><h4>Modified: trunk/src/bp-members/bp-members-admin.php (8431 => 8432)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/bp-members/bp-members-admin.php 2014-05-20 15:29:53 UTC (rev 8431)
+++ trunk/src/bp-members/bp-members-admin.php 2014-05-20 15:33:49 UTC (rev 8432)
</span><span class="lines">@@ -317,7 +317,7 @@
</span><span class="cx"> $wp_active = false;
</span><span class="cx"> } ?>
</span><span class="cx">
</span><del>- <ul id="profile-nav" class="nav-tab-wrapper">
</del><ins>+ <h2 id="profile-nav" class="nav-tab-wrapper">
</ins><span class="cx"> <?php
</span><span class="cx"> /**
</span><span class="cx"> * In configs where BuddyPress is not network activated, as regular
</span><span class="lines">@@ -325,14 +325,12 @@
</span><span class="cx"> * this check.
</span><span class="cx"> */
</span><span class="cx"> ?>
</span><del>- <?php if ( current_user_can( 'edit_user' ) ) :?>
- <li class="nav-tab<?php echo esc_attr( $wp_active ); ?>"><a href="<?php echo esc_url( $wordpress_url );?>"><?php _e( 'Profile', 'buddypress' ); ?></a></li>
- <?php endif ;?>
- <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>
</del><ins>+ <?php if ( current_user_can( 'edit_user' ) ) : ?>
+ <a class="nav-tab<?php echo esc_attr( $wp_active ); ?>" href="<?php echo esc_url( $wordpress_url );?>"><?php _e( 'Profile', 'buddypress' ); ?></a>
+ <?php endif; ?>
+ <a class="nav-tab<?php echo esc_attr( $bp_active ); ?>" href="<?php echo esc_url( $community_url );?>"><?php _e( 'Extended Profile', 'buddypress' ); ?></a>
+ </h2>
</ins><span class="cx">
</span><del>- <?php do_action( 'bp_members_admin_profile_nav', $active, $user ); ?>
- </ul>
-
</del><span class="cx"> <?php
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -352,11 +350,6 @@
</span><span class="cx"> wp_die( __( 'No users were found', 'buddypress' ) );
</span><span class="cx"> }
</span><span class="cx">
</span><del>- // only edit others profile
- if ( get_current_user_id() == $user_id ) {
- bp_core_redirect( get_edit_user_link( $user_id ) );
- }
-
</del><span class="cx"> // Build redirection URL
</span><span class="cx"> $redirect_to = remove_query_arg( array( 'action', 'error', 'updated', 'spam', 'ham', 'delete_avatar' ), $_SERVER['REQUEST_URI'] );
</span><span class="cx"> $doaction = ! empty( $_REQUEST['action'] ) ? $_REQUEST['action'] : false;
</span><span class="lines">@@ -631,16 +624,22 @@
</span><span class="cx"> <div id="minor-publishing">
</span><span class="cx"> <div id="misc-publishing-actions">
</span><span class="cx"> <?php
</span><ins>+
+ // Get the spam status once here to compare against below
+ $is_spammer = bp_is_user_spammer( $user->ID );
+
</ins><span class="cx"> /**
</span><del>- * In configs where BuddyPress is not network activated, regular admins
- * cannot mark a user as a spammer on front end. This prevent them to do
- * it in backend.
</del><ins>+ * In configs where BuddyPress is not network activated,
+ * regular admins cannot mark a user as a spammer on front
+ * end. This prevent them to do it in backend.
+ *
+ * Also prevent admins from marking themselves or other
+ * admins as spammers.
</ins><span class="cx"> */
</span><del>- ?>
- <?php if ( empty( $this->subsite_activated ) || ( ! empty( $this->subsite_activated ) && current_user_can( 'manage_network_users' ) ) ) : ?>
</del><ins>+ 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' ) ) ) : ?>
</ins><span class="cx"> <div class="misc-pub-section" id="comment-status-radio">
</span><del>- <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 />
- <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>
</del><ins>+ <label class="approved"><input type="radio" name="user_status" value="ham" <?php checked( $is_spammer, false ); ?>><?php esc_html_e( 'Active', 'buddypress' ); ?></label><br />
+ <label class="spam"><input type="radio" name="user_status" value="spam" <?php checked( $is_spammer, true ); ?>><?php esc_html_e( 'Spammer', 'buddypress' ); ?></label>
</ins><span class="cx"> </div>
</span><span class="cx"> <?php endif ;?>
</span><span class="cx">
</span><span class="lines">@@ -736,22 +735,13 @@
</span><span class="cx"> * @return array Merged actions.
</span><span class="cx"> */
</span><span class="cx"> public function row_actions( $actions = '', $user = null ) {
</span><del>- // only edit others profile
- if ( get_current_user_id() == $user->ID ) {
- return $actions;
- }
</del><span class="cx">
</span><del>- // Prevent a regular admin to edit a super admin
- if( in_array( $user->user_login, get_super_admins() ) ) {
- return $actions;
- }
-
</del><span class="cx"> $edit_profile = add_query_arg( array(
</span><span class="cx"> 'user_id' => $user->ID,
</span><span class="cx"> 'wp_http_referer' => urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ),
</span><span class="cx"> ), $this->edit_profile_url );
</span><span class="cx">
</span><del>- $edit_profile_link = '<a href="' . esc_url( $edit_profile ) . '">' . esc_html__( 'Extended Profile', 'buddypress' ) . '</a>';
</del><ins>+ $edit_profile_link = sprintf( '<a href="%1$s">%2$s</a>', esc_url( $edit_profile ), esc_html__( 'Extended', 'buddypress' ) );
</ins><span class="cx">
</span><span class="cx"> /**
</span><span class="cx"> * Check the edit action is available
</span></span></pre>
</div>
</div>
</body>
</html>