You are here

function _shoutbox_moderate_shout in Shoutbox 6

Same name and namespace in other branches
  1. 5 shoutbox.module \_shoutbox_moderate_shout()

Update the moderate bit in the database.

Parameters

$shout_id: The shout id of the shout being moderated.

$moderate: The vale to set the moderate bit to. (0 or 1)

Return value

N/A

2 calls to _shoutbox_moderate_shout()
shoutbox_publish_form_submit in ./shoutbox.module
Handle the publish form submission.
shoutbox_unpublish_form_submit in ./shoutbox.module
Handle the unpublish form submission.

File

./shoutbox.module, line 1058
shoutbox module displays a block for users to create short messages for thw whole site. Uses AHAH to update the database and display content.

Code

function _shoutbox_moderate_shout($shout_id, $moderate) {
  if (is_numeric($shout_id) && ($moderate == 0 || $moderate == 1)) {
    if (_shoutbox_user_access('moderate shoutbox')) {
      db_query("UPDATE {shoutbox} set moderate='%d' WHERE shout_id =%d", $moderate, $shout_id);
      if ($moderate == 0) {
        drupal_set_message(t('The shout was published.'));
      }
      else {
        drupal_set_message(t('The shout was unpublished.'));
      }
    }
    else {
      drupal_set_message(t('You do not have permission to moderate this shout.'));
    }
  }
  else {
    return drupal_not_found();
  }
}