Access By Stake Pool Delegation

Allowing access to exclusive content on a website through user delegation is an effective strategy for attracting delegates to your stake pool. This concept of gating specialized content based on user delegation is one of the primary use cases for which CardanoPress was designed.

This approach is similar to NFT gating, where the user’s wallet data is read, the wallet’s history is analyzed, and a role is assigned if the specified criteria are met.

In this tutorial, we will demonstrate how to assign a role to a user based on the condition of having staked to a pool for at least four epochs. A duration of four epochs is generally considered sufficient, as it typically allows users to see rewards in their wallet if the pool is minting blocks, and it spans less than two weeks.

Setting Access by Stake Pool Delegation

Total Time: 30 minutes

Install Dependency Plugins #

CardanoPress depends on two widely-used plugins in the WordPress ecosystem for creating access roles and groups to manage content access:
User Role Editor
User Access Manager
If you’re not using a third-party membership plugin like S2Member or Paid Memberships Pro, we strongly recommend these two plugins for creating roles and access groups due to their widespread use and excellent support.

Setting Up a Role #

First, ensure User Role Editor is installed in your WordPress instance.

If you need to install it, navigate to Plugins > Add New and search for “User Role Editor” within your WordPress plugin management area.

After installation, go to:

Users > User Role Editor

User Role Editor
On the User Role Editor screen, you can create a new role for your gated users. Typically, you can create a new role with permissions similar to those of Subscribers on your website.
User Role Editor: Add Role
From the User Role Editor screen, click on “Add Role” to open the Add New Role window.
Define a Name ID and Display Name for the role.

Then, select Subscriber from the “Make copy of” option. This will assign the same permissions to your new role as the existing Subscriber role on your website. Click “Add Role” to save and proceed.

You have now successfully created a new role.

Setting Up a User Group #

Now that you have created a role, you’ll need a group to which the role and users will be assigned.

If you haven’t installed the User Access Manager plugin yet, do so by navigating to Plugins > Add New within your WordPress dashboard. Search for the User Access Manager plugin, then install and activate it.

After installation, access the plugin from your admin menu by selecting UAM.

Create a new user group by providing the following details:

User group name
User group description

Set read and write access to “Only group users”

Select your newly created Role affiliation
Click “Add User Group” to save and close.

Manage user groups
At any time, access to these groups can change.

Setting Role Assignment By Delegation Rules #

CardanoPress Delegation Access Settings

We can now configure the delegation requirements in the CardanoPress plugin to establish the parameters for delegation and access.

To foster loyalty among delegates, we recommend setting a minimum of three epochs to build wallet loyalty. Keep in mind that one epoch lasts five days. Depending on the content you wish to restrict, this duration may be too long or too short.

To set up the delegation requirements, follow these steps:

Navigate to the CardanoPress settings in the admin area of your website.
Set the “Delegation: Pool Id” to the ID of your stake pool. Either ID type will work.
Configure the “Delegation User Access” settings according to your preferred delegation requirements. In this example, we have set it to one epoch and assigned the NFTHolders role.

Completing these steps will enable the automatic assignment of a user’s wallet to a role, provided they meet the delegation requirements.

Assigning Content to the Role Type #

The final step is to assign content to the specific role you want to restrict access to.

Navigate to a piece of content on your website that you wish to restrict.

On the right side of the content properties, you will find an Access panel. Assign the role to that specific content piece.

This will now limit access to that content for users with the specified role only.

Congratulations! You have successfully restricted content on your website based on a user’s wallet delegation.

Powered by BetterDocs