How to check if parent variables My login form generated by theme_form() contains a password field, which is generated by theme_password().

My goal is to add certain variable into $variables of theme_password(). But ONLY in case, when parent's form NID == 5.
You can use your theme's template.php to add a theme_password() wrapper to inject your custom vars:

function MYTHEME_password(&amp;$variables) {
  $node = menu_get_object();
  if(isset($node-&gt;nid) &amp;&amp; $node-&gt;nid == 5) { //Check for display on node/5
    //@TODO: Add $variables altercation
  }
  return theme_password($variables);
}