Is it possible to use Fancy Login to login in at a specific page, and STAY on that page, instead of going to the user's account?
My Fancy Login works perfectly well, but it always lands me on my user account profile page, while I need to stay where I login. I am not sure if that is the way the login works, that is, always goes to the user's profile; or is it just me, because of some settings that I personally configure? if that latter is true, how can I set it back (to remain at the page where the user logs in)? Huj
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | fancy_login_no_redirect.patch | 5.2 KB | Muscardinus |
Comments
Comment #1
Muscardinus commentedI had the same idea and I managed to solve it. Here's how I did it:
1) In fancy_login.module replace the content of function fancy_login_form() with the content of user_login_block() from modules/user/user.module and replace the line
'#id' => 'user-login-form',with
'#id' => 'user_login',So the function should look something like this
2) Replace the function fancy_login_get_form() (in fancy_login.module) with
3) In fancy_login.js delete or comment the following line:
$("#fancy_login_login_box form").attr("action", $(this).attr("href"));This works with Fancy Login 6.x-1.1-beta6 and Drupal 6.14
Comment #2
carlwohlforth commentedI'd like to add my voice to the original request to keep the user on the same page he started from after he logs in.
I tried Muscardinus edits but they did not work for me. I got the following error from my blocks list and the fancy login block did not show up anymore.
warning: Invalid argument supplied for foreach() in XXXXXXX/modules/block/block.module on line 248.
Comment #3
MrGeek commentedI love this module, but have basically the same issue - however i use the LoginDestination module. I'll have to stop using Fancy Login for now until it's compatible.
Comment #4
eaflash commentedMy solution is: in fancy_login.module I changed:
function fancy_login_block($op = 'list', $delta = 0, $edit = array())
{
global $user;
if ($op == "list")
{
$block = array();
$block[0]['info'] = t('Fancy Login Link');
return $block;
}
else{if($op == 'view' && !$user->uid && !$user->uid && !(arg(0) == 'user' && !is_numeric(arg(1))))
{ $destination = drupal_get_destination();
$block['subject'] = t('Login');
$block['content'] = l(t('Login'), 'user/login', array('query' => $destination));
return $block;
}
else{ $destination = drupal_get_destination();
$block['content'] = l(t('Log Out'), 'logout', array('query' => $destination));
$block['content'] .= l(t('Profile'), 'user');
return $block;
}
}
}
Comment #5
chawl commentedYes, this is essential.
Anyway, I am not using the block, but constructing simple links in wherever (templates) I want with
and
is just more than enough for now.
EDIT: Hmm, Pressflow 6.15 has problems when logging out, but not when logging in.
Comment #6
jaypanI've refined the code to enable this functionality. In the next release, which will happen in the next day or two, there will be a new setting in the settings page titled: 'Keep User on Same Page'. If this box is checked, the user will not be redirected upon login, and will remain on the same page from which they clicked the login link.
I've taken care of this using a combination of PHP and javascript. If the site is set to 'keep user on same page', the current page URL is then passed to the javascript function for the module. On page load, the module goes through and checks all the links, and if they don't already have a destination set on them, it sets the current page as the destination. This means that any links that already have a destination set on them will take a higher priority than this module.
Comment #7
jaypan