Fork me on GitHub



Make donations with PayPal!
Goal: $100.00
Due Date: Oct 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00

GitHub Twitter

Learn XOOPS Core

Local Support


XOOPS Code hosted on SourceForge

Cumulus Tag Cloud

- 2 2.5 2.6 4 6 admin adslight Android AntiHarvesting AntiSpam API Apple Battlefield billige Blocks Bootstrap Captcha cell cent chronolabs Clicks Cloud content CĂN demo download Dresses facebook Fat floor Gateway giải Google Guide herre Home Honeypot html5 Human HỘ IP iPhone jQuery Language Law Legal List log Loss module modules Monster new newbb news nhiệt NHÀ online PARK Payment phone PHP Plugin Prevention profile project Protector publisher RESIDENCE responsive review Rights Room security Sentry Signed site Smartphone Smarty Smoking Solution Spam stem Studio support tag tdmcreate The Theme themes User userlog weight xoops Xortify XPayment ZendFramework

New Users

Registering user

# 139409


Welcome to XOOPS!

Bottom   Previous Topic   Next Topic  |  Register To Post

#1 Posted on: 2010/6/26 12:19 Question about Login through user.php

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...


p/s :sorry for this double post...i just found out that i opened up the same post back in ... id=267949#forumpost267949

i don't remember this...but still hope can have an answer how to do this or it is not doable


2007/7/17 22:35
Registered Users
Posts: 338
(Show More) (Show Less)

#2 Posted on: 2010/6/26 16:18 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
2005/3/9 13:07
From Austin, TX (USA)
Registered Users
Posts: 475
(Show More) (Show Less)

#3 Posted on: 2010/6/27 6:08 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( 
$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



2007/9/30 0:21
Registered Users
Posts: 1332
(Show More) (Show Less)

#4 Posted on: 2010/9/30 14:46 Re: Question about Login through user.php
Thanks John. Works perfectly!


2008/12/10 16:05
From Knivsta, Sweden
Registered Users
Repository Group
Posts: 521
(Show More) (Show Less)

#5 Posted on: 2011/9/13 7:37 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 ... roup_id=41586&atid=430840

this is not accessible for guest

2. click the login link on top bar

3. input username/password

4. success login

5. im redirected to my previous page ... roup_id=41586&atid=430840


2006/3/4 0:35
Registered Users
Posts: 307
(Show More) (Show Less)

#6 Posted on: 2011/9/13 9:31 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
2004/4/23 14:58
From Ohio, USA
Registered Users
Designer Group
Super Moderator
Posts: 9044
(Show More) (Show Less)

#7 Posted on: 2011/9/13 10:33 Re: Question about Login through user.php

added here ... roup_id=41586&atid=430843


2006/3/4 0:35
Registered Users
Posts: 307
(Show More) (Show Less)

#8 Posted on: 2011/9/13 10:50 Re: Question about Login through user.php
btw i tried the catzwolf solution 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


2006/3/4 0:35
Registered Users
Posts: 307
(Show More) (Show Less)

You can view topic.
You cannot start a new topic.
You cannot reply to posts.
You cannot edit your posts.
You cannot delete your posts.
You cannot add new polls.
You cannot vote in polls.
You cannot attach files to posts.
You cannot post without approval.
You cannot use topic type.
You cannot use HTML syntax.
You cannot use signature.
You cannot create PDF files.
You cannot get print page.

[Advanced Search]