<!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" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { 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 #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#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>
<title>[17201] trunk/wp-admin: Allow us to return from whence we came.</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/17201">17201</a></dd>
<dt>Author</dt> <dd>nacin</dd>
<dt>Date</dt> <dd>2011-01-01 22:30:46 +0000 (Sat, 01 Jan 2011)</dd>
</dl>

<h3>Log Message</h3>
<pre>Allow us to return from whence we came. Specify wp_http_referer for user-edit in the network admin, as we may come from network/users or site-users. props PeteMall, SergeyBiryukov, fixes <a href="http://trac.wordpress.org/ticket/16053">#16053</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminincludesclasswpmsuserslisttablephp">trunk/wp-admin/includes/class-wp-ms-users-list-table.php</a></li>
<li><a href="#trunkwpadminusereditphp">trunk/wp-admin/user-edit.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminincludesclasswpmsuserslisttablephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/class-wp-ms-users-list-table.php (17200 => 17201)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/class-wp-ms-users-list-table.php        2011-01-01 22:14:42 UTC (rev 17200)
+++ trunk/wp-admin/includes/class-wp-ms-users-list-table.php        2011-01-01 22:30:46 UTC (rev 17201)
</span><span class="lines">@@ -171,17 +171,21 @@
</span><span class="cx"> 
</span><span class="cx">                                         case 'username':
</span><span class="cx">                                                 $avatar        = get_avatar( $user-&gt;user_email, 32 );
</span><del>-                                                $edit_link = ( get_current_user_id() == $user-&gt;ID ) ? 'profile.php' : 'user-edit.php?user_id=' . $user-&gt;ID;
</del><ins>+                                                if ( get_current_user_id() == $user-&gt;ID ) {
+                                                        $edit_link = esc_url( network_admin_url( 'profile.php' ) );
+                                                } else {
+                                                        $edit_link = esc_url( network_admin_url( add_query_arg( 'wp_http_referer', urlencode( stripslashes( $_SERVER['REQUEST_URI'] ) ), 'user-edit.php?user_id=' . $user-&gt;ID ) ) );
+                                                }
</ins><span class="cx"> 
</span><span class="cx">                                                 echo &quot;&lt;td $attributes&gt;&quot;; ?&gt;
</span><del>-                                                        &lt;?php echo $avatar; ?&gt;&lt;strong&gt;&lt;a href=&quot;&lt;?php echo esc_url( self_admin_url( $edit_link ) ); ?&gt;&quot; class=&quot;edit&quot;&gt;&lt;?php echo stripslashes( $user-&gt;user_login ); ?&gt;&lt;/a&gt;&lt;?php
</del><ins>+                                                        &lt;?php echo $avatar; ?&gt;&lt;strong&gt;&lt;a href=&quot;&lt;?php echo $edit_link; ?&gt;&quot; class=&quot;edit&quot;&gt;&lt;?php echo stripslashes( $user-&gt;user_login ); ?&gt;&lt;/a&gt;&lt;?php
</ins><span class="cx">                                                         if ( in_array( $user-&gt;user_login, $super_admins ) )
</span><span class="cx">                                                                 echo ' - ' . __( 'Super Admin' );
</span><span class="cx">                                                         ?&gt;&lt;/strong&gt;
</span><span class="cx">                                                         &lt;br/&gt;
</span><span class="cx">                                                         &lt;?php
</span><span class="cx">                                                                 $actions = array();
</span><del>-                                                                $actions['edit'] = '&lt;a href=&quot;' . esc_url( self_admin_url( $edit_link ) ) . '&quot;&gt;' . __( 'Edit' ) . '&lt;/a&gt;';
</del><ins>+                                                                $actions['edit'] = '&lt;a href=&quot;' . $edit_link . '&quot;&gt;' . __( 'Edit' ) . '&lt;/a&gt;';
</ins><span class="cx"> 
</span><span class="cx">                                                                 if ( current_user_can( 'delete_user', $user-&gt;ID) &amp;&amp; ! in_array( $user-&gt;user_login, $super_admins ) ) {
</span><span class="cx">                                                                         $actions['delete'] = '&lt;a href=&quot;' . $delete = esc_url( network_admin_url( add_query_arg( '_wp_http_referer', urlencode( stripslashes( $_SERVER['REQUEST_URI'] ) ), wp_nonce_url( 'edit.php', 'deleteuser' ) . '&amp;amp;action=deleteuser&amp;amp;id=' . $user-&gt;ID ) ) ) . '&quot; class=&quot;delete&quot;&gt;' . __( 'Delete' ) . '&lt;/a&gt;';
</span></span></pre></div>
<a id="trunkwpadminusereditphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/user-edit.php (17200 => 17201)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/user-edit.php        2011-01-01 22:14:42 UTC (rev 17200)
+++ trunk/wp-admin/user-edit.php        2011-01-01 22:30:46 UTC (rev 17201)
</span><span class="lines">@@ -147,7 +147,8 @@
</span><span class="cx"> 
</span><span class="cx"> if ( !is_wp_error( $errors ) ) {
</span><span class="cx">         $redirect = (IS_PROFILE_PAGE ? &quot;profile.php?&quot; : &quot;user-edit.php?user_id=$user_id&amp;&quot;). &quot;updated=true&quot;;
</span><del>-        $redirect = add_query_arg('wp_http_referer', urlencode($wp_http_referer), $redirect);
</del><ins>+        if ( $wp_http_referer )
+                $redirect = add_query_arg('wp_http_referer', urlencode($wp_http_referer), $redirect);
</ins><span class="cx">         wp_redirect($redirect);
</span><span class="cx">         exit;
</span><span class="cx"> }
</span><span class="lines">@@ -168,7 +169,7 @@
</span><span class="cx"> &lt;div id=&quot;message&quot; class=&quot;updated&quot;&gt;
</span><span class="cx">         &lt;p&gt;&lt;strong&gt;&lt;?php _e('User updated.') ?&gt;&lt;/strong&gt;&lt;/p&gt;
</span><span class="cx">         &lt;?php if ( $wp_http_referer &amp;&amp; !IS_PROFILE_PAGE ) : ?&gt;
</span><del>-        &lt;p&gt;&lt;a href=&quot;users.php&quot;&gt;&lt;?php _e('&amp;larr; Back to Authors and Users'); ?&gt;&lt;/a&gt;&lt;/p&gt;
</del><ins>+        &lt;p&gt;&lt;a href=&quot;&lt;?php echo esc_url( $wp_http_referer ); ?&gt;&quot;&gt;&lt;?php _e('&amp;larr; Back to Authors and Users'); ?&gt;&lt;/a&gt;&lt;/p&gt;
</ins><span class="cx">         &lt;?php endif; ?&gt;
</span><span class="cx"> &lt;/div&gt;
</span><span class="cx"> &lt;?php endif; ?&gt;
</span></span></pre>
</div>
</div>

</body>
</html>