Make WordPress Core


Ignore:
Timestamp:
02/25/2014 05:07:22 PM (11 years ago)
Author:
nacin
Message:

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

props garyc40.
fixes #16686.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/link-template.php

    r27235 r27260  
    23442344 * @since 3.1.0
    23452345 *
    2346  * @param int $user_id User ID
     2346 * @param int $user_id Optional. User ID. Defaults to current user.
    23472347 * @param string $path Optional path relative to the dashboard. Use only paths known to both blog and user admins.
    23482348 * @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.
    23492349 * @return string Dashboard url link with optional path appended.
    23502350 */
    2351 function get_dashboard_url( $user_id, $path = '', $scheme = 'admin' ) {
    2352     $user_id = (int) $user_id;
     2351function get_dashboard_url( $user_id = 0, $path = '', $scheme = 'admin' ) {
     2352    $user_id = $user_id ? (int) $user_id : get_current_user_id();
    23532353
    23542354    $blogs = get_blogs_of_user( $user_id );
     
    23782378 * @since 3.1.0
    23792379 *
    2380  * @param int $user User ID
    2381  * @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.
     2380 * @param int    $user_id Optional. User ID. Defaults to current user.
     2381 * @param string $scheme  The scheme to use. Default is 'admin', which obeys force_ssl_admin() and is_ssl().
     2382 *                        'http' or 'https' can be passed to force those schemes.
    23822383 * @return string Dashboard url link with optional path appended.
    23832384 */
    2384 function get_edit_profile_url( $user, $scheme = 'admin' ) {
    2385     $user = (int) $user;
     2385function get_edit_profile_url( $user_id = 0, $scheme = 'admin' ) {
     2386    $user_id = $user_id ? (int) $user : get_current_user_id();
    23862387
    23872388    if ( is_user_admin() )
     
    23902391        $url = network_admin_url( 'profile.php', $scheme );
    23912392    else
    2392         $url = get_dashboard_url( $user, 'profile.php', $scheme );
    2393 
    2394     return apply_filters( 'edit_profile_url', $url, $user, $scheme);
     2393        $url = get_dashboard_url( $user_id, 'profile.php', $scheme );
     2394
     2395    return apply_filters( 'edit_profile_url', $url, $user_id, $scheme);
    23952396}
    23962397
Note: See TracChangeset for help on using the changeset viewer.