2010-09-21 41 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)