2010-09-21 44 views
0

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

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

感谢

回答

0

您可以使用Drupal 6的触发与动作设置此没有太多的编码。首先创建一个动作,这是你可以放置自定义代码的地方,如果你喜欢。然后你可以去管理|网站建设|触发器,并在用户选项卡中可以找到创建帐户的触发器。

没有为写在这里的行动指南:http://drupal.org/node/172152

+0

触发器和行为不会允许问题问什么:“发送注册信息在其他地方”。其他然后通过电子邮件,这不是很灵活。 – berkes 2011-01-16 15:52:31

0

我想通了。我需要寻找“插入”是这样的:

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

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

    } 

} 

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

感谢

+0

所有POSTED信息都应该在$ edit中。 – berkes 2011-01-16 15:53:10

2
/** 
* 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)