function nodeorder_can_be_ordered in Node Order 6
Same name and namespace in other branches
- 5 nodeorder.module \nodeorder_can_be_ordered()
- 7 nodeorder.module \nodeorder_can_be_ordered()
Returns TRUE if the node has terms in any orderable vocabulary...
1 call to nodeorder_can_be_ordered()
- nodeorder_nodeapi in ./
nodeorder.module - Implementation of hook_nodeapi().
File
- ./
nodeorder.module, line 551 - Nodeorder module.
Code
function nodeorder_can_be_ordered($node) {
$cid = 'nodeorder:can_be_ordered:' . $node->type;
if (($cache = cache_get($cid)) && !empty($cache->data)) {
return $cache->data;
}
else {
$sql = "SELECT v.vid AS vid FROM {vocabulary_node_types} vnt JOIN {vocabulary} v ON vnt.vid = v.vid WHERE vnt.type = '%s' AND v.module = 'nodeorder'";
$result = db_query($sql, $node->type);
$can_be_ordered = FALSE;
if (db_fetch_object($result)) {
$can_be_ordered = TRUE;
}
//permanently cache the value for easy reuse
cache_set($cid, $can_be_ordered, 'cache');
return $can_be_ordered;
}
}