{"id":18256822,"url":"https://github.com/boundstate/craft-mailchimp","last_synced_at":"2025-04-08T22:28:42.828Z","repository":{"id":36946011,"uuid":"232844536","full_name":"boundstate/craft-mailchimp","owner":"boundstate","description":"Subscribe users to Mailchimp lists in Craft CMS","archived":false,"fork":false,"pushed_at":"2023-05-26T13:56:24.000Z","size":412,"stargazers_count":0,"open_issues_count":13,"forks_count":0,"subscribers_count":3,"default_branch":"craft-4","last_synced_at":"2025-02-14T17:43:16.244Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/boundstate.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-01-09T15:48:11.000Z","updated_at":"2022-08-03T09:37:48.000Z","dependencies_parsed_at":"2025-02-14T17:49:13.063Z","dependency_job_id":null,"html_url":"https://github.com/boundstate/craft-mailchimp","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boundstate%2Fcraft-mailchimp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boundstate%2Fcraft-mailchimp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boundstate%2Fcraft-mailchimp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boundstate%2Fcraft-mailchimp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/boundstate","download_url":"https://codeload.github.com/boundstate/craft-mailchimp/tar.gz/refs/heads/craft-4","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247938331,"owners_count":21021499,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-05T10:23:49.917Z","updated_at":"2025-04-08T22:28:42.806Z","avatar_url":"https://github.com/boundstate.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Mailchimp plugin for Craft CMS 4.x\n\nSubscribe users to Mailchimp lists in Craft CMS\n\n## Installation\n\nTo install the plugin, follow these instructions.\n\n1. Open your terminal and go to your Craft project:\n\n        cd /path/to/project\n\n2. Then tell Composer to load the plugin:\n\n        composer require boundstate/craft-mailchimp\n\n3. In the Control Panel, go to Settings → Plugins and click the “Install” button for Mailchimp.\n\n4. In the Control Panel, go to Settings → Plugins → Mailchimp and configure the plugin.\n\n## Usage\n\nYour subscribe form template can look something like this:\n\n```twig\n\u003cform method=\"post\" action=\"\" accept-charset=\"UTF-8\"\u003e\n    {{ csrfInput() }}\n    \u003cinput type=\"hidden\" name=\"action\" value=\"mailchimp/subscribe\"\u003e\n    {{ redirectInput('subscribe/thanks') }}\n\n    \u003ch3\u003e\u003clabel for=\"name\"\u003eYour Name\u003c/label\u003e\u003c/h3\u003e\n    \u003cinput id=\"name\" type=\"text\" name=\"mergeFields[NAME]\" value=\"{{ subscription.mergeFields.NAME ?? '' }}\" required\u003e\n\n    \u003ch3\u003e\u003clabel for=\"email\"\u003eYour Email\u003c/label\u003e\u003c/h3\u003e\n    \u003cinput id=\"email\" type=\"email\" name=\"email\" value=\"{{ subscription.email ?? '' }}\" required\u003e\n    {{ subscription.getErrors('email')|join() }}\n\n    \u003cinput type=\"hidden\" name=\"tags[]\" value=\"Tag 1\"\u003e\n    \u003cinput type=\"hidden\" name=\"tags[]\" value=\"Tag 2\"\u003e\n\n    \u003cinput type=\"submit\" value=\"Subscribe\"\u003e\n\u003c/form\u003e\n```\n\nThe only required field is `email`. Everything else is optional.\n\n### Redirecting after submit\n\nIf you have a `redirect` hidden input, the user will get redirected to it upon successfully subscribing. The following variables can be used within the URL/path you set:\n\n- `{email}`\n- `{mergeFields}`\n- `{tags}`\n\nFor example, if you wanted to redirect to a `subscribe/thanks` page and pass the user’s name to it, you could set the input like this:\n\n```twig\n{{ redirectInput('subscribe/thanks?name={mergeFields.NAME}') }}\n```\n\nIn your `subscribe/thanks` template, you can access URL parameters using `craft.app.request.getQueryParam()`:\n\n```twig\n\u003cp\u003eThanks for subscribing, {{ craft.app.request.getQueryParam('name') }}!\u003c/p\u003e\n```\n\nNote that if you don’t include a `redirect` input, the current page will get reloaded.\n\n### Flash messages \u0026 API errors\n\nWhen a subscribe form is submitted, the plugin will set a `notice` or `success` flash message on the user session. You can display it in your template like this:\n\n```twig\n{% if craft.app.session.hasFlash('notice') %}\n    \u003cp class=\"message notice\"\u003e{{ craft.app.session.getFlash('notice') }}\u003c/p\u003e\n{% elseif craft.app.session.hasFlash('error') %}\n    \u003cp class=\"message error\"\u003e{{ craft.app.session.getFlash('error') }}\u003c/p\u003e\n{% endif %}\n```\n\nIf the Mailchimp API returns an error, the plugin also sets the `subscription.apiError` variable. You can display it in your template like this:\n\n```twig\n{% if subscription is defined and subscription.apiError %}\n    \u003ch3\u003e{{ subscription.apiError.title }}\u003c/h3\u003e\n    \u003cp\u003e{{ subscription.apiError.detail }}\u003c/p\u003e\n{% endif %}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fboundstate%2Fcraft-mailchimp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fboundstate%2Fcraft-mailchimp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fboundstate%2Fcraft-mailchimp/lists"}