jimmyx jimmyx
  • Quite a regular
  • Quite a regular
  • Joined: 2007/7/17 22:35
  • Group: Registered Users
  • Posts: 338
  • Posted on: 2010/6/26 12:19
Question about Login through user.php #1
Hi..

i want to disable login block

and make all user login through user.php

the problem is

it is not redirecting them back to where there were

as example when a guest is in forum and click the login link (user.php) to login

after successful login it bring the user back to index page

is there any hack to bring back them to where they were ? the forum page ?


or is there any other way...

help..TQ


EDIT
p/s :sorry for this double post...i just found out that i opened up the same post back in 2007...lol..

http://www.xoops.org/modules/newbb/vi ... id=267949#forumpost267949

i don't remember this...but still hope can have an answer how to do this or it is not doable
mboyden mboyden
  • Moderator
  • Moderator
  • Joined: 2005/3/9 13:07
  • From Austin, TX (USA)
  • Group: Registered Users
  • Posts: 484
  • Posted on: 2010/6/26 16:18
Re: Question about Login through user.php #2
There is no quick, simple, easy hack to this. However, it was built-in to XOOPS to allow module developers to do that, but it requires the module developer to set a particular variable before redirecting.

The function is redirect_header found in the include/functions.php file:

function redirect_header($url, $time = 3, $message = '', $addredirect = true, $allowExternalLink = false)

the passed variable $url is the one you are looking for. Realistically it should pickup the referring URL if none is passed. Unfortunately a lot of modules don't use this very well and just give you the home "index.php" page as passed. Sloppy, but done a lot

So, you'll have to find the instance in the code that does this redirect_header and then pull the current URL to pass as the $url.

Clear as mud?

BTW, many folk just add a login area to the theme and the URL ($url) that is passed in the form is the current URL. That way it times them right back to where they were. That code can be found on this site, too, of course, and is in a couple of the programmatic themes.
Pessimists see difficulty in opportunity; Optimists see opportunity in difficulty. --W Churchill

XOOPS: Latest | Debug | Hosting and Web Development
Catzwolf Catzwolf
  • Home away from home
  • Home away from home
  • Joined: 2007/9/30 0:21
  • Group: Registered Users
  • Posts: 1392
  • Posted on: 2010/6/27 6:08
Re: Question about Login through user.php #3
Try this and see if it works for you k.

Open user.php and look for the line (roughly line 52):

if (isset($_GET['xoops_redirect'])) {
            
$xoopsTpl->assign('redirect_page'htmlspecialchars(trim($_GET['xoops_redirect']), ENT_QUOTES));
        }

and change it to this:

if ( isset( $_GET['xoops_redirect'] ) ) {
            
$xoopsTpl->assign'redirect_page'htmlspecialcharstrim$_GET['xoops_redirect'] ), ENT_QUOTES ) );
        } else if ( isset( 
$_SERVER['REQUEST_URI'] ) ) {
            
$xoopsTpl->assign'redirect_page'htmlspecialcharsxoops_getenv'REQUEST_URI' ), ENT_QUOTES ) );
        }



Also, in /include/checklogin.php, look for line 103:

$url .= $_POST['xoops_redirect'];


and change it to:

$url .= str_replace(XOOPS_URL''$_POST['xoops_redirect']);



It's not perfect but it should do what you want........ hopefully

John
Mazarin Mazarin
  • Just can't stay away
  • Just can't stay away
  • Joined: 2008/12/10 16:05
  • From Knivsta, Sweden
  • Group: Registered Users Repository Group
  • Posts: 533
  • Posted on: 2010/9/30 14:46
Re: Question about Login through user.php #4
Thanks John. Works perfectly!
sabahan sabahan
  • Quite a regular
  • Quite a regular
  • Joined: 2006/3/4 0:35
  • Group: Registered Users
  • Posts: 307
  • Posted on: 2011/9/13 7:37
Re: Question about Login through user.php #5
can this be included in the core ?

I noticed this feature is implemented in the sourceforge website .. (ive been reporting a few xoops bugs lately)

1. i want to report xoops bug

http://sourceforge.net/tracker/?func= ... roup_id=41586&atid=430840

this is not accessible for guest

2. click the login link on top bar
http://sourceforge.net/account/login.php

3. input username/password

4. success login

5. im redirected to my previous page
http://sourceforge.net/tracker/?func= ... roup_id=41586&atid=430840




Mamba Mamba
  • Moderator
  • Moderator
  • Joined: 2004/4/23 14:58
  • From Ohio, USA
  • Group: Webmaster Registered Users Designer Group Super Moderator
  • Posts: 10293
  • Posted on: 2011/9/13 9:31
Re: Question about Login through user.php #6
Please make it a feature request. No guarantees that it will be implemented, but at least it will be entered.
Please support XOOPS & DONATE
Use 2.5.8 | Debug | Requests | Bugs
sabahan sabahan
  • Quite a regular
  • Quite a regular
  • Joined: 2006/3/4 0:35
  • Group: Registered Users
  • Posts: 307
  • Posted on: 2011/9/13 10:33
Re: Question about Login through user.php #7


added here
https://sourceforge.net/tracker/?func= ... roup_id=41586&atid=430843
sabahan sabahan
  • Quite a regular
  • Quite a regular
  • Joined: 2006/3/4 0:35
  • Group: Registered Users
  • Posts: 307
  • Posted on: 2011/9/13 10:50
Re: Question about Login through user.php #8
btw i tried the catzwolf solution above..it is not working..i don't know if i did correctly

what i did was...

a. change the lines mentioned

b. then create a custom block show in all pages..make link to root/user.php in the block

c. when to a module page (forum topic) as guest ..

d. click the login link to user.php in the custom block

e. after login in user.php i am redirected to my profile page and not to the forum topic where i was before
How to effectively post a question in the Xoops forums? - Read here...
Design by: XOOPS UI/UX Team