bp_core_get_user_domain

Return the domain for the passed user: e.g.

Description

(string) bp_core_get_user_domain( (int) $user_id = 0, (constant) $user_nicename = false, (bool) $user_login = false ); 

http://example.com/members/andy/.

Returns (string)

Parameters (3)

0. $user_id — Optional. (int)
The ID of the user.
1. $user_nicename — Optional. (constant) => false
user_nicename of the user.
2. $user_login — Optional. (bool) => false
user_login of the user.

Usage

  1. if ( !function_exists( 'bp_core_get_user_domain' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-members/bp-members-functions.php'; 
  3.  
  4. // The ID of the user. 
  5. $user_id = -1; 
  6.  
  7. // Optional. user_nicename of the user. 
  8. $user_nicename = false; 
  9.  
  10. // Optional. user_login of the user. 
  11. $user_login = false; 
  12.  
  13. // NOTICE! Understand what this does before running. 
  14. $result = bp_core_get_user_domain($user_id, $user_nicename, $user_login); 
  15.  

Defined (1)

The function is defined in the following location(s).

/bp-members/bp-members-functions.php  
  1. function bp_core_get_user_domain( $user_id = 0, $user_nicename = false, $user_login = false ) { 
  2.  
  3. if ( empty( $user_id ) ) { 
  4. return; 
  5.  
  6. $username = bp_core_get_username( $user_id, $user_nicename, $user_login ); 
  7.  
  8. $username = rawurlencode( $username ); 
  9.  
  10. $after_domain = bp_core_enable_root_profiles() ? $username : bp_get_members_root_slug() . '/' . $username; 
  11. $domain = trailingslashit( bp_get_root_domain() . '/' . $after_domain ); 
  12.  
  13. // Don't use this filter. Subject to removal in a future release. 
  14. // Use the 'bp_core_get_user_domain' filter instead. 
  15. $domain = apply_filters( 'bp_core_get_user_domain_pre_cache', $domain, $user_id, $user_nicename, $user_login ); 
  16.  
  17. /** 
  18. * Filters the domain for the passed user. 
  19. * @since 1.0.1 
  20. * @param string $domain Domain for the passed user. 
  21. * @param int $user_id ID of the passed user. 
  22. * @param string $user_nicename User nicename of the passed user. 
  23. * @param string $user_login User login of the passed user. 
  24. */ 
  25. return apply_filters( 'bp_core_get_user_domain', $domain, $user_id, $user_nicename, $user_login );