3.10. Request initialization

3.10.1. parse_request

This hook gives modules a chance to tweak the request environment, before Phorum parses and handles the request data. For tweaking the request environment, some of the options are:

  • Changing the value of $_REQUEST["forum_id"] to override the used forum_id.
  • Changing the value of $_SERVER["QUERY_STRING"] or setting the global override variable $PHORUM_CUSTOM_QUERY_STRING to feed Phorum a different query string than the one provided by the webserver.

Tweaking the request data should result in data that Phorum can handle.

Call time:

Right before Phorum runs the request parsing code in common.php.

Hook input:

No input.

Hook output:

No output.

Example code:

function phorum_mod_foo_parse_request()
{
    // Override the query string.
    global $PHORUM_CUSTOM_QUERY_STRING
    $PHORUM_CUSTOM_QUERY_STRING = "1,some,phorum,query=string";

    // Override the forum_id.
    $_SERVER['forum_id'] = "1234";
}