function ikon_stuff_module_implements_alter(&$implementations,$hook){if($hook=='menu_alter'){// Move my_module_rdf_mapping() to the end of the list. module_implements()// iterates through $implementations with a foreach loop which PHP iterates// in the order that the items were added, so to move an item to the end of// the array, we remove it and then add it.$group=$implementations['ikon_stuff'];unset($implementations['ikon_stuff']);$implementations['ikon_stuff']=$group;}}/*** Implemenation of hook_menu_alter().*/function ikon_stuff_menu_alter(&$items){// Customize access callback for menu - 'node/%/replies_list'.$items['node/%/replies_list']['access callback']='access_request_replies';}/*** Access callback of menu - 'node/%/replies_list'.*/function access_request_replies(){returnFALSE;}
2 个回答
Views 允许通过UI设置权限,你能够选择基于“权限”或者“角色”控制访问内容。
基本上这已经够用,如果你要自己写权限,你可以新建一个模块并用access callback,通过hook_menu_alter,但前提必须确保你的模块是在views hook_menu_alter之后呼叫,你可以通过修改数据库的module weight 来控制顺序,或者如果你怕麻烦,也可以用hook_module_implements_alter来确保你的模块是在views 模块之后呼叫。
分头诗人Lv 17
诗人,我这么着再去访问那个node/%/replies_list页面,出现重定向循环了,我已经把那个views的权限定义成none了,不晓得是什么原因呢?
似水流云Lv 7