用于注册和提交的 Drupal hook_user 开关

发布于 2024-09-24 04:53:15 字数 313 浏览 2 评论 0原文

当 Drupal 完成注册时,我需要将注册详细信息发送到其他地方。 我找不到开关的正确变量。我尝试过这个,但它不起作用。该功能位于我的模块“externalnewsletter”中。

function externalnewsletter_user($op, &$edit, &$account, $category = NULL) {
    if ($op == 'register' && $category == 'submit') {
        // do stuff...
    }
}

谢谢

I need to send registration details somewhere else when Drupal completes a registration.
I can't find the correct variables for the switch. I tried this but it's not working. This function is in my module "externalnewsletter".

function externalnewsletter_user($op, &$edit, &$account, $category = NULL) {
    if ($op == 'register' && $category == 'submit') {
        // do stuff...
    }
}

thanks

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

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

发布评论

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

评论(3

多彩岁月 2024-10-01 04:53:16
/**
* A user account was created.
  Try this this function called when user is just created
 * The module should save its custom additions to the user object into the
 * database.
 *
 * @param $edit
 *   The array of form values submitted by the user.
 * @param $account
 *   The user object on which the operation is being performed.
 * @param $category
 *   The active category of user information being edited.
 *
 * @see hook_user_presave()
 * @see hook_user_update()
 */
function hook_user_insert(&$edit, $account, $category) 
/**
* A user account was created.
  Try this this function called when user is just created
 * The module should save its custom additions to the user object into the
 * database.
 *
 * @param $edit
 *   The array of form values submitted by the user.
 * @param $account
 *   The user object on which the operation is being performed.
 * @param $category
 *   The active category of user information being edited.
 *
 * @see hook_user_presave()
 * @see hook_user_update()
 */
function hook_user_insert(&$edit, $account, $category) 
红墙和绿瓦 2024-10-01 04:53:16

您可以使用 Drupal 6 的触发器和操作来进行设置,无需太多编码。首先创建一个操作,如果您愿意,您可以在此处放置自定义代码。然后您可以转到管理|网站建设|触发器,在“用户”选项卡中,您将找到用于创建帐户的触发器。

这里有一个编写操作的指南:http://drupal.org/node/172152

You can use Drupal 6's Triggers and Actions to set this up without much coding. First create an action, this is where you can put your custom code if you like. Then you can go to Administer | Site Building | Triggers, and in the Users tab you will find a trigger for account creation.

There is a guide for writing actions here: http://drupal.org/node/172152

无所谓啦 2024-10-01 04:53:16

我想通了。我需要像这样查找“插入”:

function externalnewsletter_user($op, &$edit, &$account, $category = NULL) {

     // user registration ---------------------->
     if ($op == 'insert') {
         // do stuff...

     }

}

现在的问题是我需要他们在 Drupal 使用 MD5 之前输入的未加密的密码。我需要所有其他 $_POST 变量,因为我向用户配置文件添加了一些字段。当我 print_r($_POST);它只打印“1”。
如何获取 $_POST 变量或以某种方式从表单中获取所有其他变量?

谢谢

I figured it out. I needed to look for the "insert" like this:

function externalnewsletter_user($op, &$edit, &$account, $category = NULL) {

     // user registration ---------------------->
     if ($op == 'insert') {
         // do stuff...

     }

}

The problem now is I need the password they entered unencrypted BEFORE Drupal uses MD5. And I need all the other $_POST vars because I added a few fields to the user profiles. When I print_r($_POST); it just prints "1".
How do I get the $_POST vars or somehow get all the other vars from the form?

thanks

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