[development] hook_view() is called before hook_nodeapi()

Dmitry Gukov ultraboy at mail.ru
Sat May 20 12:34:15 UTC 2006


Hello, everybody!

I faced this problem when developing signature.module.
The module appends user's signature dynamically nodes and comments.
So, I think a signature should be added to the end of a body.
The problem is at least with forum.module, which adds
"next-topic-link" before a signature. (This is not OK to have
signature after "next-topic-link".). This is because hook_view() is called before
hook_nodeapi().

Normally, if "next-topic-link" was in hook_nodeapi, I could decrease
my module's weight, so it would fix it. But it's in hook_view.

The solution I found is to add signature at hook_hodeapi(when $op ==
'view'), but then of course, signature is added to the body when
editing the node, what is not good since it is already added
dynamically. I can remove it when $op == 'preprocessing', but it's
a 'dirty fix'.

And please let me know what you think about my variant.
May be someone can suggest a better implementation?

P.S. I posted it here, because I believe it's a question for 'gurus'.

Dmitry



More information about the development mailing list