/[drupal]/contributions/modules/restricted_content/restricted_content.module
ViewVC logotype

Diff of /contributions/modules/restricted_content/restricted_content.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.1, Sat Jan 3 03:32:37 2009 UTC revision 1.2, Sat Jan 3 04:09:13 2009 UTC
# Line 57  function restricted_content_form_alter(& Line 57  function restricted_content_form_alter(&
57      );      );
58      $form['restricted_content']['rids'] = array(      $form['restricted_content']['rids'] = array(
59        '#type' => 'checkboxes',        '#type' => 'checkboxes',
60        '#title' => t('Restrict viewing from users with any of the following user roles'),        '#title' => t('Restrict access to users with the following user roles'),
61        '#description' => t('If no roles are selected, the node will be viewable by all users.'),        '#description' => t('If no roles are selected, the node will be viewable by all users.'),
62        '#options' => user_roles(),        '#options' => user_roles(),
63        '#default_value' => unserialize(db_result(db_query("SELECT rids FROM {restricted_content} WHERE nid = %d", $form['#node']->nid))),        '#default_value' => unserialize(db_result(db_query("SELECT rids FROM {restricted_content} WHERE nid = %d", $form['#node']->nid))),
# Line 111  function restricted_content_nodeapi(&$no Line 111  function restricted_content_nodeapi(&$no
111    }    }
112    elseif ($op == 'load' && !restricted_content_form_access($node)) {    elseif ($op == 'load' && !restricted_content_form_access($node)) {
113      $rids = db_result(db_query("SELECT rids FROM {restricted_content} WHERE nid = %d", $node->nid));      $rids = db_result(db_query("SELECT rids FROM {restricted_content} WHERE nid = %d", $node->nid));
114      if ($rids && array_intersect(unserialize($rids), array_keys($user->roles))) {      if ($rids && !array_intersect(unserialize($rids), array_keys($user->roles))) {
115    
116        $node_type = drupal_strtolower(node_get_types('name', $node));        $node_type = drupal_strtolower(node_get_types('name', $node));
117        $node->body = t('This @node-type has been restricted to certain users.', array('@node-type' => $node_type));        $node->body = t('This @node-type has been restricted to certain users.', array('@node-type' => $node_type));
# Line 147  function restricted_content_preprocess_n Line 147  function restricted_content_preprocess_n
147      $vars['taxonomy'] = FALSE;      $vars['taxonomy'] = FALSE;
148      $vars['terms'] = FALSE;      $vars['terms'] = FALSE;
149      $vars['links'] = FALSE;      $vars['links'] = FALSE;
150      $vars['node_url'] = '';      $vars['node_url'] = request_uri();
151    }    }
152  }  }

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

  ViewVC Help
Powered by ViewVC 1.1.2