开发者

How restrict the view by members in drupal

开发者 https://www.devze.com 2023-03-25 16:47 出处:网络
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 vie

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

精彩评论

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

关注公众号