WordPress.org

Make WordPress Core

Ticket #16686: 16686.diff

File 16686.diff, 1.2 KB (added by garyc40, 3 years ago)

get_edit_profile_url() defaults to current user

  • wp-includes/link-template.php

    diff --git wp-includes/link-template.php wp-includes/link-template.php
    index 33f0a7d..242df7b 100644
    function get_dashboard_url( $user_id, $path = '', $scheme = 'admin' ) { 
    23192319 * 
    23202320 * @since 3.1.0 
    23212321 * 
    2322  * @param int $user User ID 
     2322 * @param int $user_id User ID 
    23232323 * @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. 
    23242324 * @return string Dashboard url link with optional path appended 
    23252325 */ 
    2326 function get_edit_profile_url( $user, $scheme = 'admin' ) { 
    2327         $user = (int) $user; 
     2326function get_edit_profile_url( $user_id = false, $scheme = 'admin' ) { 
     2327        $user_id = ( $user_id ) ? (int) $user : get_current_user_id(); 
    23282328 
    23292329        if ( is_user_admin() ) 
    23302330                $url = user_admin_url( 'profile.php', $scheme ); 
    23312331        elseif ( is_network_admin() ) 
    23322332                $url = network_admin_url( 'profile.php', $scheme ); 
    23332333        else 
    2334                 $url = get_dashboard_url( $user, 'profile.php', $scheme ); 
     2334                $url = get_dashboard_url( $user_id, 'profile.php', $scheme ); 
    23352335 
    2336         return apply_filters( 'edit_profile_url', $url, $user, $scheme); 
     2336        return apply_filters( 'edit_profile_url', $url, $user_id, $scheme); 
    23372337} 
    23382338 
    23392339/**