Drupal - 限制用户访问
我需要能够添加页面,然后通过不同类型的用户限制这些页面:匿名、部分和完整。
注册时,用户可以输入所有详细信息以获得完整注册,也可以仅输入一半详细信息,例如不需要输入地址、电话等即可获得部分注册类型。
然后,当添加页面时,我需要能够选择是否匿名、部分和/或完全有权访问它。如果他们不这样做,那么它仍然需要显示页面摘要作为预告片,但他们在注册和登录之前无法访问主要内容。
我已经安装了 Simple Access 插件,它允许我创建组,但不确定如何实现注册表单,以便如果用户仅输入必填字段,他们将成为部分用户,否则他们将成为完整用户。有什么建议吗?
I need to be able to add pages and then restrict these by different types of user: Anonymous, Partial and Full.
When registering, a user can enter all details to get a full registration or only half their details e.g don't need to enter address, telephone etc to gain a partial registration type.
Then when adding a page I need to be able to select whether anonymous, partial and/or full have access to it. If they don't then it still needs to show the summary of the page as a teaser but they won't have access to the main content until they have registered and signed in.
I have installed the Simple Access plugin which allows me to create groups but unsure how to implement the registration form so that if the user only enters the required fields they will become a Partial user, otherwise they will become a Full user. Any suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以使用规则模块。创建在创建新用户时运行的触发规则,然后检查字段,最后为用户分配相应的角色。
You can use the Rules module. Create a triggered rule that runs on new user creation, then check the fields and finally assign the user a role accordingly.
我最终使用了一个钩子来实现用户是普通授权用户还是完整用户。有人可以检查一下下面的钩子是否正确吗?我是 Drupal 的新手,所以不确定添加/删除角色时是否有任何其他表受到影响。
}
I've ended up using a hook to implement whether a user is a normal authorised user or a full user. Can someone please check the hook below is correct? Im new to Drupal so not sure if any other tables are affected when adding/deleting roles.
}
您最好研究一些 Drupal 入门教程。角色、规则、触发器和 CCK(和 content_permissions)——这些是您将要学习的模块/概念。
他们会用你需要的东西武装你。 CCK 将允许您创建特定的内容类型,content_permissions(包含在 CCK 中)将允许您根据用户的角色设置可见性,角色将允许您创建新的用户组,并且正如 @Laxman13 所说,规则将允许您设置规则来执行需要执行的操作(即将此用户添加到 X 角色),并且触发器将为您提供执行此操作的功能。
You would do well to look into some of the beginning Drupal tutorials. Roles, rules, triggers and CCK (and content_permissions) -- those are the modules/concepts you'll be looking at learning about.
They will arm you with what you need. CCK will allow for you to create specific content types, content_permissions (included in CCK) will allow for you to set visibility based on a user's role, roles will allow for you to create a new group of users, and as @Laxman13 said, rules will allow for you to set up rules to do what needs to be done (i.e. add this user to X role), and triggers will provide you with the functionality to do that.