drupal ajax登录返回用户ID

发布于 2024-10-07 09:01:41 字数 379 浏览 0 评论 0原文

我正在为 drupal 6 制作一个关于用户登录的 ajax 模块。

我需要

  1. 在用户登录表单上禁用重定向(我知道我需要在此表单上进行表单更改: http://api.drupal.org/api/drupal/modules--user--user.module/function/user_login/6 但是什么以及如何?)
  2. 返回包含成功/失败和用户 UID 的 json 响应。

知道我该怎么做吗?

谢谢。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

喜爱纠缠 2024-10-14 09:01:41

您可以从 ajax_register 模块ajax 模块 并自定义它。

或者您为此目的创建自己的模块。您必须实施 hook_form_user_login_form_alter,根据需要更改表单,添加一些 Javascript 并编写一个回调函数来调用 user_login_submit() 并发送 JSON 响应。

我强烈建议使用现有的模块。可能不止上面提到的两个。尝试搜索“drupal login ajax”。

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文