git-svn-id: http://core.svn.wordpress.org/trunk@21364 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
09d728e46b
commit
7b49ad8493
|
@ -173,11 +173,7 @@ class WP_MS_Users_List_Table extends WP_List_Table {
|
|||
|
||||
case 'username':
|
||||
$avatar = get_avatar( $user->user_email, 32 );
|
||||
if ( get_current_user_id() == $user->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->ID ) ) );
|
||||
}
|
||||
$edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( stripslashes( $_SERVER['REQUEST_URI'] ) ), get_edit_user_link( $user->ID ) ) );
|
||||
|
||||
echo "<td $attributes>"; ?>
|
||||
<?php echo $avatar; ?><strong><a href="<?php echo $edit_link; ?>" class="edit"><?php echo stripslashes( $user->user_login ); ?></a><?php
|
||||
|
|
|
@ -231,12 +231,7 @@ class WP_Users_List_Table extends WP_List_Table {
|
|||
// Check if the user for this row is editable
|
||||
if ( current_user_can( 'list_users' ) ) {
|
||||
// Set up the user editing link
|
||||
// TODO: make profile/user-edit determination a separate function
|
||||
if ( get_current_user_id() == $user_object->ID ) {
|
||||
$edit_link = 'profile.php';
|
||||
} else {
|
||||
$edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( stripslashes( $_SERVER['REQUEST_URI'] ) ), "user-edit.php?user_id=$user_object->ID" ) );
|
||||
}
|
||||
$edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( stripslashes( $_SERVER['REQUEST_URI'] ) ), get_edit_user_link( $user_object->ID ) ) );
|
||||
|
||||
// Set up the hover actions for this user
|
||||
$actions = array();
|
||||
|
|
|
@ -1263,7 +1263,7 @@ function wp_welcome_panel() {
|
|||
<li><?php echo sprintf( __( '<a href="%s">Choose your privacy setting</a>' ), esc_url( admin_url('options-privacy.php') ) ); ?></li>
|
||||
<li><?php echo sprintf( __( '<a href="%s">Select your tagline and time zone</a>' ), esc_url( admin_url('options-general.php') ) ); ?></li>
|
||||
<li><?php echo sprintf( __( '<a href="%s">Turn comments on or off</a>' ), esc_url( admin_url('options-discussion.php') ) ); ?></li>
|
||||
<li><?php echo sprintf( __( '<a href="%s">Fill in your profile</a>' ), esc_url( admin_url('profile.php') ) ); ?></li>
|
||||
<li><?php echo sprintf( __( '<a href="%s">Fill in your profile</a>' ), esc_url( get_edit_profile_url( get_current_user_id() ) ) ); ?></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="welcome-panel-column">
|
||||
|
|
|
@ -353,7 +353,7 @@ function default_password_nag() {
|
|||
echo '<strong>' . __('Notice:') . '</strong> ';
|
||||
_e('You’re using the auto-generated password for your account. Would you like to change it to something easier to remember?');
|
||||
echo '</p><p>';
|
||||
printf( '<a href="%s">' . __('Yes, take me to my profile page') . '</a> | ', admin_url('profile.php') . '#password' );
|
||||
printf( '<a href="%s">' . __('Yes, take me to my profile page') . '</a> | ', get_edit_profile_url( get_current_user_id() ) . '#password' );
|
||||
printf( '<a href="%s" id="default-password-nag-no">' . __('No thanks, do not remind me again') . '</a>', '?default_password_nag=0' );
|
||||
echo '</p></div>';
|
||||
}
|
||||
|
|
|
@ -139,7 +139,7 @@ if ( !is_multisite() ) {
|
|||
}
|
||||
|
||||
if ( !is_wp_error( $errors ) ) {
|
||||
$redirect = (IS_PROFILE_PAGE ? "profile.php?" : "user-edit.php?user_id=$user_id&"). "updated=true";
|
||||
$redirect = add_query_arg( 'updated', true, get_edit_user_link( $user_id ) );
|
||||
if ( $wp_http_referer )
|
||||
$redirect = add_query_arg('wp_http_referer', urlencode($wp_http_referer), $redirect);
|
||||
wp_redirect($redirect);
|
||||
|
|
|
@ -1537,7 +1537,7 @@ function comment_form( $args = array(), $post_id = null ) {
|
|||
'fields' => apply_filters( 'comment_form_default_fields', $fields ),
|
||||
'comment_field' => '<p class="comment-form-comment"><label for="comment">' . _x( 'Comment', 'noun' ) . '</label><textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea></p>',
|
||||
'must_log_in' => '<p class="must-log-in">' . sprintf( __( 'You must be <a href="%s">logged in</a> to post a comment.' ), wp_login_url( apply_filters( 'the_permalink', get_permalink( $post_id ) ) ) ) . '</p>',
|
||||
'logged_in_as' => '<p class="logged-in-as">' . sprintf( __( 'Logged in as <a href="%1$s">%2$s</a>. <a href="%3$s" title="Log out of this account">Log out?</a>' ), admin_url( 'profile.php' ), $user_identity, wp_logout_url( apply_filters( 'the_permalink', get_permalink( $post_id ) ) ) ) . '</p>',
|
||||
'logged_in_as' => '<p class="logged-in-as">' . sprintf( __( 'Logged in as <a href="%1$s">%2$s</a>. <a href="%3$s" title="Log out of this account">Log out?</a>' ), get_edit_user_link(), $user_identity, wp_logout_url( apply_filters( 'the_permalink', get_permalink( $post_id ) ) ) ) . '</p>',
|
||||
'comment_notes_before' => '<p class="comment-notes">' . __( 'Your email address will not be published.' ) . ( $req ? $required_text : '' ) . '</p>',
|
||||
'comment_notes_after' => '<p class="form-allowed-tags">' . sprintf( __( 'You may use these <abbr title="HyperText Markup Language">HTML</abbr> tags and attributes: %s' ), ' <code>' . allowed_tags() . '</code>' ) . '</p>',
|
||||
'id_form' => 'commentform',
|
||||
|
|
|
@ -1056,6 +1056,34 @@ function edit_bookmark_link( $link = '', $before = '', $after = '', $bookmark =
|
|||
echo $before . apply_filters( 'edit_bookmark_link', $link, $bookmark->link_id ) . $after;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve edit user link
|
||||
*
|
||||
* @since 3.5.0
|
||||
*
|
||||
* @param int $user_id Optional. User ID. Defaults to the current user.
|
||||
* @return string URL to edit user page or empty string.
|
||||
*/
|
||||
function get_edit_user_link( $user_id = null ) {
|
||||
if ( ! $user_id )
|
||||
$user_id = get_current_user_id();
|
||||
|
||||
if ( empty( $user_id ) || ! current_user_can( 'edit_user', $user_id ) )
|
||||
return '';
|
||||
|
||||
$user = new WP_User( $user_id );
|
||||
|
||||
if ( ! $user->exists() )
|
||||
return '';
|
||||
|
||||
if ( get_current_user_id() == $user->ID )
|
||||
$link = get_edit_profile_url( $user->ID );
|
||||
else
|
||||
$link = add_query_arg( 'user_id', $user->ID, self_admin_url( 'user-edit.php' ) );
|
||||
|
||||
return apply_filters( 'get_edit_user_link', $link, $user->ID );
|
||||
}
|
||||
|
||||
// Navigation links
|
||||
|
||||
/**
|
||||
|
|
|
@ -68,7 +68,7 @@ if ( post_password_required($post) ) { // and it doesn't match the cookie
|
|||
|
||||
<form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
|
||||
<?php if ( $user_ID ) : ?>
|
||||
<p><?php printf(__('Logged in as <a href="%1$s">%2$s</a>. <a href="%3$s" title="Log out of this account">Log out »</a>'), get_option('siteurl') . '/wp-admin/profile.php', $user_identity, wp_logout_url(get_permalink())); ?></p>
|
||||
<p><?php printf(__('Logged in as <a href="%1$s">%2$s</a>. <a href="%3$s" title="Log out of this account">Log out »</a>'), get_edit_user_link(), $user_identity, wp_logout_url(get_permalink())); ?></p>
|
||||
<?php else : ?>
|
||||
<p>
|
||||
<input type="text" name="author" id="author" class="textarea" value="<?php echo esc_attr($comment_author); ?>" size="28" tabindex="1" />
|
||||
|
|
|
@ -69,7 +69,7 @@ _deprecated_file( sprintf( __( 'Theme without %1$s' ), basename(__FILE__) ), '3.
|
|||
|
||||
<?php if ( is_user_logged_in() ) : ?>
|
||||
|
||||
<p><?php printf(__('Logged in as <a href="%1$s">%2$s</a>.'), get_option('siteurl') . '/wp-admin/profile.php', $user_identity); ?> <a href="<?php echo wp_logout_url(get_permalink()); ?>" title="<?php esc_attr_e('Log out of this account'); ?>"><?php _e('Log out »'); ?></a></p>
|
||||
<p><?php printf(__('Logged in as <a href="%1$s">%2$s</a>.'), get_edit_user_link(), $user_identity); ?> <a href="<?php echo wp_logout_url(get_permalink()); ?>" title="<?php esc_attr_e('Log out of this account'); ?>"><?php _e('Log out »'); ?></a></p>
|
||||
|
||||
<?php else : ?>
|
||||
|
||||
|
|
|
@ -626,7 +626,7 @@ default:
|
|||
elseif ( is_multisite() && !$user->has_cap('read') )
|
||||
$redirect_to = get_dashboard_url( $user->ID );
|
||||
elseif ( !$user->has_cap('edit_posts') )
|
||||
$redirect_to = admin_url('profile.php');
|
||||
$redirect_to = get_edit_user_link();
|
||||
}
|
||||
wp_safe_redirect($redirect_to);
|
||||
exit();
|
||||
|
|
Loading…
Reference in New Issue