xoops forums

jimmyx

Quite a regular
Posted on: 2010/6/26 12:19
jimmyx
jimmyx (Show more)
Quite a regular
Posts: 338
Since: 2007/7/17
#1

Question about Login through user.php

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

Moderator
Posted on: 2010/6/26 16:18
mboyden
mboyden (Show more)
Moderator
Posts: 484
Since: 2005/3/9 1
#2

Re: Question about Login through user.php

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

Home away from home
Posted on: 2010/6/27 6:08
Catzwolf
Catzwolf (Show more)
Home away from home
Posts: 1392
Since: 2007/9/30
#3

Re: Question about Login through user.php

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

Just can't stay away
Posted on: 2010/9/30 14:46
Mazarin
Mazarin (Show more)
Just can't stay away
Posts: 533
Since: 2008/12/10
#4

Re: Question about Login through user.php

Thanks John. Works perfectly!

sabahan

Quite a regular
Posted on: 2011/9/13 7:37
sabahan
sabahan (Show more)
Quite a regular
Posts: 315
Since: 2006/3/4 0
#5

Re: Question about Login through user.php

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

Moderator
Posted on: 2011/9/13 9:31
Mamba
Mamba (Show more)
Moderator
Posts: 10372
Since: 2004/4/23
#6

Re: Question about Login through user.php

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

Quite a regular
Posted on: 2011/9/13 10:33
sabahan
sabahan (Show more)
Quite a regular
Posts: 315
Since: 2006/3/4 0
#7

Re: Question about Login through user.php



added here
https://sourceforge.net/tracker/?func= ... roup_id=41586&atid=430843

sabahan

Quite a regular
Posted on: 2011/9/13 10:50
sabahan
sabahan (Show more)
Quite a regular
Posts: 315
Since: 2006/3/4 0
#8

Re: Question about Login through user.php

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