After login redirect to the previous page in drupal
After login redirect to the previous page in drupal
drupal_goto( 'user/login',drupal_get_destination() );
if you want to set destination from URL then
set destination of the current page
$dest= drupal_get_destination();
<a href="<?php print get_base_url()?>/user/login?<?php echo $dest; ?>"> // login
<a href="<?php print get_base_url()?>/user/register?<?php echo $dest; ?>" //register
and change $form_state[‘redirect’] in core user module, in the function user_login_submit() and user_register_submit()
#and change
if(isset($_GET[‘destination’]) && !empty($_GET[‘destination’]))
$dest = $_GET[‘destination’];
else
$dest = ‘home’;
$form_state[‘redirect’] = $dest;
or just
$dest = $_GET[‘destination’];
$form_state[‘redirect’] = $dest;
in user_register_submit() set this code under Registration successful and Your password and further instructions have been sent to your e-mail address messages.

Post a Comment