How to display member plan, join date, and last login on a profile page with Memberstack?

Post author
Ryan Esling

Hey, I want to display somebodies plan on their profile page.
Tried data-ms-member=plan and current-plan. Which one is it?
Same question for join date and last login?

Comments

3 comments

  • Comment author
    Memberstack Team
    • Official comment

    Great question! For displaying the plan name, MemberScript #186 is a solid reference — it uses custom logic to pull the member’s current plan or price ID and map it to a readable name. That’s the best way to show the actual plan label on the profile page.

    For join date, you can use the built-in attribute:

    data-ms-member="signupDate"
    

    For last login, Memberstack doesn’t expose that directly via attributes, so you’ll need a bit of custom code to fetch and display it. ReyBot might be able to help with that part too!

  • Comment author
    Raquel Lopez

    Hello,
    In Memberstack V2, since users can have multiple plans assigned to them, you’ll need to use a bit of custom code to display which plan they’re on. You can use this guide as a reference:
    https://docs.memberstack.com/hc/en-us/community/posts/22860627632795-How-to-display-a-member-s-current-plan-name-in-the-dashboard-using-Memberstack-data-attributes

    For the signup date, you can simply use the attribute:

    data-ms-member="signupDate"

    For the last login, you’ll also need custom code to display that field to the user.

    If you’d like some extra help with the coding part, you can always ask ReyBot here:
    https://rey.memberstack.com/

    0
  • Comment author
    Chukwudi

    Ryan Esling As Rachel mentioned, you'd need some custom code to display the plan name to the user. Here’s how you can achieve that:

    Instructions:

    1. Add a placeholder element in Webflow where the plan name should appear:
    2. Loading...
    3. Copy the script below and place it in the **Before **section of the page.
    4. Update the planMapping object with your actual Price IDs and Plan IDs.
      • Keys are your Memberstack Price/Plan IDs.
      • Values are the plan names you want to display.
    5. Publish your site. The member’s plan name will automatically appear in #planName after login.

    Script:

    <script>
    document.addEventListener("DOMContentLoaded", function () {
        const planNameElement = document.querySelector('#planName');
    
        // ✅ Update these mappings only
        const planMapping = {
            "prc_IDForPriceA": "Monthly Plan", 
            "prc_IDForPriceB": "Annual Plan",
            "pln_IDForPlanA": "Plan A",
            "pln_IDForPlanB": "Plan B"
        };
    
        window.$memberstackDom.getCurrentMember().then((member) => {
            if (!member || !member.data || !member.data.planConnections) {
                planNameElement.textContent = "No active plan or price";
                return;
            }
    
            const planConnections = member.data.planConnections;
            let planName = "No active plan or price";
    
            for (const connection of planConnections) {
                const priceId = connection.payment ? connection.payment.priceId : null;
                const planId = connection.planId || null;
    
                if (priceId && planMapping[priceId]) {
                    planName = planMapping[priceId];
                    break;
                }
                if (planId && planMapping[planId]) {
                    planName = planMapping[planId];
                    break;
                }
            }
    
            planNameElement.textContent = planName;
        }).catch(() => {
            console.error('Failed to load Memberstack data.');
            planNameElement.textContent = "Unable to load plan details";
        });
    });
    </script>
    

    I hope this helps.

    0

Please sign in to leave a comment.