1
jimmyx
Question about Login through user.php
  • 2010/6/26 16:19

  • jimmyx

  • Quite a regular

  • Posts: 338

  • Since: 2007/7/18


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

https://xoops.org/modules/newbb/viewtopic.php?post_id=267949#forumpost267949

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

2
mboyden
Re: Question about Login through user.php
  • 2010/6/26 20:18

  • mboyden

  • Moderator

  • Posts: 484

  • Since: 2005/3/9 1


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

3
Catzwolf
Re: Question about Login through user.php
  • 2010/6/27 10:08

  • Catzwolf

  • Home away from home

  • Posts: 1392

  • Since: 2007/9/30


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

4
Mazarin
Re: Question about Login through user.php
  • 2010/9/30 18:46

  • Mazarin

  • Just can't stay away

  • Posts: 533

  • Since: 2008/12/10


Thanks John. Works perfectly!

5
sabahan
Re: Question about Login through user.php
  • 2011/9/13 11:37

  • sabahan

  • Quite a regular

  • Posts: 317

  • Since: 2006/3/4 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=add&group_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=add&group_id=41586&atid=430840





6
Mamba
Re: Question about Login through user.php
  • 2011/9/13 13:31

  • Mamba

  • Moderator

  • Posts: 11366

  • Since: 2004/4/23


Please make it a feature request. No guarantees that it will be implemented, but at least it will be entered.
Support XOOPS => DONATE
Use 2.5.10 | Docs | Modules | Bugs

7
sabahan
Re: Question about Login through user.php
  • 2011/9/13 14:33

  • sabahan

  • Quite a regular

  • Posts: 317

  • Since: 2006/3/4 5




added here
https://sourceforge.net/tracker/?func=detail&aid=3408682&group_id=41586&atid=430843

8
sabahan
Re: Question about Login through user.php
  • 2011/9/13 14:50

  • sabahan

  • Quite a regular

  • Posts: 317

  • Since: 2006/3/4 5


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

Login

Who's Online

212 user(s) are online (131 user(s) are browsing Support Forums)


Members: 0


Guests: 212


more...

Donat-O-Meter

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

Latest GitHub Commits