function xmlsitemap_node_set_priority in XML sitemap 6
Set the node priority in the sitemap.
Parameters
$node: The node object, or the node ID.
$priority: The priority for the node.
Return value
The node object, or FALSE.
1 call to xmlsitemap_node_set_priority()
- _xmlsitemap_node_batch_process in xmlsitemap_node/
xmlsitemap_node.module - Node operations batch process callback.
File
- xmlsitemap_node/
xmlsitemap_node.module, line 382 - Adds nodes to the sitemap.
Code
function xmlsitemap_node_set_priority($node, $priority) {
if (!is_numeric($node)) {
$node = (object) $node;
$nid = $node->nid;
}
else {
$nid = $node;
$node = node_load($nid);
}
if ($node) {
$result = db_fetch_object(db_query("SELECT nid, changed, previously_changed, comment_ratio, priority_override\n FROM {xmlsitemap_node}\n WHERE nid = %d", $nid));
if ($result === FALSE) {
$row = new stdClass();
$row->nid = $nid;
$row->changed = $node->changed;
$row->previously_changed = $node->created;
}
else {
$row = $result;
if ($node->changed > $row->changed) {
$row->previously_changed = $row->changed;
$row->changed = $node->changed;
}
}
$row->priority_override = $priority;
drupal_write_record('xmlsitemap_node', $row, $result === FALSE ? NULL : 'nid');
return $node;
}
return FALSE;
}