BBP_BuddyPress_Members::user_profile_url( int $user_id )

Override Forums profile URL with BuddyBoss profile URL

Description

Parameters

$url

(Required)

$user_id

(Required)

$user_nicename

(Required)

Return

(string)

Source

File: bp-forums/members.php

84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
public function user_profile_url( $user_id ) {
 
    // Define local variable(s)
    $profile_url    = '';
    $component_slug = bbpress()->extend->buddypress->slug;
 
    // Special handling for forum component
    if ( bp_is_current_component( $component_slug ) ) {
 
        // Empty action or 'topics' action
        if ( !bp_current_action() || bp_is_current_action( bbp_get_topic_archive_slug() ) ) {
            $profile_url = bp_core_get_user_domain( $user_id ) . $component_slug . '/' . bbp_get_topic_archive_slug();
 
        // Empty action or 'topics' action
        } elseif ( bp_is_current_action( bbp_get_reply_archive_slug() ) ) {
            $profile_url = bp_core_get_user_domain( $user_id ) . $component_slug . '/' . bbp_get_reply_archive_slug();
 
        // 'favorites' action
        } elseif ( bbp_is_favorites_active() && bp_is_current_action( bbp_get_user_favorites_slug() ) ) {
            $profile_url = $this->get_favorites_permalink( '', $user_id );
 
        // 'subscriptions' action
        } elseif ( bbp_is_subscriptions_active() && bp_is_current_action( bbp_get_user_subscriptions_slug() ) ) {
            $profile_url = $this->get_subscriptions_permalink( '', $user_id );
        }
 
    // Not in users' forums area
    } else {
        $profile_url = bp_core_get_user_domain( $user_id );
    }
 
    return trailingslashit( $profile_url );
}

Changelog

Changelog
Version Description
bbPress (r3401) 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.