mailchimp-subscribe-craft icon indicating copy to clipboard operation
mailchimp-subscribe-craft copied to clipboard

Tagging

Open richardcantwell opened this issue 3 years ago • 3 comments

Can you add the ability to add tags?

richardcantwell avatar Sep 03 '20 20:09 richardcantwell

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.

simonkuran avatar Sep 15 '20 08:09 simonkuran

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

bleepsandblops avatar Apr 10 '21 10:04 bleepsandblops

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?

qrazi avatar Apr 16 '21 14:04 qrazi