1

I am new to drupal. When user register into my website I need to get the users details and passed to a thirty for server . I am trying the following hook,

function compass_preprocess_user_insert(&$edit, $account, $category) {
  db_insert('test')
    ->fields(array(
      'accountid' => $account->uid,
    ))
    ->execute();
}

here compass-my theme name Please help me...

1 Answer 1

2

hook_user_insert() can only be implemented in a module, not a theme. Themes are just for styling/marking up content that modules produce, they shouldn't contain advanced logic like that.

You'll need to add a custom module and implement the hook in there to continue.

3
  • Thank you for the reply ..let me try it !!! so if i create a module like custom then i need to call hook as custom_user_insert()...is that correct?
    – Kabali007
    May 10, 2016 at 9:33
  • exactly - whatever the machine name of your module is, that's the prefix for the hook. So if the module's .info file is "foo.module", your hook names will be prefixed by foo_
    – Clive
    May 10, 2016 at 9:38
  • Its working!!!!
    – Kabali007
    May 10, 2016 at 9:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.