User module functions undefined in custom module I am attempting to use the user_password() and user_save() functions from user.module in my custom module file, but I only receive the following:


  Fatal error: Call to undefined function user_save() C:\xampp\htdocs\drupal-7.38\sites\all\modules\(modulename)\(modulename).module on line 1037


I get a similar error if I comment out all of my code, leaving the module file as

&lt;?php
user_save();


As far as I know, if the only problem was the lack of parameters, it chould be an entirely different error, not 'Call to undefined function'. 

The function in which I'm trying to use user_password() and user_save() is as follows:

function create_user_by_id($id){
    $password = user_password(8);
    $info = soap_info($id);
    $fields = array(
        'name' =&gt; $id,
        'mail' =&gt; $info['mail'],
        'pass' =&gt; $password,
        'status' =&gt; 1,
        'init' =&gt; 'email address',
        'roles' =&gt; array(
            DRUPAL_AUTHENTICATED_ROLE =&gt; 'cas authenticated user'
        )
    );
    $account = user_save('', $fields);
    drupal_mail(
        'user', 
        'register_no_approval_required', 
        $info['mail'], 
        NULL, 
        array('account' =&gt; $account), 
        variable_get('site_mail', 'noreply@example.com'));
}
So you are just calling a function without telling drupal how to access that function , you can tell drupal about where to find this function using this code :

 module_load_include('module', 'user', 'user.module');