3

When adding/deleting/editing a category in the CP, I would like to send that data to Mailchimp (where I ultimately will have the same categories)

How can this be achieved? Using a Action or a Hook? And how?
I'm reading up on making Plugins, Hooks,... but I'm not sure wich Hook I can use and where to place it.

Thanks!

4

Unfortunately, there is no hook that runs after creating new categories, which is a shame. (You can find a list of available extension hooks here.)

You could try writing an extension that uses the sessions_end hook, then checks for the various $_GET variables that indicate that you just created a new category, but that wouldn't account for times when someone submits the "new category" form and receives errors, nor for when someone creates a new category via the links found on the Publish Form (which are created via AJAX).

So your only alternative I believe is to write a module which does this directly by polling the database (looking at exp_categories) and comparing it to your MailChimp categories, then making changes as required. You would configure this using an "action" (which allows you to trigger your method with a URL like http://mysite.com/?ACT=10), and setup a cron job on your server to run this acton periodically.

Hope that helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.