开发者

How restrict the view by members in drupal

I just create a view for showing all registered members profile details. But the problem is admin can see all Member details and also Members can see only their details. Now i want to restrict the view by, Admin can see all members and the Member can see their details itself.

How i do it ?

And also i want create a privilege, for example Admin can see all开发者_运维百科 details, Managers can see some restricted data and the Members also have some restrictions.


You can use hook_perm to create custom permissions.

<?php
  function mymodule_perm() {
    return array('View any members info', 'extra permissions ...');
  }
?>

Now you can set the View's access control to your custom permission.


A couple of ideas:

If you use the content profile module, which creates a CCK content type for user information, you can use the content permissions built into CCK to restrict access to particular fields.

You could also in the view use a filter of "User:Current" which should filter the view to the current logged in user.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜