Search

Hello folks,

In my current project I need to integrate a Symphony install with Mailchimp, and I've done so with the Mailchimp extension. I have two forms:

  1. Mailing list signup form: this will be implemented using the Mailchimp event provided by the extension above.
  2. "Contact us" form with a signup checkbox: when the checkbox is checked the user is also signed up to the mailing list.

For the second form I thought that the best solution would be to create a custom Mailchimp event that would only trigger when the checkbox was checked. I have tried to duplicate the event that is part of the Mailchimp extension, appending "-custom" where appropriate, however my custom event simply won't show up in the front end. I have tried to look for documentation but I was unable to find much really. Could anybody kindly clarify this for me please?

Thanks for your time!

Hmm did you also rename the file with _custom as usually that would be required to match.

As regards the functionality you describe, I wouldn't create a separate event, but rather submit the two events at one go, by setting the value of the checkbox to the action parameter required by the mailchimp event, if not mistaken that should also trigger the event.

If you'd like to separate for UI purposes, you can use XLST to check which events were submitted, and then display the UI accordingly. If you're using AJAX submission both of the above would probably be much simpler as you can trigger a subscribe separately after the form is submitted.

@gunglien, I did add _custom to the filename alongside the various functions, etc., but that didn't make a difference unfortunately.

If your suggestion of adding the action parameter to the checkbox really works, then I won't need to duplicate anything. I'll try that and report back. Thanks a lot!

Actually, I just realised that some fields will be needed by two events at the same time, namely the name, surname and email address, which will be needed both by the reservation event and by the Mailchimp event if the checkbox was checked. Is there any way that I can make an input field be attached to multiple events, e.g.:

<input type="text" name="fields[event1],fields[event2]" />

Thank you :)

hmmm :/ don't think that works. I'm pretty confident that if the field names are the same, they should work/trigger for both events.

Otherwise, you could just have a 'hidden field' which is updated with javascript on key-up/focus-out so it would replicate the exact same value.

Thanks for the feedback, however I don't really want to rely on javascript altogether, as users can disable it, and in that case there wouldn't be any fallback. I guess the best option again would be to have a custom event which I can manipulate via PHP and trigger only when the checkbox is checked and use the same field names as the other event. But how do I do that? :)

To reply to my own question, I just found that in order to have an event show up in the backend, both the event class name and the filename must have the same name, e.g., the class is called eventMailchimp_Custom and the filename is event.mailchimp_custom.php. This was such a simple thing that I feel stupid now… I hope it will help anyone else with a similar question (or quite possibly, my future self!) :)

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details