Here is my feature request. The ability to be taken back to your previous viewed page after logging in. No matter if you are in the forum path or outside of it, and long as each page is defined in phpBB and you are using phpBB's sessions. With this small implementation you can use phpBB features hand in hand with your website without any effort. This is a tiny feature to implement and it really propels phpBB. There wouldn't need to be any new major core features added, the idea is that this implementation just helps to better use what is all ready in the core. What are your thoughts?
I know there is a mod called Prime Login Redirect, but that is really just for inside of the forum path.
When I implements PhpBB into a site I'm just wanting to use the features of PhpBB in my site. For instance with PhpBB I have a messaging system, user system, registration system, user profiles, and threads that can even be used to display news feeds. Not to mention the awesome forum itself. Of course the main feature I am after is the authentication and sessions.
I recently read a thread about phpBB and full site integration found here https://www.phpbb.com/community/viewtopic.php?p=4016875. What I think PhpBB 4 should have is some kind of simplified way of integrating PhpBB with websites. I am talking about just making it simpler to use the PhpBB system with a developer's site. This wouldn't require anything other than changing the way pages are redirected. No more going to the forum index every time.
Right now when you want to login you can set your form action to ./phpBB3/ucp.php?mode=login. If a user is successfully logged in they are taken to the index set inside of the forum path. By simply altering this so that is redirects you to the page you were previously even if it is outside of the forum path solves everything. You now have a login script that no matter where you are on the site whether it is inside or outside of the forum path you are taken back to where you were before logging in. This simple redirect practically incorporates PhpBB with the site.
All you have to do is make sure you incorporate PhpBB's sessions and define the pages in PhpBB like so.
Code: Select all
<?php
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();
?>
Your existing page goes here
Here is how I incorporate PhpBB into my site.
My login form looks like
Code: Select all
<form action="./bb/ucp.php?mode=login" method="post">
<label for="username">Username:</label>
<input type="text" name="username" id="username" title="Username" />
<label for="password">Password:</label>
<input type="password" name="password" id="password" title="Password" />
<input type="hidden" name="return" value="<?php echo($_SERVER['REQUEST_URI']); ?>" />
<label for="autologin">save info<input type="checkbox" name="autologin" class="autologin" /></label>
<input type="submit" name="login" value="Login" class="headsub-submit" />
</form>
Code: Select all
<input type="hidden" name="redirect" value="./somefile.html" />
Code: Select all
<input type="hidden" name="return" value="<?php echo($_SERVER['REQUEST_URI']); ?>" />
Code: Select all
$redirect = request_var('redirect', "{$phpbb_root_path}index.$phpEx");
$message = ($l_success) ? $l_success : $user->lang['LOGIN_REDIRECT'];
Code: Select all
$goback = $_POST['return'];
$redirect = request_var('redirect', $goback);
Code: Select all
<?php
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();
?>
To do this all I had to do was create a hidden input field, store the url, and change one line and add another in my functions.php
The thing about it is that this is a very poor way to do it, but it is probably one of the simplest ways to incorporate phpBB into a website. Obviously it needs to be sanitized and several other things should be applied to the $_POST[' '].. This is just how I have it working right now.
I really believe that by simply redirecting a user to their previous page after logging in whether inside or outside of the forum path is all it takes to really allow phpBB to be incorporated into web sites with no fuss. Thanks for reading.