Dưới đây là một mô-đun hoàn chỉnh để thực hiện nhiệm vụ, cộng với việc gán một vai trò để thực hiện hành vi đó với nó:
saidbakr_tools.info:
name = SaidBakr Tools
description = Tools offered by Said Bakr said.fox@gmail.com
core = 7.x 
configure = admin/config/administration/saidbakr_tools
saidbakr_tools.module:
<?php
/**
 * Implements hook_node_access().
 */
function saidbakr_tools_node_access($node, $op, $account) {
   global $user;
  if (
    // The $node argument can be either a $node object or a machine name of
    // node's content type. It is called multiple times during a page load
    // so it is enough if you perform the check once you get the object.
    is_object($node) && $node->type == 'article' &&
    // Operation on which you want to act: "create", "delete", "update", "view".
    $op == 'update'
  ) {
    // Check if the node is published.
  //  var_dump($node);
    if ($node->status == 1 && in_array(variable_get('saidbakr_tools_role','author'), $user->roles)) {
      return NODE_ACCESS_DENY;
    }
  }
}
/**
 * Implements hook_menu().
 */
function saidbakr_tools_menu() {
  $items = array();
  $items['admin/config/administration/saidbakr_tools'] = array(
    'title' => 'SaidBakr Tools',
    'description' => 'Settings for SaidBakr Tools!',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('saidbakr_tools_form'),
    'access arguments' => array('access administration pages'),
    'type' => MENU_NORMAL_ITEM,
  );
  return $items;
}
/**
 * Page callback: Current posts settings
 *
 * @see saidbakr_tools_menu()
 */
function saidbakr_tools_form($form, &$form_state) {
  $form['saidbakr_tools_role'] = array(
    '#type' => 'textfield',
    '#title' => t('The role name'),
    '#default_value' => variable_get('saidbakr_tools_role', 'author'),
    '#size' => 20,
    '#maxlength' => 24,
    '#description' => t('Enter the role name that its users should not be able to edit published contents.'),
    '#required' => TRUE,
  );
  return system_settings_form($form);
}
Tạo hai tệp trên trong một thư mục, đặt tên cho nó saidbakr_toolsvà sau đó tải nó lên bản cài đặt Drupal của bạn tại sites/all/modules.
Trong giải pháp này để kiểm tra trạng thái xuất bản nút, tôi đã sử dụng $node->status