1. Documentation
  2. Restrict Content
  3. [gamipress_restrict_content]

[gamipress_restrict_content]

Restrict a portion of content.

Common Attributes:

  • id – Identifier for this portion of content.
  • unlock_by – Defines how users can get access to this portion of content. Accepts: expend_points, points_balance, achievement, achievement_type, all_achievement_type, rank Default: expend_points
  • granted_roles – Manually grant access to this portion of content to users by role. Accepts any registered role or a comma-separated list of roles
  • granted_users – Manually grant access to this portion of content to the users you want. Accepts any user ID or a comma-separated list of user IDs
  • message – Text that is shown to users that haven’t unlocked this portion of content.
  • guest_message – Text that is shown to non logged in users.

Important: Remember that you need to close the shortcode:
[gamipress_restrict_content]{content}[/gamipress_restrict_content]

Unlock by expending points (unlock_by=”expend_points”)

Setting unlock_by attribute to expend_points will restrict the portion of content through expending points. A button will be displayed in order to let user expend the amount if they want to see this portion of content.

Attributes:

  • points – Points amount required to unlock this portion of content.
  • points_type – The points amount points type required to unlock this portion of content. Accepts any registered points type slug

Example: [gamipress_restrict_content id="content-123" unlock_by="expend_points" points="100" points_type="credits" message="This content is restricted"]
Content to show to users that got access
[/gamipress_restrict_content]

Unlock by reaching a points balance (unlock_by=”points_balance”)

Setting unlock_by attribute to points_balance will restrict the portion of content requiring to the user reach a specific points balance. At the moment that user reaches the total balance, will be able to see the portion of content.

Important: If user expends or gets deducted points and doesn’t meets the conditions, access will be revoked automatically.

Attributes:

  • points – Points amount required to unlock this portion of content.
  • points_type – The points amount points type required to unlock this portion of content. Accepts any registered points type slug

Example: [gamipress_restrict_content id="content-123" unlock_by="points_balance" points="100" points_type="credits" message="This content is restricted"]
Content to show to users that got access
[/gamipress_restrict_content]

Unlock by unlocking achievement(s) (unlock_by=”achievement”)

Setting unlock_by attribute to achievement will restrict the portion of content requiring to the user to earn a specific achievement or a group of specific achievements. At the moment that user unlocks all of this achievements, will be able to see the portion of content.

Important: If user lost any of the achievements required (eg, get them revoked or by transfer them) and doesn’t meets the conditions, access will be revoked automatically.

Attributes:

  • achievement – A comma-separated list of the achievement(s) required to unlock this portion of content.

Single achievement example: [gamipress_restrict_content id="content-123" unlock_by="achievement" achievement="1" message="This content is restricted"]
Content to show to users that got access
[/gamipress_restrict_content]

Multiple achievement example: [gamipress_restrict_content id="content-123" unlock_by="achievement" achievement="1,2,3" message="This content is restricted"]
Content to show to users that got access
[/gamipress_restrict_content]

Unlock by unlocking any achievements of type (unlock_by=”achievement_type”)

Setting unlock_by attribute to achievement_type will restrict the portion of content requiring to the user to earn a specific amount of achievements of a specific type. At the moment that user unlocks the required amount of this achievements, will be able to see the portion of content.

Important: If user lost any of the achievements required (eg, get them revoked or by transfer them) and doesn’t meets the conditions, access will be revoked automatically.

Attributes:

  • achievement_type – The achievement type required to unlock this portion of content.
  • achievement_count – Number of achievements required to unlock this portion of content.

Example: [gamipress_restrict_content id="content-123" unlock_by="achievement_type" achievement_type="badge" achievement_count="5" message="This content is restricted"]
Content to show to users that got access
[/gamipress_restrict_content]

Unlock by unlocking all achievements of type (unlock_by=”all_achievement_type”)

Setting unlock_by attribute to all_achievement_type will restrict the portion of content requiring to the user to earn all the achievements of a specific type. At the moment that user unlocks all of this achievements, will be able to see the portion of content.

Important: If user lost any of the achievements required (eg, get them revoked or by transfer them) and doesn’t meets the conditions, access will be revoked automatically.

Attributes:

  • achievement_type – The achievement type required to unlock this portion of content.

Example: [gamipress_restrict_content id="content-123" unlock_by="all_achievement_type" achievement_type="badge" message="This content is restricted"]
Content to show to users that got access
[/gamipress_restrict_content]

Unlock by reaching a specific rank (unlock_by=”rank”)

Setting unlock_by attribute to rank will restrict the portion of content requiring to the user to reach a specific rank. At the moment that user reaches this rank, will be able to see the portion of content.

Important: If user gets downgraded to a lower priority rank that required one (eg, get them revoked or by transfer them) and doesn’t meets the conditions, access will be revoked automatically.

Attributes:

  • rank – The rank required to unlock this portion of content..

Single achievement example: [gamipress_restrict_content id="content-123" unlock_by="rank" rank="1" message="This content is restricted"]
Content to show to users that got access
[/gamipress_restrict_content]

How can we help?