php generated URL link I have a menu link that is a link to another client site. This uses a single-sign-on. The users info(in Drupal) is sent via SOAP to create a URL with a authenticated ticket for them to use to login. The ticket is a one use ticket. I can't figure out where to implement this,  I feel like this is something that needs to be done between jquery and hook_menu maybe? The problem is that this SOAP code needs to be called every time a user clicks this link.

Anyone have any suggestions? I'm using drupal 7.

thanks
-fw
I'm not sure jQuery is really necessary here. 

If I've understood you right you could have your link pointing to a path with a menu callback which requests your token via SOAP, and then simply forwards the user on to a URL containing that token as a parameter

function MYMODULE_menu() {
  $items['goto-other-site'] = array(
    'title' =&gt; 'Forwarder',
    'type' =&gt; MENU_CALLBACK,
    'page callback' =&gt; 'MYMODULE_forwarder',
    'access arguments' =&gt; array('some permission')
  );

  return $items;
}

function MYMODULE_forwarder() {
  $token = MYMODULE_function_to_generate_token();

  if (!$token) {
    return 'An error occurred.';
  }

  // Add a query string containing the token.
  $options = array(
    'query' =&gt; array(
      'auth_token' =&gt; $token
    )
  );

  $url = 'http://other-site.com/';
  drupal_goto($url, $options);
}


Apologies if I've got the wrong end of the stick here.

UPDATE

Just a bit more to address your comments:

You can use hook_menu() to place each link in a specific menu in the system by using the menu_name key like so:

function MYMODULE_menu() {
  $items['goto-other-site'] = array(
    'title' =&gt; 'Forwarder',
    'type' =&gt; MENU_CALLBACK,
    'page callback' =&gt; 'MYMODULE_forwarder',
    'access arguments' =&gt; array('some permission'),
    'menu_name' =&gt; 'main-menu',
    'weight' =&gt; -10
  );

  return $items;
}


The weight key describes where in relation to other menu items this link should sit in the menu (a lower number means earlier in the list). When you add a menu link in this manner it will be automatically added to the correct menu so you don't need to add a custom link through the UI (you can delete the one you've already made).

Have a quick read of the Module developers guide to get familiar with that side of things, in this case you're only going to need a .info and .module file.

Hope that helps