This post lead me to the right track, still not getting this to work. I believe set_default_user() is the answer but why I can't get it to update the prev_url column on the online table when I call it from my custom pages?
It does update the $forum_user['prev_url'] array but doesn't update the online table in the database, what am I missing here?
My site structure is the following if it makes a difference:
/forum/ (here's PunBB)
/section1/ (here's a custom page that queries PunBB db located in the forum dir)
/section2/ (here's another custom page that queries PunBB db located in the forum dir)
etc.
Using set_default_user() I got the prev_url variable to update correctly outside the forum too but as soon as I go to login the variable is replaced and after login I get redirected to forum index again.
Have to correct that, the issue is that only the array gets updated as descriped above, not the online table in the db so after I locate to the login.php the hidden redirect_url is fetched from the db table which has the old referer/prev_url.
Edit: The code I'm using on the custom pages is here:
// Integrate PunBB
define('FORUM_ROOT', '../forum/');
require FORUM_ROOT.'include/common.php';
// Set prev url for redirecting properly after logging in
set_default_user();