Firefox PHP

PM form custom actions

Posted by Phil Connolly 
PM form custom actions
February 10, 2010 02:25PM
What would be the recommended hook(s) to use within PMs for handling custom form post actions? I am looking for something similar to the hook posting_custom_action provided for topic posting, but for PM's action processing.

The module I am working on is looking for a place to intercept its own action processing somewhere between initialization tasks and before the PM script's own action processing. I see that Phorum 5.2.15 will add a new hook pm_send_init that appears to be in the right place, however it is tied to core actions initial request, rpct_add, preview, posting. I am not sure how I introduce my own custom action...

Re: PM form custom actions
February 12, 2010 10:03AM
That depends heavily on what you want to do. Me? I am a complete hacker. I often just write a common hook to act on the $_POST data if I want to play with it, redirect it, etc. Now, if you need to act on data that the PM system itself is creating or modifying, that is a different matter.

Brian - Cowboy Ninja Coder - Personal Blog - Twitter
Re: PM form custom actions
February 12, 2010 01:33PM
Yeah I hear you (about hacking away). I got no problem with layering my own hacks on top of the system to make it do what I want, even if it goes against the system's design (i.e., small example here: []). Then again, maybe what I want sometimes isn't necessarily a good idea...

I like having the power for my code to jump into the pipeline anywhere I want, but I try to have the right perspective about it. If I have a specific need met by a specific hook, I would first consider using that and keep my code very specific and written to that hook signature. I figure that is my best chance for having code that survives with future core versions. I am lazy... I don't want to re-write my modules for future Phorum releases.

At any rate, my current case is to just provide a supplemental code action to the PM form, one that doesn't touch core PM data. I can hack into any hook that is called by that page's script. But if I did want to do something to the PM data, something like a pm_custom_action hook would actually be very helpful.


Later Edit:
The more I think about this, the more I give myself permission to hack away. Maybe a bazillion hooks isn't necessarily that good of a thing.... I am looking at my flickr module and can see that a few cases where I can hook into an early function or a common function, like start_output, which allows me to use less hooks. I end up with some conditional code structures in my hook functions, but it is more readable code.

Edited 2 time(s). Last edit at 02/12/2010 02:11PM by Phil Connolly.
Sorry, only registered users may post in this forum.

Click here to login