Skip to the content
Documentation

Creating a protected area

No ratings yet

Everything published in the content tree is public by default: visitors who are not signed in may read what the Anonymous role allows, which on a standard site is the section Standard (and the images and files in Media). A members-only area uses this: put its pages in a section of their own, which Anonymous may not read, and give your members a role that may.

The Login form on the public site with the Sign Up button

A member signs in on the site with Login; Sign Up registers a new account.

Who can do this

An administrator, or a user whose roles allow editing and assigning sections and editing roles (section/edit, section/assign and role/*).

Steps

  1. Create the section. Open Setup > Sections, press New section, give it a name, for example "Members area", and an identifier, and save it. See Managing sections.
  2. Put the pages into it. Open the folder that holds the members' pages, open its Details tab, choose the new section and Whole subtree, and press Set.
  3. Check that it is closed. Open the site in a private browser window, where you are not signed in, and open one of the pages. It is refused, and gone from menus and lists.
  4. Create the role. Open Users > Roles and policies and press New role. Name it, for example "Members area reader".
  5. Add the policy. Press New policy, choose the module content, then the function read, then Grant limited access. Under Section choose "Members area" and press OK. Press Save.
  6. Assign it. On the role's page press Assign and choose the user group of your members, for example Members.
  7. Check that members see it. Sign in on the site as a test member and open the page again. It is shown.
The Sections page of the administration

Sections divide the content tree. A members-only area is a section of its own that only some roles may read.

Members who may also add or change pages in the area need further policies in the same role, for example content/create and content/edit limited to the section. See Roles and policies.

The page of the Member role with its policies

The Member role, given to the Members group: its policies as sentences, and the groups it is assigned to.

What can go wrong

  • Visitors still see the pages. A cached copy can be served for a short time, or the Anonymous role has a content/read policy without a section limit. Check the Anonymous role first, then ask for the content cache to be cleared.
  • Members cannot sign in at all. Signing in to a siteaccess needs the policy user/login for it in one of the member's roles. Check the member's Roles and Policies tabs.
  • A member sees the pages only after signing in again. Rights are read again at the next sign-in.
  • New members land in another group. People who register on the site are placed in the group the site's settings name (the Members group on a new installation). Assign the role to that group.
  • Images on the members' pages are public. Images and files usually live in the Media library, in the section Media, which visitors may read. Move confidential files into the members' section too.

A members-only area keeps the pages from visitors and search engines, but every member of the group can read and copy them. Do not put anything there that only some members may see; give such pages a section and a role of their own.

Read more

Contributors

Comments

Add a comment

Comments are read by a moderator before they appear.