function certificate_node_update in Certificate 3.x
Same name and namespace in other branches
- 8.3 certificate.module \certificate_node_update()
- 7.3 certificate.module \certificate_node_update()
- 7.2 certificate.module \certificate_node_update()
Implementation of hook_node_update().
1 call to certificate_node_update()
- certificate_node_insert in ./
certificate.module - Implementation of hook_node_insert().
File
- ./
certificate.module, line 360 - Certificate module.
Code
function certificate_node_update($node) {
if (certificate_node_is_certifiable($node)) {
//** @kludge two update points here */
// Update node mappings from a certifiable activity.
if (!empty($node->certificate['map'])) {
// Update from a node form.
certificate_update_node_mappings($node->nid, $node->certificate['map']);
}
else {
if (!empty($node->certificate['node_settings'])) {
// Update programmatically.
certificate_update_node_mappings($node->nid, $node->certificate['node_settings']);
}
}
}
if ($node->type == 'certificate') {
// Save the certificate settings.
if (isset($node->certificate)) {
$record = $node->certificate;
$record['nid'] = $node->nid;
$keys = db_query("SELECT 1 FROM {certificate_node_settings} WHERE nid = :nid", array(
':nid' => $node->nid,
))
->fetchField() ? array(
'nid',
) : array();
drupal_write_record('certificate_node_settings', $record, $keys);
}
}
}