ExpressionEngine 7.5 has been Released! Learn More!
Set viewing conditions for your entries and/or create password protected content with ease.
Running a subscription website? Or simply want to reserve some content for certain groups of users with particular roles assigned? GB Gated Content lets you control who gets to view the entries with a custom entries loop and/or a flexible field type for you to specify the access condition and/or passcode.
{exp:gb_gated_content:entries channel="blog" check="{logged_in_primary_role_id}" match="5|6" passcode="n0tAs@f3Pa$SvvOrD" limit="5"}
<h2>{title}</h2>
<p>{body}</p>
{gb_gated_content_preview}
<p>This content is for subscribers only. Please <a href="/signup">sign up here</a> and start learning how to code like a pro!</p>
<p>If you have the access key, enter below to start reading.</p>
{gb_gated_content_preview:form form:id="unlockForm" passcode:class="form-control" submit:class="btn btn-submit" submit:text="Unlock Content" fail_url="/test/gated_content_entries?unlock=failed"}
{/gb_gated_content_preview}
{/exp:gb_gated_content:entries}
{exp:channel:entries channel="blog" limit="1"}
{if my_gb_gated_content_field:unlocked}
<h2>{title}</h2>
<p>{body}</p>
<hr>
{if:else}
<div class="preview">
{my_gb_gated_content_field:preview}
</div>
{my_gb_gated_content_field:form form:id="myForm" passcode:class="form-control" submit:class="btn btn-submit" submit:text="Unlock Content"}
{/if}
{/exp:channel:entries}
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.