mailchimp-subscribe-craft
mailchimp-subscribe-craft copied to clipboard
Tagging
Can you add the ability to add tags?
Do you mean the ability to add tags without overriding the current tags? I think that would be a very useful addition. Right now it's really awkward to have to query the current tags and merge them with the tags I'd like to add. I feel like line 810 of MailchimpSubscribeService.php should be moved to it's own service. Maybe to a service like removeTag or removeAllTags.
For anyone else finding this, if you change line https://github.com/aelvan/mailchimp-subscribe-craft/blob/96d1e5b7a544576072ac6cff08374a79fb9a20d1/src/services/MailchimpSubscribeService.php#L811 to
$tagsMap[$tag->name] = 'active';
it adds your tag to the existing ones
I want the same thing. Can't change the service, as we're using composer. Not sure yet if I'll fork this repo or proxy the service.
I think a good approach for this would be to add a hidden field to a form that allows signaling to the plugin what approach to take. So for instance:
<!--
Indicate any tags not posted by this form should be removed.
This would also be the default value, making this hidden input optional
-->
<input type="hidden" value="set" name="tags_method">
<!-- OR -->
<!-- Indicate should be added -->
<input type="hidden" value="merge" name="tags_method">
Reason for using hidden input vs config; this way allows per form configuration instead of per site configuration.
Would there be an interest in a PR?