Override argument passed by URL I think I must be missing something basic. I have a template that is usually called via a URL but I also want to be able to call it manually using theme()

/**
 * Implements hook_menu().
 */
function signup_menu() {
  $items = array();

  $items['list/signup/success/%'] = array(
    'title' =&gt; 'Sign-up Successful',
    'page callback' =&gt; 'theme',
    'page arguments' =&gt; array(3),
    'page arguments' =&gt; array('signup_success'),
  );

  return $items;
}

/**
 * Implements hook_theme().
 */
function signup_theme() {
  return array(
      'signup_success' =&gt; array(
      'arguments' =&gt; array('node' =&gt; NULL),
      'template' =&gt; 'signup-success',
    )
  );
}

function signup_preprocess_signup_success(&amp;$variables) {
  $signup = signup_record(arg(3));
  $variables['signup'] = $signup;
}


How do I override the argument that is usually passed through the URL? So I can call it like this:

theme('signup_success', $signup-id);


The preprocess function only ever takes the argument that comes from the current URL which is incorrect.
Definitely you will have to change your preprocess hook to replace arg(3) that is hard coding it in an aspect and definitely not make it suitable for manual call.

Can you please investigate $variables for the value being passed as argument to theme()? I hope you will get it there.