bp_core_get_user_domain( int $user_id, string|bool $user_nicename = false, string|bool $user_login = false )

Return the domain for the passed user: e.g. http://example.com/members/andy/.

Description

Parameters

$user_id

(Required) The ID of the user.

$user_nicename

(Optional) user_nicename of the user.

Default value: false

$user_login

(Optional) user_login of the user.

Default value: false

Return

(string)

Source

File: bp-members/bp-members-functions.php

175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
function bp_core_get_user_domain( $user_id = 0, $user_nicename = false, $user_login = false ) {
 
    if ( empty( $user_id ) ) {
        return;
    }
 
    $username = bp_core_get_username( $user_id, $user_nicename, $user_login );
 
    if ( bp_is_username_compatibility_mode() ) {
        $username = rawurlencode( $username );
    }
 
    $after_domain = bp_core_enable_root_profiles() ? $username : bp_get_members_root_slug() . '/' . $username;
    $domain       = trailingslashit( bp_get_root_domain() . '/' . $after_domain );
 
    // Don't use this filter.  Subject to removal in a future release.
    // Use the 'bp_core_get_user_domain' filter instead.
    $domain       = apply_filters( 'bp_core_get_user_domain_pre_cache', $domain, $user_id, $user_nicename, $user_login );
 
    /**
     * Filters the domain for the passed user.
     *
     * @since BuddyPress 1.0.1
     *
     * @param string $domain        Domain for the passed user.
     * @param int    $user_id       ID of the passed user.
     * @param string $user_nicename User nicename of the passed user.
     * @param string $user_login    User login of the passed user.
     */
    return apply_filters( 'bp_core_get_user_domain', $domain, $user_id, $user_nicename, $user_login );
}

Changelog

Changelog
Version Description
BuddyPress 1.0.0 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.