Hello all.

I am using the content access control for control the visibility of the pages of a book, advanced book block present booth the elements allowed and not allowed.

In the file added present a image where present two menus of the block the first element is not accesible for the user (the user don't have permissions) therefore it should be hidden.

(I speak espanish, sorry for my english).

Thanks.

CommentFileSizeAuthor
Item not allowed.png57.12 KBSystem Sifi

Comments

System Sifi’s picture

I have changed the function get_book_children of the module Advanced book block for this review if the user have permission.. there is the source code...

function get_book_children($mlid) {
$result = db_query("SELECT mlid, weight, link_title FROM {menu_links} WHERE plid = %d ORDER by weight, link_title", $mlid);
while ($child = db_fetch_object($result)) {
if (!empty($child->mlid)) {
$mlid_array[] = $child->mlid;
}
}

if (!empty($mlid_array )) {
foreach ($mlid_array as $child_mlid) {
$child_nid = db_result(db_query("SELECT nid FROM {book} WHERE mlid = %d", $child_mlid));
$child_object->type = db_result(db_query("SELECT type FROM {node} WHERE nid = %d", $child_nid));
$child_object->nid=$child_nid;

if (!empty($child_nid)) {
if(module_exists('content_access')){
global $user;
$per_for_user=content_access_per_node_setting('view',$child_object);
$array_roles = $user->roles;

if($user->uid == 1){
$nid_array[] = $child_nid;
}else{

foreach($per_for_user as $usuario){
if(isset($array_roles[$usuario])){
$nid_array[] = $child_nid;
break;
}
}
}
}else{
$nid_array[] = $child_nid;
}
}
}
}
return $nid_array;
}