How Do I Show and Hide a Button For Members

Article author
Teresa Klusaw
  • Updated

 

How to create (or gate) a button so it does different things for logged in and not logged members.

  • About this article
    • Difficulty level: Easy
    • Technical background needed: Beginner
    • Estimated time required to complete: 20 minutes

The easiest way to build this would be to create "two" similar buttons.

For the first button, it would be placed in the members only content page and you can set the desired action (for example, links to a different page, allows member to “like”, etc.

The second button would be on the public page and if the member is not logged in, it prompts them to do the action you desire – for example: sign up. This is hidden if the user is logged in.

You can add attributes to the button to make it disappear 👍 Here's the article for all our attributes.

To hide content from all active members:
data-ms-content="!members"

 

To hide content from all non-members:
data-ms-content="members"

 

 

Was this article helpful?

Comments

0 comments

Article is closed for comments.