Firefox PHP

New hook "admin_post"?

Posted by rassy 
New hook "admin_post"?
August 30, 2011 01:54PM
Hi,

I hope this is the correct place for my request.

I wrote a module to integrate Phorum (version 5.2.16) with our web application. It turned out that I needed another hook at the end of admin.php, right before ob_end_flush:

Language: PHP
if($module!="help") include_once "./include/admin/footer.php"; phorum_hook( "admin_post" ); // <-- New hook ob_end_flush();

Works fine.

I could live with the need to add the hook each time Phorum is installed (I can do it automatically with a simple sed command). However, I would ask if you could add it to the official Phorum distribution. It's only one line of code, doesn't bother the system, and might be useful for other users.

Best regards
Tilman Rassy
Re: New hook "admin_post"?
August 30, 2011 02:38PM
whats the use case for that?


Thomas Seifert
Phorum Development Team / Mysnip-Solutions.de
Custom Phorum and general software development
worry-free Phorum Hosting
Re: New hook "admin_post"?
August 30, 2011 04:12PM
Hi,

Quote
Thomas Seifert
whats the use case for that?

I need to set some custom response headers to control the synchronization with our webapp. Main purpose is to login the user automatically if necessary. The hook function is as follows:

Language: PHP
function phorum_mod_mumie_admin_post () { header("X-Phorum-Mumie: true"); header("X-Phorum-Mumie-Admin: true");   if ( isset($GLOBALS["PHORUM"]["user"]) && $GLOBALS["PHORUM"]["user"]["admin"] ) { header("X-Phorum-Mumie-Loggedin: true"); } }

Best regards
Tilman
Re: New hook "admin_post"?
August 30, 2011 04:27PM
Why would you add that to the very end of your page generation? That makes it mandatory to do ob_start() in the beginning. I would add headers like these from within some early hook instead, somewhere after the authentication / session stage.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: New hook "admin_post"?
August 31, 2011 10:24AM
Hi,

Quote
Maurice Makaay
Why would you add that to the very end of your page generation? That makes it mandatory to do ob_start() in the beginning. I would add headers like these from within some early hook instead, somewhere after the authentication / session stage.

I tried this, but couldn't find a suitable hook. To set the X-Phorum-Mumie-Loggedin header correctly, the hook must be called after the execution of the module, because the module might login/logout the user.

But I'm new to Phorum, and perhaps I overlooked something?

Thanks and best regards,
Tilman
Sorry, only registered users may post in this forum.

Click here to login