bbp_get_user_profile_edit_url( int $user_id, string $user_nicename = '' )

Return URL to the profile edit page of a user

Description

Parameters

$user_id

(Optional) User id

$user_nicename

(Optional) User nicename

Default value: ''

Return

(string)

Source

File: bp-forums/users/template.php

433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
function bbp_get_user_profile_edit_url( $user_id = 0, $user_nicename = '' ) {
    global $wp_rewrite;
 
    $bbp     = bbpress();
    $user_id = bbp_get_user_id( $user_id );
    if ( empty( $user_id ) )
        return false;
 
    // Pretty permalinks
    if ( $wp_rewrite->using_permalinks() ) {
        $url = $wp_rewrite->root . bbp_get_user_slug() . '/%' . $bbp->user_id . '%/' . $bbp->edit_id;
 
        // Get username if not passed
        if ( empty( $user_nicename ) ) {
            $user = get_userdata( $user_id );
            if ( !empty( $user->user_nicename ) ) {
                $user_nicename = $user->user_nicename;
            }
        }
 
        $url = str_replace( '%' . $bbp->user_id . '%', $user_nicename, $url );
        $url = home_url( user_trailingslashit( $url ) );
 
    // Unpretty permalinks
    } else {
        $url = add_query_arg( array( $bbp->user_id => $user_id, $bbp->edit_id => '1' ), home_url( '/' ) );
    }
 
    return apply_filters( 'bbp_get_user_edit_profile_url', $url, $user_id, $user_nicename );
 
}

Changelog

Changelog
Version Description
bbPress (r2688) Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.