Home Forums Newsletter Plugin Support Newsletter form submit button hide when user is already member?

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #154402
    wulps
    Participant

    On the default form for the newsletter plugin ([newsletter]), would it be possible when a user signed in to his account on my WordPress site and with his email signed up for the newsletter that the Subscribe button would be hidden in the [newsletter] form?

    #346888
    Genius Store SL
    Participant

    Yes, it’s possible to hide the Subscribe button (or the entire form) by detecting whether the user has already subscribed — at least partially — using JavaScript. Keep in mind this method is limited to the same browser and device where the subscription was submitted.

    Right now, what I know is that after a successful subscription, the plugin sets a cookie (named something like “newsletter”) in the visitor’s browser. You can use this to conditionally hide the form or any part of it, like this:

    document.addEventListener('DOMContentLoaded', function () {
      if (document.cookie.includes('newsletter=')) {
        const newsletterSection = document.querySelector('.newsletter_section');
        if (newsletterSection) {
          newsletterSection.style.display = 'none';
        }
      }
    });

    simply replace .newsletterSection with the class you want to hide.

    This approach helps keep things user-friendly: if someone has just subscribed, the form will automatically disappear on future visits from the same browser.

    We’re currently waiting for further details from the plugin’s technical support regarding broader possibilities — for example, querying the user’s metadata when logged in, to check subscription status directly from User metadata (useful if the logged visitor is browsing from a different device or with the “newsletter” cookie expired/blocked/removed).

    Also this thread asked something similar, but it looks like the feature reuqest was abandoned

    Hope that helps!

    #347162
    Michael
    Keymaster

    Hello,

    thanks for your precious feedback!

    Michael

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.