bbp_logged_in_redirect( string $url = '' )
Redirect a user back to their profile if they are already logged in.
Description Description
This should be used before get_header() is called in template files where the user should never have access to the contents of that file.
Parameters Parameters
- $url
-
(Optional) The URL to redirect to
Default value: ''
Source Source
File: includes/users/template.php
function bbp_logged_in_redirect( $url = '' ) { // Bail if user is not logged in if ( ! is_user_logged_in() ) { return; } // Setup the profile page to redirect to $redirect_to = ! empty( $url ) ? $url : bbp_get_user_profile_url( bbp_get_current_user_id() ); // Do a safe redirect bbp_redirect( $redirect_to ); }
Changelog Changelog
Version | Description |
---|---|
2.0.0 | Introduced. |