| 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))), |
| 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)); |
| 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 |
} |
} |