0
votes

I'm making an ajax module for drupal 6 in regards to user login.

I need to

  1. disable redirect on the user login form (I know I need to do a form alter on this form: http://api.drupal.org/api/drupal/modules--user--user.module/function/user_login/6 but what and how?)
  2. get back a json response containing the success/fail and the user's UID.

Any idea how I do this?

Thanks.

1

1 Answers

1
votes

You could start with ajax_register module or ajax module and customize it.

Or you create your own module for that purpose. You'd have to implement hook_form_user_login_form_alter, alter the form as needed, add some Javascript and write a callback function that calls user_login_submit() and sends a JSON response.

I strongly recommend to use an existing module. There might be more than the two mentioned above. Try searching for "drupal login ajax".