bbp_redirect_login

Redirect back to $url when attempting to use the login page.

Description

bbp_redirect_login( (string) $url = '', (string) $raw_url = '', (string) $user = '' ); 

Parameters (3)

0. $url — Optional. (string) => ''
The url.
1. $raw_url — Optional. (string) => ''
The raw url.
2. $user — Optional. (string) => ''
User object

Usage

  1. if ( !function_exists( 'bbp_redirect_login' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'bbpress/includes/users/functions.php'; 
  3.  
  4. // The url. 
  5. $url = ''; 
  6.  
  7. // The raw url. 
  8. $raw_url = ''; 
  9.  
  10. // User object 
  11. $user = ''; 
  12.  
  13. // NOTICE! Understand what this does before running. 
  14. $result = bbp_redirect_login($url, $raw_url, $user); 
  15.  

Defined (1)

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

/includes/users/functions.php  
  1. function bbp_redirect_login( $url = '', $raw_url = '', $user = '' ) { 
  2.  
  3. // Raw redirect_to was passed, so use it 
  4. if ( !empty( $raw_url ) ) 
  5. $url = $raw_url; 
  6.  
  7. // $url was manually set in wp-login.php to redirect to admin 
  8. elseif ( admin_url() === $url ) 
  9. $url = home_url(); 
  10.  
  11. // $url is empty 
  12. elseif ( empty( $url ) ) 
  13. $url = home_url(); 
  14.  
  15. return apply_filters( 'bbp_redirect_login', $url, $raw_url, $user );