Community Documentation

Main content-related hooks

Last updated February 19, 2008. Created by pwolanin on January 23, 2007.
Edited by ax, add1sun, webchick, fgm. Log in to edit this page.

This table shows how many of the hooks related to content in all its forms fit together, in terms of high-level operations.

When Performing user comment node type term / vocabulary node
When Performing user comment node type term / vocabulary node
before create hook_user('register') hook_access('create')
during hook_user('insert')

-
-

hook_comment('insert')
-
-
hook_node_type('insert')

-
-

hook_taxonomy('insert')
-
-
hook_insert()

hook_nodeapi('insert')
hook_node_access_records()

after load hook_user'('load') hook_load()
hook_nodeapi('load')
before update -

hook_profile_alter()
-
hook_user('submit')
hook_user('validate')
-

-
-

-
-
hook_comment('validate')
-

hook_access('update')

-
hook_submit
hook_nodeapi('submit')
hook_validate()
hook_nodeapi('validate')

during hook_user('update')
-
hook_comment('update')
-
hook_node_type('update')
-
hook_taxonomy('update')
-
hook_update
hook_nodeapi('update')
after hook_user('after_update')
before delete -
hook_user('delete')
-
-
hook_comment('delete')
-
-
hook_node_type('delete')
-
-
hook_taxonomy('delete')
-
hook_access('delete')
hook_delete()
hook_nodeapi('delete')
during delete revision hook_nodeapi('delete revision')
before edit -
-
hook_user('form')
-
-
-

hook_comment('form')
-

hook_prepare()
hook_nodeapi('prepare')
hook_form()

[hook_form_alter()]

before view -
hook_user('view')
-
-
-
hook_comment('view')

-
-

hook_access('view')
hook_view()
hook_nodeapi('view')

hook_nodeapi('alter')

before print hook_nodeapi('print')
during indexing hook_nodeapi('update index')
before view as search result
(hook_search_item
exists)
hook_nodeapi('search result')
hook_user('categories')
during set active hook_user('login')
hook_auth()
hook_comment('publish') could be hook_update() and hook_nodeapi('update')
during set inactive hook_user('logout') hook_comment('unpublish') could be hook_update() and hook_nodeapi('update')
during feed generation hook_nodeapi('rss item')
as comment_nodeapi
hook_nodeapi('rss item')

Many hooks are not listed: only those related to a typical create/retrieve/update/delete workflow. For details on the hooks, refer to the API site.

Comments

some mistakes

  • hook_validate and hook_submit are missing at before-creation - node.
  • The order is wrong in before-update - node. The right is hook_validate -> hook_nodeapi('validate') -> hook_submit -> hook_nodeapi('submit').

A much needed resource!

--
Amr Mostafa (aka “alienbrain”)

nobody click here