module's local *.tpl.php, defined in $theme_registry, "not found or invalid" when referenced later in module I built a custom login module for my Drupal7.26 install.

Extending it, I've added a *.tpl.php locally

ls sites/all/modules/custom/jl_login/templates/
    user-login-member-form.tpl.php


To get the tpl.php into theme registry, in "my_login_mod.module" I added

function jl_login_theme() {
    return array(
        'user_login_member_form' =&gt; array(
            'render element' =&gt; 'form',
            'template' =&gt; 'templates/user-login-member-form',
        )
    );
}


After module  disable/uninstall/enable, and clear all caches, I load my site/page.

Checking output with

&lt;?php print '&lt;pre&gt;'; var_dump(theme_get_registry()); print '&lt;/pre&gt;'; ?&gt;


I see the form in the registry

 ["user_login_member_form"]=&gt;
  array(6) {
    ["render element"]=&gt;
    string(4) "form"
    ["template"]=&gt;
    string(76) "sites/all/modules/custom/jl_login/templates/user-login-member-form"
    ["type"]=&gt;
    string(6) "module"
    ["theme path"]=&gt;
    string(43) "sites/all/modules/custom/jl_login"
    ["preprocess functions"]=&gt;
    array(1) {
      [0]=&gt;
      string(19) "template_preprocess"
    }
    ["process functions"]=&gt;
    array(2) {
      [0]=&gt;
      string(16) "template_process"
      [1]=&gt;
      string(14) "ctools_process"
    }
  }


Later in my .module, I use the form:

function _jl_login_login_block_view($delta='') {
    $this_user_login_form    = drupal_get_form('user_login_member_form');
    ...


But on load I see in drupal logs,

Feb 24 16:32:16 dev d7: http://dev.loc|1393288336|php|127.0.0.1|http://dev.loc/||0||Notice: Undefined index: user_login_member_form in drupal_retrieve_form() (line 771 of /home/jl/d7/includes/form.inc).
Feb 24 16:32:16 dev d7: http://dev.loc|1393288336|php|127.0.0.1|http://dev.loc/||0||Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'user_login_member_form' not found or invalid function name in drupal_retrieve_form() (line 806 of /home/jl/d7/includes/form.inc).


What do I need to change to be able to use/reference the local form?
drupal_get_form() expects the name of a function that builds a form array, e.g.

function MYMODULE_some_form($form, &amp;$form_state) {
  $form['#theme'] = 'user_login_member_form';

  $form['foo'] = array(
    '#type' =&gt; 'textfield',
    '#title' =&gt; t('Bar'),
    '#default_value' =&gt; t('Baz'),
  );

  $form['submit'] = array(
    '#type' =&gt; 'submit',
    '#value' =&gt; t('Submit'),
  );

  return $form;
}

function MYMODULE_some_form_submit($form, &amp;$form_state) {
  // Process $form_state['values']
}

// In a hook...
$form = drupal_get_form('MYMODULE_some_form');


You don't need to add the form function to a registry as such, just giving it the same name as the string you pass to drupal_get_form() is enough.

hook_theme() is for registering theme functions, which is why you're currently getting an error.

The Form generation docs have a bit more information, and the FAPI reference is invaluable if you're new to the form API. For theming the form, there are some excellent answers to this question which should help.