💎
Diamond Network
  • 👋Welcome
  • 🛡️Authentication
  • 🛑App Errors
  • 💬Support
  • API Products
    • 🔑Verify
      • 🔒Unlockables
      • 🔗Unlockable Links
      • ✨Browser SDK
      • 👨‍💻REST API
      • 🛑Verify Errors
      • ❔Guides
        • Gated Content
        • Holders Discount
        • Wallet Login
        • Trait-based Rewards
  • NFT-Inator
    • 🎇NEW: Reserve your club
    • Features
      • Tiers
    • Getting Started
      • Create an account
      • Start a project
      • Project Stage
      • Upload Traits
      • Adjust project settings
    • Design custom tokens
      • Prototype UI
      • Design & save tokens
      • Creating a promo video
      • Download your art & metadata
    • Generate a collection
      • Generator UI
      • Token Sets
      • Managing traits & rarity
      • Rules
      • Rarity views
      • Filtering & editing tokens
    • Export a project
      • Pre-existing artwork
      • Promo video
      • Export Collection
        • Basic Settings
        • NFT-Preview
        • IPFS Upload
        • Export Files
      • IPFS Options
        • NFT.storage
        • Pinata
    • Smart contract deployer
      • Initial Setup
      • Deploy a contract
        • Minting
        • Payouts & royalties
        • Features
        • Deploy to testnet
      • Reserve your club
    • Managing a smart contract
      • Dashboard
      • Artwork
      • Allowlist
      • Airdrop
      • Withdraw
      • Mint Button
      • Source & ABI
      • Settings
Powered by GitBook
On this page
  • Theory
  • Set up role-based access

Was this helpful?

  1. API Products
  2. Verify
  3. Guides

Gated Content

Quickstart guide for offering access to certain areas of your Wordpress site to NFT holders only.

PreviousGuidesNextHolders Discount

Last updated 3 years ago

Was this helpful?

This guide uses Cloudflare Workers and Wordpress (with the Content Control plugin) but the concept can be adapted to any CMS or website.

In this guide we'll show you how to use Verify to restrict certain areas of your Wordpress website to users who own your NFT. We'll be using the plugin, but you can use any plugin which allows you to restrict access to pages or posts depending on the user's role.

Theory

Below is a high-level overview of how this solution works.

  1. Create a Wordpress role (e.g nft_holder) which will be required to view gated content

  2. When a user clicks on the a gated post without the required role they'll be taken to a page with the Verify SDK

  3. We'll use the user option to provide the current user ID and a HMAC signature to the verify request. A signature is used here to prevent the user tampering with their ID before completing verification.

  4. After completing verification we receive a signed object with result, which includes the user ID we provided. This entire object can be trusted, including the user ID, thanks to the signature from Step 3.

  5. We send this object to a Cloudflare Worker, which verifies the signature and adds the nft_holder role to the user if they own the NFT

  6. User is redirected back to the gated post they originally requested

Once the user has verified their NFT once, they'll have instant access to all future posts without verifying again.

You could extend this example by also adding an expiration time to the user metadata in Step 5, and registering a wp_cron which removes the role from expired users. This would require users to re-verify ownership periodically.

Set up role-based access

Lorem ipsum

🔑
❔
Content Control