Welcome Guest, Not a member yet? Register   Sign In
[Solved]redirect and post-controller/post-system hook
#1

[eluser]rogierb[/eluser]
Hi All,

This on got me baffled.
I've got a post-controller hook that checks for certain database entries.
So it checks for updates and inserts using the queries array from the DB object ($this->db->queries).

In all of my controllers I use a save method that redirects to some page after a succesfull save.
The post-controller and post-sytem hooks dont get fired because of the redirect() function.
If I remove the redirect()the hooks are fired.

So how do I fire the post-controller even with a redirect?

I need this to replace a very ugly hack done in the mysql driver so I can upgrade from 1.5.4 to something less ancient :-)

Is there some way to overload/overrride the default redirect function?(Without copying the helper to the application folder)
#2

[eluser]Jamie Rumbelow[/eluser]
The short answer is: you can't. The redirect() method automatically calls exit; and terminates the script, thus skipping all your hooks. One solution is to overwrite the url_helper.php and adding a custom redirect method that fixes the issue you're having.

Jamie
#3

[eluser]rogierb[/eluser]
yeah, that's what I thought... Well, to bad, I've written a custom redirect to execute the post-controller hook before redirecting.

Thanx Jamie!




Theme © iAndrew 2016 - Forum software by © MyBB