Registering User Programatically with only Email Address My Drupal 7 site utilizes the email_registration and logintobbagan modules. It works fine to register users with just their e-mail address. However, on a separate page I am using a newsletter subscribe form called 'news_subscribe' which is of the following form:

function news_subscribe_form($form, &amp;$form_state) {
    $user = $GLOBALS['user']-&gt;mail;
    $email = "";
    if(!empty($user))
    {
        $email = $user;
    }
    $form['email'] = array(
        '#type' =&gt; 'textfield',
        '#title' =&gt; t('E-mail'),
        '#required' =&gt; TRUE,
        '#default_value' =&gt; $email,
        '#size' =&gt; 20,
        '#maxlength' =&gt; 20,
        '#element_validate' =&gt; array('news_subscribe_email_element_validate'),
    );
    $form['id'] = $id;
    $form['submit_button'] = array(
        '#type' =&gt; 'submit',
        '#value' =&gt; t('Subscribe!'),
    );
  return $form;
}


By default this then submits the data to the drupal databases and saves the values for the given user if they are already registered in our system via hook_form_submit().

function news_subscriptions_form_submit($form, &amp;$form_state) {
    //Get the values
    $email = $form_state['values']['email'];
    $id = $form_state['build_info']['args'][0];
    $uid = $GLOBALS['user']-&gt;uid;

    //Get the database information
    $collection = variable_get('mongo_user_preferences_collection',DEFAULT_USER_PREFERENCES_COLLECTION);
    $savedarrayname = variable_get('mongo_saved_data_array',DEFAULT_SAVED_DATA_ARRAY);

    //Generate the conditions and queries
    $where = array("uid"=&gt;intval($uid));
    $query = array($savedarrayname=&gt;$id);

    //Insert the data into the datbase
    upsertData($where,$query,$collection,$database=NULL);
}


If the user is not currently registered in the system I need to first automatically register them and then retrieve their user id. I know that normally I can use a function such as 

$new_user = array(
  'name' =&gt; 'JohnDoe',
  'mail' =&gt; 'john.doe@email.com',
  'pass' =&gt; 'password123',
  'status' =&gt; 1,
  'field_custom_first_name' =&gt; array(LANGUAGE_NONE =&gt; array(array('value' =&gt; 'John'))),
  'access' =&gt; REQUEST_TIME,
  'roles' =&gt; array(), // No other roles than Authenticated
);
user_save(NULL, $new_user);


However, I want to integrate it with the current setup which requires just an email address, auto generates a password and then sends a mail to the user with a temporary login link where they can change the password. This is the current setup on the user registration form. I have been looking for a hook into the email_registration module but cannot find one. Can anyone provide some insight?

Basically I am trying to register a user from a non-registration form (if they are not already registered). I then need to retrieve their assigned uid which is used in subsequent post-processing.
In your custom submit function you can do the following,

$email_entered = $form_state['values']['email'];

$query = db_select('users', 'u');
$query-&gt;fields('u', array('uid'));
$query-&gt;condition('u.email', $email_entered);
$row_count = $q-&gt;countQuery()-&gt;execute()-&gt;fetchField();

if ($row_count == 0) {
  // User doesn't exist, Save the user.
  $parts = explode("@", $email_entered);
  $account = new stdClass;
  $account-&gt;is_new = TRUE;
  $account-&gt;name = $parts[0];
  $account-&gt;pass = user_hash_password('bar');
  $account-&gt;mail = $email_entered;
  $account-&gt;init = $email_entered;
  $account-&gt;status = TRUE;
  $account-&gt;roles = array(DRUPAL_AUTHENTICATED_RID =&gt; TRUE);
  $account-&gt;timezone = variable_get('date_default_timezone', '');
  user_save($account);
} 
else {
  // User exists.
}


As you can see there is no way that you can get the name of the user so you have to use the email as the username. This will be stored in users.name field. 
You also might want to mail the password to the user.