How to add vocabulary terms to a taxonomy category I'm trying to get my module to install a vocabulary on enable/install but something about adding terms to it isn't working. any idea why this function isn't working?

function _vocabulary_add_items() {
  $vocabulary = taxonomy_vocabulary_machine_name_load('usertype');
  if($vocabulary === TRUE) {
    $terms = array(
        (object) array(
            'vid' =&gt; $vocabulary-&gt;vid,
            'name' =&gt; t('Economy'),
            'description' =&gt; t('Basic user account'),
            'format' =&gt; '', // default
            'weight' =&gt; 0, // default
            'vocabulary_machine_name' =&gt; $vocabulary-&gt;machine_name, // optional
        ),
        (object) array(
            'vid' =&gt; $vocabulary-&gt;vid,
            'name' =&gt; t('Deluxe'),
            'description' =&gt; t('Deluxe user account'),
            'format' =&gt; '', // default
            'weight' =&gt; 0, // default
            'vocabulary_machine_name' =&gt; $vocabulary-&gt;machine_name, // optional            
        ),
        (object) array(
            'vid' =&gt; $vocabulary-&gt;vid,
            'name' =&gt; t('Ultimate'),
            'description' =&gt; t('Ultimate user account'),
            'format' =&gt; '', // default
            'weight' =&gt; 0, // default
            'vocabulary_machine_name' =&gt; $vocabulary-&gt;machine_name, // optional            
        )
    );
    foreach ($terms as $term) {
        taxonomy_term_save($term);
    }
  }
}
taxonomy_vocabulary_machine_name_load() returns an object or FALSE. You're checking for exactly TRUE by using ===.

Any of the following should work (sorted by my preference):

if ($vocabulary) {
if (is_object($vocabulary)) {
if ($vocabulary !== FALSE) {
if ($vocabulary == TRUE) { // only two equal signs here