Info
- 3 posts
- 3 voices
- Started 2 years ago by yutt
- Latest reply from Ashfame
- This topic is not resolved
Authentication check on non-WP page
-
- Posted 2 years ago #
I'm trying to figure out how to verify a user is logged into BBpress before granting access on a non-bbpress page.
I'm currently trying to use: bb_auth() with limited success. It seems there are a lot of includes necessary. Is there a single file I can include that will load all of the mandatory functions for bb_auth?
-
- Posted 2 years ago #
I use this to stop people accessing the profile page unless logged-in;
<?php if ( !bb_is_user_logged_in() ) { show_error_page('log-in to access profiles'); exit; } ?>Something along those line should work with a link to somewhere else, assuming they're in a bbPress page to begin with.
-
- Posted 2 years ago #
Why not load the bbPress environment and then call function to check is user is logged in? I have done the same in WP, so I think it might be possible in bbPress very easily too.
For WP
// load the WP environment so that I can call on the WP functions to make sure that user is logged in before accessing members area require( dirname(__FILE__) . '/wp-load.php' ); if (!is_user_logged_in()) // You can't access the members area without login. Now can you? { auth_redirect(); }For bbPress, it should be like
require('./bb-load.php'); // find the name of the function you will need -
You must log in to post.