Triggering Actions with Data Attributes

Article author
Josh Lopez
  • Updated

Memberstack includes several data attributes that allow you to trigger actions like resending verification emails, opening the customer portal, logging out a user, deleting member accounts, and more. These attributes make it easy to add functionality without writing any code.

Resend Verification Email

Use data-ms-action="resend-verification-email" to allow users to resend their verification email. This only works if you have email verification enabled.

<a data-ms-action="resend-verification-email" href="#"> Resend verification email </a>

Open Customer Portal

Let users manage their paid subscriptions with data-ms-action="customer-portal". This relies on Stripe's billing portal.

<a data-ms-action="customer-portal" href="#"> Manage Subscription </a>

Log Out User

Add a log out button with data-ms-action="logout". This will automatically hide if no user is logged in.

<a data-ms-action="logout" href="#"> Logout </a>

Login Redirect

Send users to their login redirect URL after logging in using data-ms-action="login-redirect".

<a data-ms-action="login-redirect" href="#"> Go To Your Content </a>

Delete Member Account

Allow members to delete their own accounts using data-ms-action="delete-account". When triggered, this will log the member out, permanently delete their account from Memberstack, and cancel any recurring subscriptions in Stripe.

<button data-ms-action="delete-account">Delete My Account</button>

Important: We strongly recommend implementing a confirmation step before triggering account deletion, as this action cannot be undone. For best practices and a more detailed guide on implementing account deletion, please see our Account Deletion Feature article.

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.