function clear_shout in Heartbeat 6.4
Same name and namespace in other branches
- 6.3 modules/shouts/shouts.module \clear_shout()
Clear the latest shout from a user.
File
- modules/
shouts/ shouts.module, line 357 - Gives the possibility to the user to shout a message.
Code
function clear_shout() {
global $user;
$result = db_query("UPDATE {shouts} SET cleared = 1 WHERE uid = %d ORDER BY shout_id DESC LIMIT 1", $user->uid);
// if destination is set, there was a javascript error. Redirect to destination
if (isset($_GET['destination'])) {
drupal_goto();
}
if ($result) {
drupal_json(array(
'status' => TRUE,
'data' => theme_shoutform_message(t('Post new shout'), false, true),
));
}
else {
drupal_json(array(
'status' => FALSE,
'data' => theme_shoutform_message(t('Error while clearing shout.'), false, true),
));
}
exit;
}