Invision Community 4: SEO, prepare for v5 and dormant account notifications Matt November 11, 2024Nov 11
Posted March 16, 20196 yr 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?
March 18, 20196 yr 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.
Archived
This topic is now archived and is closed to further replies.