Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
Hi,
I am looking for a way to hide the mailchimp subscribe block to registers users who have already subscribe to the list.
Is there a way?
Comment | File | Size | Author |
---|---|---|---|
#1 | mailchimp-optional_block_hiding_for_subscribed_users-2334349-1.patch | 7.48 KB | ndewhurst |
Comments
Comment #1
ndewhurstI wrote the attached code to help achieve this. It adds an option to each signup form so that (if the form is rendered in block mode) the block can be hidden from users who have subscribed to all lists associated with the form. It would be easy to add an alternate option like "hide block if user has signed up for any of the lists on this form.
What makes it somewhat tricky is that user signup can be managed via the fields provided by the mailchimp_lists module. I wrote a helper function to process any such fields so that we use the appropriate user email address for our query. For example:
I've tested this with multi-list forms, various combinations of subscription fields and subscription states, etc. Hopefully someone else can test it and give some feedback.
Comment #2
ndewhurstComment #3
Colin @ PCMarket CreditAttribution: Colin @ PCMarket commentedThank you for making this patch
I managed to apply the patch but after doing so I don't seem have the option to hide the block for subscribed users in the sign up forms admin.
Comment #4
hosais CreditAttribution: hosais as a volunteer commentedHi,
I need this function too. Hope this will work soon.
Comment #5
ruscoe CreditAttribution: ruscoe at ThinkShout for Mailchimp commentedThank you for your work on this, @ndewhurst. Unfortunately we're going to be ending support for the 7.x-3.x branch due to the upcoming deprecation of the v2.0 MailChimp API. If you're still interested in adding this, please feel free to reopen for the 7.x-4.x branch.