You are here

function clear_shout in Heartbeat 6.3

Same name and namespace in other branches
  1. 6.4 modules/shouts/shouts.module \clear_shout()

Clear the latest shout from a user.

1 string reference to 'clear_shout'
shouts_menu in modules/shouts/shouts.module
Implementation of hook_menu().

File

modules/shouts/shouts.module, line 263
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 shout'), false, true),
    ));
  }
  else {
    drupal_json(array(
      'status' => FALSE,
      'data' => theme_shoutform_message(t('Error while clearing shout.'), false, true),
    ));
  }
}