function nodeorder_term_can_be_ordered in Node Order 6
Same name and namespace in other branches
- 7 nodeorder.module \nodeorder_term_can_be_ordered()
Returns TRUE if the term is in an orderable vocabulary...
1 call to nodeorder_term_can_be_ordered()
- nodeorder_order_access in ./
nodeorder.module - Custom access function which determines whether or not the user is allowed to reorder nodes and if the link should be shown at all
File
- ./
nodeorder.module, line 653 - Nodeorder module.
Code
function nodeorder_term_can_be_ordered($tid) {
$cid = 'nodeorder:term_can_be_ordered:' . $tid;
if (($cache = cache_get($cid)) && !empty($cache->data)) {
return $cache->data;
}
else {
$sql = "SELECT vid FROM {term_data} WHERE tid = %d";
$vid = db_result(db_query($sql, $tid));
$sql = "SELECT * FROM {vocabulary} WHERE module = 'nodeorder' AND vid = %d";
$result = db_query($sql, $vid);
$term_can_be_ordered = FALSE;
if (db_fetch_object($result)) {
$term_can_be_ordered = TRUE;
}
//permanently cache the value for easy reuse
cache_set($cid, $term_can_be_ordered, 'cache');
return $term_can_be_ordered;
}
}