Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
Tom S. Posted March 16, 2019 Posted March 16, 2019 I'm creating a plugin to hook into a function to add some extra functionality. class hook100 extends _HOOK_CLASS_ { protected function someFunc() { $return = parent::clear(); // my code return $return; } } The problem is that when parent::clear(); runs it contains a bunch of \IPS\Output::i()->redirect() Meaning that my code never gets executed as the page leaves before then. Does anyone have any advice how to handle situations like this?
bfarber Posted March 18, 2019 Posted March 18, 2019 If you can run your code first then you can do something like public function something() { // Run my custom code return parent::something(); } If not, then your only real options are: Copy the parent function's code and don't call parent, injecting your code where it needs to run Move your processing somewhere else. For instance, when working with content items there are a lot of callbacks that execute (like postCreate()) that would be a more appropriate place to run code after the item is created.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.