Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: Adding an action for specific articles
Bloke wrote #330618:
Hooking into pre=1 means your plugin gets processed first before Textpattern gets involved. So if you pass a new step in, you can check it in your code, handle it and then either let Txp carry on, or just output the panel with your success/failure message and quit.
Unfortunately, article
event handles only four possible steps. If you try something like ?event=article&step=blah
, you’ll get just a link to txp website. No pluggable_ui
neither other callbacks will be processed, whence the necessity to reset global $step
to a standard value, to let txp carry on.
Offline
Re: Adding an action for specific articles
etc wrote #330619:
Unfortunately,
article
event handles only four possible steps.
Ugh, yeah. That panel bootstrapping code is yucky. *sigh*
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
#15 2021-06-23 10:11:04
- albatros69
- Member
- Registered: 2021-06-17
- Posts: 21
Re: Adding an action for specific articles
albatros69 wrote #330616:
I’m still trying to workout something, by piggybacking on the save process, to have something more standard and thus more maintainable.
While progressing on this, I’m banging my head over a certainly stupid issue with the “article_saved” callback. I can’t get my function being hit when I click on the “Save” button. I’ve tried to reproduce it with a minimal example:
if (txpinterface == 'admin') {
register_callback('mgo_foobar', 'article_saved');
}
//callback_event('article_saved', '', 0, 'foobar');
function mgo_foobar($event, $step, $rs) {
echo "<!--", $rs, "-->";
return;
}
Calling the callback_event myself is successful, but nothing happens when I save an article. There is no trace of the ‘article_saved’ callback event being triggered in the debugging logs.
What am I missing?
Last edited by albatros69 (2021-06-24 08:46:36)
Offline
Re: Adding an action for specific articles
Check the plugin type? Should be Admin+AJAX
, imo.
Offline
#17 2021-06-23 12:20:14
- albatros69
- Member
- Registered: 2021-06-17
- Posts: 21
Re: Adding an action for specific articles
etc wrote #330629:
Check the plugin type? Should be
Admin+AJAX
, imo.
That was the culprit… Sorry to have overlooked that :-(
Last edited by albatros69 (2021-06-23 12:20:28)
Offline
Offline