function devel_generate_add_terms

Same name in other branches
  1. 7.x-1.x devel_generate/devel_generate.inc \devel_generate_add_terms()
1 call to devel_generate_add_terms()
devel_generate_nodeapi in ./devel_generate.inc

File

./devel_generate.inc, line 361

Code

function devel_generate_add_terms(&$node) {
    $vocabs = taxonomy_get_vocabularies($node->type);
    foreach ($vocabs as $vocab) {
        $sql = "SELECT tid FROM {term_data} WHERE vid = %d ORDER BY RAND()";
        $result = db_query_range($sql, $vocab->vid, 0, 5);
        while ($row = db_fetch_object($result)) {
            $node->taxonomy[] = $row->tid;
            if (!$vocab->multiple) {
                break;
            }
        }
    }
}