function guestbook_form_entry_form_edit_submit in Guestbook 5.2
Same name and namespace in other branches
- 6.2 guestbook.module \guestbook_form_entry_form_edit_submit()
- 7.2 guestbook.module \guestbook_form_entry_form_edit_submit()
Submit handler for editing guestbook entries.
File
- ./
guestbook.module, line 566
Code
function guestbook_form_entry_form_edit_submit($form_id, $form_values) {
if (_guestbook_access('moderate', $form_values['uid']) && $form_values['submit'] == t('Send') && user_access('moderate own guestbook')) {
if ($form_values['author'] == 0) {
// Post's author is an anonymous user.
db_query("UPDATE {guestbook} SET anonname = '%s', anonemail = '%s', anonwebsite = '%s', message = '%s' WHERE id = %d", $form_values['anonname'], $form_values['anonemail'], $form_values['anonwebsite'], $form_values['message'], $form_values['entry_id']);
}
else {
if ($form_values['author'] > 0) {
// Post's author is a registered user.
db_query("UPDATE {guestbook} SET message = '%s' WHERE id = %d", $form_values['message'], $form_values['entry_id']);
}
}
}
// Notify other modules of the new guestbook entry.
$entry = db_fetch_array(db_query("SELECT * FROM {guestbook} WHERE id = %d", $form_values['entry_id']));
module_invoke_all('guestbook', 'update', $entry);
return 'guestbook/' . $form_values['uid'];
}