Automatically Logged in user does not persist
-
Hey all,
I had a previous post where i logged a user into bbpress by passing credentials from our site in the url. that worked fine but we were not using bbpress embedded in wordpress at the time.
Now we have changed the configuration by setting up a full WP site with bbpress as a plugin.
the goal is still the same: Send a user to our bbpress forum and automatically log them in.
We are using a single forum so i have made changes to
bbpress\bbp-theme-compat\bbpress\content-single-forum.php
Currently the user is logged in correctly. However when any topic link is pressed the “You must log in….” message is shown. Apparently is_user_logged_in returns false.
Any help on how to make the logged in user persist to more than the first page would be greatly appreciated.
We are using bbpress 2.1.2 and wp 3.4.1
My code for logging in a user is:
<br />
$loginCreds = array();<br />
$loginCreds['user_login'] = $user_login;<br />
$loginCreds['user_password'] = $_GET['password'] ;<br />
$loginCreds['remember'] = true ;<br />
$user = wp_signon( $loginCreds, false );<br />
if ( is_wp_error($user) ){<br />
echo $user->get_error_message();<br />
echo $_GET['password'] ;<br />
} else {<br />
$user_id = $user->ID;<br />
wp_set_current_user($user_id);<br />
wp_set_auth_cookie($user_id, true);<br />
}
- You must be logged in to reply to this topic.