开发者

Drupal hook_user switch for registration and submit

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开发者_JS百科'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


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


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


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜