Passing in URL parameters to menu callbacks I implemented hook_menu() to create a new path called 'user-login'. The page callback function receives url parameters like $_GET['parameter']; however, when I go to http://site.com/user-login?parameter=test, I get a 404 error. How should I implement hook_menu() to get this working?

This is the code I'm using

/**
 * Implementation of hook_menu()
 */
function login_menu() {
  //$items = array();

  $items['user-login'] = array(
    'title' =&gt; 'External login',
    'page callback' =&gt; 'user_login_callback',
    'access arguments' =&gt; array('access content'),
    'type' =&gt; MENU_CALLBACK,
  );

  return $items;
}

function user_login_callback() {

  // Get the URL params
  $uid = urldecode($_GET['uid']);
  $expiry = urldecode($_GET['expiry']);
  $provided_hash = urldecode($_GET['hash']);  

}


Page would be called like http://site.com/user-login?uid=2?expiry=3?hash=sd7wdah
The drupal menu system does not care about $_GET arguments, you can do whatever you want with them, it doesn't affect the hook_menu() implementation **.

So, the error lies somewhere else. The result of hook_menu() is stored, it is not called on every page. If you change/add anything in that function, you need to rebuild the menus. The fastest way to do that is using the drush command "drush cc all" or "rebuild menus" in devel.module's Development links block. You can also submit the modules page, though.

** That said, it is much more common to pass arguments through the menu system as additional path arguments. Anything passed after the path will be passed as arguments to your page callback automatically. So calling user-login/2/3/sd7wdah will pass these three arguments to your function as user_login_callback(2, 3, 'sd7wdah'). You can also make these arguments required by specifying the path like this in hook_menu(): user-login/%/%/% and defining the path arguments like this: 'path arguments' =&gt; array(1, 2, 3),. This will make sure that your function can only be called with these three arguments and that they aren't optional.