Hi,

i was wondering if it is possible to just login / register without being redirect to my profile ? I just want to reload the page so it says "Welcome: john" ?

Thx in advance !

Comments

aaronl’s picture

I was wondering the same thing, whenever the "Ajax plugin - disable_redirect " is enabled, the login doesnt work
advise? Thanks!!

toyowheelin’s picture

I just ran into this issue as well, how can I simply login with no redirect?

Rowan Gray’s picture

I'm having the same problem, I tried to solve this with a redirect action on the login trigger, but this causes the AJAX to fail (the login still succeeds but the window doesn't close and no redirect, the ajax error message pops up)

jghyde’s picture

This technique here http://drupal.org/node/574078#comment-2806610 works for remaining on the same page after logout. Tested and compliant logout-stay-on-same-page with ajax_register. I haven't solved the problem of how to stay on the same page after login.

Joe Hyde
http://www.hydeinteractive.com/

SphereOfSilence’s picture

Version: 6.x-1.4 » 6.x-2.x-dev

Same issue here - anyone managed to solve this?

SphereOfSilence’s picture

Found a way ... sort of.

Using logging in as an example: The idea is to store the uri of the page calling the ajax login, in session variable. Then retrieve this uri at the form alter function, replacing action path of login form. This will ensure that the form submission leads to the calling page's uri, instead of the ajax login/register popup's uri.

Here's how I did it:

1) Include this lines of code in your page.tpl.php:

	global $user;
	if ($user->uid == 0) {
		$_SESSION['previous_uri'] = url($_GET['q'], array('query' => drupal_get_destination()));
	}

2. Include the following line right after line 74 of ajax_register.module:

$form['#action'] = $_SESSION['previous_uri'];

This gets the job done for me. I'm not sure if this has any drawbacks though. Anyone has any better ideas, I'm all ears.

BManuel’s picture

I get error with your code

I placed the code as the first line of page.tpl
and inserted the module code after
if ($form_id == 'user_login') {
//Set form to work with ajax
$form['#ajax'] = array(
'enabled' => TRUE
);
But I get an error when I try to login. pop up error.
what I my doing wrong?
thanks

jghyde’s picture

Title: Just the login without redirect possible ? » Just the login without redirect possible ? Yes!

Here's another module to consider.

This is based loosely on the Ajax_Register module, except that instead of using Thickbox (which appears to no longer be a supported JQuery thing), it uses JQuery_UI's dialog plugin and Modal Frame API.

It stays on the same page after submitting the "log in" button and does the same for user/register too.

http://drupal.org/node/845218

mattwmc’s picture

I get an error as well: "ajax.module: An unknown error has occurred."

Is this the correct spot in the mod?

function ajax_register_form_alter(&$form, $form_state, $form_id) {
  if ($form_id == 'user_login') {
  //Set form to work with ajax
  $form['#ajax'] = array(
  'enabled' => TRUE
  );
  $form['#action'] = $_SESSION['previous_uri'];
  }
Berliner-dupe’s picture

Have the same error when i make this from #6

"ajax.module: An unknown error has accurred"

Have anyone an other idea how can i disable the redirect to own profile?

MrMaksimize’s picture

Might be a little late judging by the dates, but i found an answer in a different thread. check this out:

I'm bootstrapping the block in the template file, and I changed this function:

function theme_user_login_link($attributes, $query){
$attributes['class'] = $attributes['class'].' thickbox';
$query = drupal_get_destination();
$login_uri = l(t('Login'), 'ajax_register/login',array('attributes'=>$attributes, 'query'=>$query));
return $login_uri;
}

$query = drupal_get_destination(); will redirect you back to the node where you started.