bbp_get_user_profile_edit_url

Return URL to the profile edit page of a user.

Description

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

Returns (string)

Parameters (2)

0. $user_id — Optional. (int)
User id
1. $user_nicename — Optional. (string) => ''
User nicename

Usage

  1. if ( !function_exists( 'bbp_get_user_profile_edit_url' ) ) { 
  2. require_once '/includes/users/template.php'; 
  3.  
  4. // Optional. User id 
  5. $user_id = -1; 
  6.  
  7. // Optional. User nicename 
  8. $user_nicename = ''; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = bbp_get_user_profile_edit_url($user_id, $user_nicename); 
  12.  

Defined (1)

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

/includes/users/template.php  
  1. function bbp_get_user_profile_edit_url( $user_id = 0, $user_nicename = '' ) { 
  2. global $wp_rewrite; 
  3.  
  4. $bbp = bbpress(); 
  5. $user_id = bbp_get_user_id( $user_id ); 
  6. if ( empty( $user_id ) ) 
  7. return false; 
  8.  
  9. // Pretty permalinks 
  10. if ( $wp_rewrite->using_permalinks() ) { 
  11. $url = $wp_rewrite->root . bbp_get_user_slug() . '/%' . $bbp->user_id . '%/' . $bbp->edit_id; 
  12.  
  13. // Get username if not passed 
  14. if ( empty( $user_nicename ) ) { 
  15. $user = get_userdata( $user_id ); 
  16. if ( !empty( $user->user_nicename ) ) { 
  17. $user_nicename = $user->user_nicename; 
  18.  
  19. $url = str_replace( '%' . $bbp->user_id . '%', $user_nicename, $url ); 
  20. $url = home_url( user_trailingslashit( $url ) ); 
  21.  
  22. // Unpretty permalinks 
  23. } else { 
  24. $url = add_query_arg( array( $bbp->user_id => $user_id, $bbp->edit_id => '1' ), home_url( '/' ) ); 
  25.  
  26. return apply_filters( 'bbp_get_user_edit_profile_url', $url, $user_id, $user_nicename ); 
  27.