function anonymous_publishing_nodeapi in Anonymous Publishing 5
Implementation of hook_node_api().
File
- ./
anonymous_publishing.module, line 206 - Installation file for the anonymous_publishing module.
Code
function anonymous_publishing_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
global $user;
if (anonymous_publishing_content_type_allowed($node->type)) {
switch ($op) {
case 'validate':
// Validate the e-mail address:
if (empty($node->nid) && empty($user->uid) && ($error = user_validate_mail($node->anonymous_publishing['email']))) {
form_set_error('anonymous_publishing][email', $error);
}
break;
case 'submit':
_anonymous_publishing_node_submit($node);
break;
case 'insert':
_anonymous_publishing_node_insert($node);
break;
case 'load':
$node->anonymous_publishing = db_fetch_array(db_query("SELECT * FROM {anonymous_publishing} WHERE nid = %d", $node->nid));
break;
case 'view':
if ($node->anonymous_publishing['anonymous']) {
$node->uid = 0;
$node->name = 'Anonymous-- Change this text';
}
break;
case 'update':
break;
case 'delete':
db_query("DELETE FROM {anonymous_publishing} WHERE nid = %d", $node->nid);
break;
}
}
}