Skip to main content
Topic: Inconsistent Hook Names (Read 1405 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Inconsistent Hook Names

Not really a bug, but consistency is good.  In Post.subs.php createPost()

integrate_create_post <= Just before a post is created
integrate_after_create_post <= Just after a post is created.

integrate_before_create_topic <= Equivalent to integrate_create_post, but this one gets a before
integrate_create_topic <= Equivalent to integrate_after_create_post, but looks like integrate_create_post

There's also two integrate_modify which I believe are equivalent to integrate_create_post, so it's probably the topic ones that maybe should be renamed.

Re: Inconsistent Hook Names

Reply #1
Not really a bug, but consistency is good.  In Post.subs.php createPost()
True, consistency is good.

integrate_create_post <= Just before a post is created
integrate_after_create_post <= Just after a post is created.

integrate_before_create_topic <= Equivalent to integrate_create_post, but this one gets a before
integrate_create_topic <= Equivalent to integrate_after_create_post, but looks like integrate_create_post
I'd say:
Code: [Select]
integrate_create_post => integrate_before_create_post
integrate_after_create_post => integrate_create_post
So that the scheme is the same?

There's also two integrate_modify which I believe are equivalent to integrate_create_post, so it's probably the topic ones that maybe should be renamed.
Yes and no.
integrate_before_create_topic and integrate_modify_topic could be the same (even though there are differences on the kind of data passed), while integrate_modify_post and integrate_create_post are slightly different even in the parameters passed (create has one more).
It may be worth harmonize the parameters order in all these hooks...?
Bugs creator.
Features destroyer.
Template killer.

Re: Inconsistent Hook Names

Reply #2
By the two modify ones being equivalent to create_post I meant that they both happened before the modify did, giving you a chance to change things (exactly what I needed).  So they would be integrate_before_modify_xxx if you go with your proposed naming.  I'd be fine with that.