You are here

function _auto_block_scheduler_unpublish in Auto Block Scheduler 7

Method used to unpublish scheduled block by bid.

Parameters

int $bid: Block bid.

Return value

bool TRUE or FALSE.

Throws

Exception

3 calls to _auto_block_scheduler_unpublish()
auto_block_scheduler_display_scheduler_submit in ./auto_block_scheduler.module
Form submission handler for admin block display section.
_auto_block_scheduler_configure_submit in ./auto_block_scheduler.module
Form submission handler for block admin configuration.
_auto_block_scheduler_unpublish_cron in ./auto_block_scheduler.module
Unpublish scheduled blocks.

File

./auto_block_scheduler.module, line 345
Scheduler publishes and unpublishes block on dates specified by the user.

Code

function _auto_block_scheduler_unpublish($bid) {
  $result = FALSE;
  $transaction = db_transaction();
  try {
    $result = db_update('block')
      ->fields(array(
      'status' => 0,
      'region' => -1,
    ))
      ->condition('bid', $bid)
      ->execute();
  } catch (Exception $e) {
    $transaction
      ->rollback();
    watchdog_exception('auto_block_scheduler', $e);
    throw $e;
  }
  return $result;
}