Drupal开发:节点访问与主题系统搭建指南
1. 节点访问记录函数实现
在Drupal开发中,有一个用于实现 hook_node_access_records() 的函数 forum_access_node_access_records ,它的作用是返回传入节点对象的授权记录列表。以下是该函数的代码:
/**
* Implementation of hook_node_access_records().
*
* Returns a list of grant records for the passed in node object.
*/
function forum_access_node_access_records($node) {
...
if ($node->type == 'forum') {
$result = db_query('SELECT * FROM {forum_access} WHERE tid = %d', $node->tid);
while ($grant = db_fetch_object($result)) {
$grants[] = array(
'realm' => 'forum_access',
'gid' => $grant->rid,
'grant_view' => $grant->grant_view,
'grant_update' => $grant->grant_update,
'grant_delete' => $grant->grant_delete
)
超级会员免费看
订阅专栏 解锁全文
14

被折叠的 条评论
为什么被折叠?



