function shoutbox_moderate_shout in Shoutbox 6.2
Same name and namespace in other branches
- 7.2 shoutbox.module \shoutbox_moderate_shout()
- 7 shoutbox.module \shoutbox_moderate_shout()
Alter the moderation status of a shout
Parameters
$shout_id: The shout id of the shout being moderated
$moderate: TRUE to moderate (unpublish), otherwise FALSE to unmoderate (publish)
2 calls to shoutbox_moderate_shout()
- shoutbox_publish_form_submit in ./
shoutbox.pages.inc - Handle the publish form submission
- shoutbox_unpublish_form_submit in ./
shoutbox.pages.inc - Handle the unpublish form submission
File
- ./
shoutbox.module, line 734 - Shout box module displays a block for users to create short messages for the whole site. Uses AHAH to update the database and display content.
Code
function shoutbox_moderate_shout($shout_id, $moderate) {
if (is_numeric($shout_id)) {
// Load the shout
$shout = shoutbox_load($shout_id);
// Update the shout
$shout->moderate = $moderate ? 1 : 0;
// Allow other modules to alter the shout
shoutbox_invoke($moderate ? 'unpublish' : 'publish', $shout);
// Save the shout
db_query("UPDATE {shoutbox} SET moderate = '%d' WHERE shout_id = %d", $shout->moderate, $shout->shout_id);
if (!$moderate) {
drupal_set_message(t('The shout was published.'));
}
else {
drupal_set_message(t('The shout was unpublished.'));
}
}
}