Make the user arguments for get_edit_profile_url() and get_dashboard_url() optional, defaulting to the current user.

props garyc40.
fixes #16686.

Built from https://develop.svn.wordpress.org/trunk@27260


git-svn-id: http://core.svn.wordpress.org/trunk@27117 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2014-02-25 17:08:13 +00:00
parent 237941babc
commit c102fd5a9d
3 changed files with 12 additions and 11 deletions

View File

@ -93,7 +93,7 @@ if ( count( $_wp_admin_css_colors ) > 1 && has_action( 'admin_color_scheme_picke
/** This action is documented in wp-admin/user-edit.php */
do_action( 'admin_color_scheme_picker' );
?>
<p><?php printf( __( 'To change your color scheme later, just <a href="%1$s">visit your profile</a>.' ), get_edit_profile_url( get_current_user_id() ) ); ?></p>
<p><?php printf( __( 'To change your color scheme later, just <a href="%1$s">visit your profile</a>.' ), get_edit_profile_url() ); ?></p>
</div>
</div>
</div>

View File

@ -420,7 +420,7 @@ function default_password_nag() {
echo '<strong>' . __('Notice:') . '</strong> ';
_e('You&rsquo;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> | ', get_edit_profile_url( get_current_user_id() ) . '#password' );
printf( '<a href="%s">' . __('Yes, take me to my profile page') . '</a> | ', get_edit_profile_url() . '#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>';
}

View File

@ -2343,13 +2343,13 @@ function set_url_scheme( $url, $scheme = null ) {
*
* @since 3.1.0
*
* @param int $user_id User ID
* @param int $user_id Optional. User ID. Defaults to current user.
* @param string $path Optional path relative to the dashboard. Use only paths known to both blog and user admins.
* @param string $scheme The scheme to use. Default is 'admin', which obeys force_ssl_admin() and is_ssl(). 'http' or 'https' can be passed to force those schemes.
* @return string Dashboard url link with optional path appended.
*/
function get_dashboard_url( $user_id, $path = '', $scheme = 'admin' ) {
$user_id = (int) $user_id;
function get_dashboard_url( $user_id = 0, $path = '', $scheme = 'admin' ) {
$user_id = $user_id ? (int) $user_id : get_current_user_id();
$blogs = get_blogs_of_user( $user_id );
if ( ! is_super_admin() && empty($blogs) ) {
@ -2377,21 +2377,22 @@ function get_dashboard_url( $user_id, $path = '', $scheme = 'admin' ) {
*
* @since 3.1.0
*
* @param int $user User ID
* @param string $scheme The scheme to use. Default is 'admin', which obeys force_ssl_admin() and is_ssl(). 'http' or 'https' can be passed to force those schemes.
* @param int $user_id Optional. User ID. Defaults to current user.
* @param string $scheme The scheme to use. Default is 'admin', which obeys force_ssl_admin() and is_ssl().
* 'http' or 'https' can be passed to force those schemes.
* @return string Dashboard url link with optional path appended.
*/
function get_edit_profile_url( $user, $scheme = 'admin' ) {
$user = (int) $user;
function get_edit_profile_url( $user_id = 0, $scheme = 'admin' ) {
$user_id = $user_id ? (int) $user : get_current_user_id();
if ( is_user_admin() )
$url = user_admin_url( 'profile.php', $scheme );
elseif ( is_network_admin() )
$url = network_admin_url( 'profile.php', $scheme );
else
$url = get_dashboard_url( $user, 'profile.php', $scheme );
$url = get_dashboard_url( $user_id, 'profile.php', $scheme );
return apply_filters( 'edit_profile_url', $url, $user, $scheme);
return apply_filters( 'edit_profile_url', $url, $user_id, $scheme);
}
/**