Support Forum

hooks vs actions

MP Mr Papa
Mr Papa
Member

currently we have some program hooks and call them via this sf_process_hook() method… since we are reinventing most everything else in 5.0, I would like to propose getting rid of our current hook method, killing the hooks file (would need to evaluate each one) and replace them with standard wp do_actions()… we can still pass all the current data and it will be more standard.

of course, anyone with existing hooks will lose compatibility.  we could support both, just add a new do_action() with the process hook, but seems overkill…  would be very simple for users to convert there current hooks to wp actions…

and since 5.0 is a major, major rewrite, I propose we clean the slate and do it right and standard like in wp…

thoughts?

4 Answers

New Answer

YS Yellow Swordfish
Yellow Swordfish
Member

All agreed from my end.

But I still think we should give them a different and unique prefix.

MP Mr Papa
Mr Papa
Member

they all already have sfh_….

at least the hooks… filters do not and we may not want to change since some are already in use…

also, depending on how drastic we want to get, theoretically, we should change all the sf_ stuff to sp_ SurprisedLaugh

but not sure I want to change stuff just to change…

YS Yellow Swordfish
Yellow Swordfish
Member

No – I agree we don't want to change everything and functions, file names, db tables etc., should retain their current naming convention. I just thought it important and useful to name 'filters' and 'actions' in unique ways. And I agree this should start with V5. And I think renaming the small few we have is tolerable.

This is something WP does not do which often leads to filters and hooks beng somewhat obscure in their meaning or use.

It may have been my own suggestion (?) but 'sfh' is a bit ugly. perhaps going for something like 'sf_filter_' and 'sf_action_' would be cleaner and much more appropriate? I would happily change the names of our current sf-filters.php functions to accommodate somethinbg like that…

MP Mr Papa
Mr Papa
Member

lol. thats what I thought about sfh too, but I just went with your suggestion Wink

sf_filter and sf_action, though some will get quite long, work for me too…