rendered paste body<?php
function node_ban_menu($may_cache) {
$items = array();
if ($may_cache) {
$items[] = array(
'path' => 'node_ban',
'callback' => 'node_ban',
'access' => user_access('administer nodes'),
'title' => t('Blocks author and deletes node'),
);
}
return $items;
}
function node_ban($nid) {
if (!is_numeric($nid) || !($node = node_load($nid))) {
return MENU_NOT_FOUND;
}
$account = user_load(array('uid' => $node->uid));
user_save($account, array('status' => 0));
node_delete($nid);
watchdog('node ban', t("The node %title has been deleted and it's author %user has been blocked", array('%title' => $node->title, '%user' => $account->name)));
return t("The node %title has been deleted and it's author %user has been blocked", array('%title' => $node->title, '%user' => $account->name));
}
function node_ban_link($type, $node = NULL, $teaser = FALSE) {
if ($type == 'node' && user_access('administer nodes')) {
return array(
'href' => 'node_ban/'. $node->nid,
'title' => t('Block author and delete node'),
);
}
}