Restrict Content by User Groups

Restrict Content by User Groups

This feature allows you to restrict post/page/custom post type content based on user groups using a shortcode. You can place your restricted content within the shortcode to limit the access.

Managing User Groups

You can create user groups and members using the Groups section on the left menu. Click Add New button to get the group creation screen as shown in the following screenshot.

manage_groups_1

Let’s identify the settings.

  • Title – You can enter a title for your group.
  • Description– You can enter a description for your group. Description is used in front-end groups of PRO version.
  • Add New Users – Type users first or last names to search and add users to the group. Once added, click the Publish button to save the group and group members.

Once members are added, group screen will look like the following screenshot. You can use pagination to view all users in group.

manage_groups_2

Now go to the Groups list and you will find the ID of group as shown in the following screenshot. You can use the ID in private content shortcode to restrict content to specific user groups.

manage_groups_3

Allow Content for User Groups

This feature allows you to allow content for certain user groups. You can use allowed_groups attribute to define the user groups for allowing content. Let’s take a look at the usage of this attribute.

Allowing Content for One User Group


[wppcp_private_content allowed_groups="21" ]
Private Content for User Group with ID 21
[/wppcp_private_content]

Allowing Content for Multiple User Groups


[wppcp_private_content allowed_groups="21,23" ]
Private Content for User Group with ID 21 and 23
[/wppcp_private_content]