You are here

function comment_operations in Drupal 4

Same name and namespace in other branches
  1. 5 modules/comment/comment.module \comment_operations()
  2. 6 modules/comment/comment.module \comment_operations()

Comment operations. We offer different update operations depending on which comment administration page we're on.

2 calls to comment_operations()
comment_admin_overview in modules/comment.module
Menu callback; present an administrative comment listing.
comment_admin_overview_submit in modules/comment.module
Execute the chosen 'Update option' on the selected comments, such as publishing, unpublishing or deleting.

File

modules/comment.module, line 912
Enables users to comment on published content.

Code

function comment_operations($action = NULL) {
  if ($action == 'publish') {
    $operations = array(
      'publish' => array(
        t('Publish the selected comments'),
        'UPDATE {comments} SET status = ' . COMMENT_PUBLISHED . ' WHERE cid = %d',
      ),
      'delete' => array(
        t('Delete the selected comments'),
        '',
      ),
    );
  }
  else {
    if ($action == 'unpublish') {
      $operations = array(
        'unpublish' => array(
          t('Unpublish the selected comments'),
          'UPDATE {comments} SET status = ' . COMMENT_NOT_PUBLISHED . ' WHERE cid = %d',
        ),
        'delete' => array(
          t('Delete the selected comments'),
          '',
        ),
      );
    }
    else {
      $operations = array(
        'publish' => array(
          t('Publish the selected comments'),
          'UPDATE {comments} SET status = ' . COMMENT_PUBLISHED . ' WHERE cid = %d',
        ),
        'unpublish' => array(
          t('Unpublish the selected comments'),
          'UPDATE {comments} SET status = ' . COMMENT_NOT_PUBLISHED . ' WHERE cid = %d',
        ),
        'delete' => array(
          t('Delete the selected comments'),
          '',
        ),
      );
    }
  }
  return $operations;
}