Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Redirect Specific Tab To Login Page For Non-Logged-in Users.
- */
- function yzc_rdirect_specific_tabs_to_login_page() {
- if ( is_user_logged_in() ) {
- return;
- }
- // Forbidden Tabs.
- $forbidden_slugs = array( 'info', 'friends' );
- if ( bp_is_user() && in_array( bp_current_component(), $forbidden_slugs ) ) {
- // Get Redirection Url
- $redirect_url = yz_get_login_page_url();
- wp_redirect( $redirect_url );
- exit();
- }
- }
- add_action( 'template_redirect', 'yzc_rdirect_specific_tabs_to_login_page' );
Add Comment
Please, Sign In to add comment