Rather than send a subscription request and get a failed response in the site logs. This patch checks to see current subscription of logged in user.
If user is already subscribed it will not display the fieldset for subscription.

Also for anonymous users it will still display the fieldset but it will validate upon form submission to see if email address entered into checkout form is currently subscribed. If it is then it just skips the step of subscribing the user to this newsletter.

Comments

davidburns’s picture

Not sure if I should have used

$user->mail

or

$order->primary_email

in function uc_mailchimp_action_ecom_update($order) {...}

arcaneadam’s picture

I would check $order->primary_email as that is what will be available regardless of whether or not the user is logged in.

sethcohn’s picture

Status: Patch (to be ported) » Needs review

Looks good... can you submit a revised patch?

davidburns’s picture

StatusFileSize
new1.54 KB

updated diff attached