How to configure different custom field visibility between signup and profile modals in Memberstack? Answered

Post author
James Bishop

I want to show a bunch of custom fields on the pre-built profile modal but only one on the signup modal (so there is as little friction at this point as possible). Is there an easy solve for this?

Comments

5 comments

  • Comment author
    Julian Galluzzo

    I think custom modals will have to be the solution on this one

    0
  • Comment author
    Duncan from Memberstack

    Yup, Julian is correct

    0
  • Comment author
    Sebastian Kacperski

    I’m using MS default sign up modal yet I would like to pass a value to a custom field “behind the scenes”. I don’t want to show that in the UI. This will be rather simple value “promo: yes”

    Is this possible in default modals?

    0
  • Comment author
    Chukwudi

    Hi Sebastian,
    I'm afraid it's not possible to do this directly in the default modal. However, a workaround would be to place the script below on the page users are redirected to after signing up — for example, the dashboard. This script will update the custom field if it's empty, once the user lands on that page:

    <script>
    document.addEventListener("DOMContentLoaded", async function() {
      window.$memberstackDom.getCurrentMember().then(async (member) => {
        if (member && (!member.customFields.promo || member.customFields.promo === "")) {
          try {
            await memberstack.updateMember({
              customFields: {
                "promo": "yes"
              }
            });
            console.log("Promo field updated successfully.");
          } catch (error) {
            console.error("Error updating member data:", error);
          }
        }
      });
    });
    </script>
    
    0
  • Comment author
    Sebastian Kacperski

    thanks Chukwudi

    0

Please sign in to leave a comment.