mailchimp-for-wordpress icon indicating copy to clipboard operation
mailchimp-for-wordpress copied to clipboard

Integration with Strong Testimonials

Open cdillon opened this issue 7 years ago • 12 comments

Following up on https://wordpress.org/support/topic/mailchimp-integration-55/

Thanks for offering to help, Danny. Something like your admin page for Contact Form 7 integration would work well. Is that what you had in mind?

The action hook for output: wpmtst_mc4wp. My test example:

function add_mailchimp_checkbox() {
	echo '<input type="checkbox" id="mc4wp" name="mc4wp" value="mc4wp"><label for="mc4wp">Sign up for our newsletter?</label>';
}
add_action( 'wpmtst_mc4wp', 'add_mailchimp_checkbox' );

The action hook upon form submission: wpmtst_form_submission. Just grab the $_POST.

Those are available in this dev branch if you want: https://github.com/cdillon/strong-testimonials/tree/dev-mc4wp

cdillon avatar May 28 '17 15:05 cdillon

Hi @cdillon,

Apologies for the late reply. That is exactly what I had in mind. The specific action for mc4wp doesn't even really need to be there, but it does help in that it allows people to choose a specific position for the checkbox & use your general UI to modify the label text.

Another (perhaps more generic) option would be for us to simply hook into some kind of "before_submit_button" action to render the checkbox field (for which the label is managed on a MailChimp for WP > Integration page and another hook into wpmtst_form_submission to process the sign-up, again using settings from the integration settings page in our plugin.

dannyvankooten avatar Jun 09 '17 08:06 dannyvankooten

@cdillon above commit will register the integration with Strong Testimonials and output the checkbox using the wpmtst_mc4wp hook. The trouble is that this requires users to both enable & configure the integration in MailChimp for WP > Integrations and then still add the action to their form.

Since it seems as if Strong Testimonials only handles one form I think we can get rid of the last step and simply output the label + checkbox right before the submit button whenever someone enables the Strong Testimonials integration on the MailChimp for WP > Integration page. I tried looking for a generic action hook in your template logic but couldn't find any. Is there an action hook that runs just before outputting the submit button? That'd be great.

Let me know what you think please.

dannyvankooten avatar Jun 09 '17 08:06 dannyvankooten

screenshot from 2017-06-09 10-20-53 Example of the settings page.

dannyvankooten avatar Jun 09 '17 08:06 dannyvankooten

Thanks @dannyvankooten. It looks great.

I do have an add-on for multiple forms. I prefer the specific action. It's the only way to change the field order in my form editor. I think the extra step is worth the flexibility. But I understand the extra support burden so we need to make it clear that both steps are necessary.

I failed to consider one important aspect before: the name field. My fields are customizable so a form may not have "client_name" and may even have something like "first_name" and "last_name". How do you handle that in your other integrations?

cdillon avatar Jun 13 '17 08:06 cdillon

There's a "field guesser" class which other dynamic form integrations depend on, which will find the email & name fields in any given array using a pretty dumb algorithm which suffices for like 95% of all use cases.

Are the field names in Strong Testimonials truly dynamic, eg can users choose them themselves? Or is there a list of set names like "client_name,name,first_name,last_name" which may be used?

dannyvankooten avatar Jun 13 '17 09:06 dannyvankooten

Truly dynamic. It's a mini form builder. I think it makes sense to handle the assignment in my UI when the user selects the MC4WP field which would mean the form would need to copy the name field(s) to hidden static fields like mc4wp_first_name and mc4wp_last_name. The benefit is that I can catch configuration errors immediately if someone changes the name field (it happens).

cdillon avatar Jun 13 '17 09:06 cdillon

Hi @cdillon, that makes sense although the field mapping is somewhat complicated right now as MailChimp for WordPress allows to subscribe to multiple MailChimp lists at once. Right now we usually tell our users to do the mapping themselves using a filter hook, although we hope to improve on that soon.

Our side of the integration is ready, just without the additional fields right now (as with much of our other integrations). I haven't yet released this as it seems the current stable version of ST does not yet contain the "action" field code.

I'd love it if we could move forward on this by getting the current stuff out there first, and then working from there if it turns out many users need the additional field mapping. What do you think?

dannyvankooten avatar Jun 19 '17 09:06 dannyvankooten

Hi @dannyvankooten, I apologize for the delay. I got sidetracked by another issue.

While some of my users can handle filters, many cannot. I prefer to handle the field mapping from the start to avoid a deluge of support requests. I'm flying solo here. :)

I propose an array of fields in the $_POST like this:

[mc4wp] => Array 
  (
     [FNAME] => Chris
     [LNAME] => Dillon
  )

Users will have to enter the merge tag in my fields editor. The burden is on them to find and use the correct tag. I will consider fetching the tags via the MailChimp API in the future.

mailchimp_merge_tag

Will that work?

cdillon avatar Jun 19 '17 12:06 cdillon

This dev branch adds the mapped fields array as described above. Please let me know what you think. https://github.com/cdillon/strong-testimonials/tree/dev-form-mc4wp

cdillon avatar Jun 21 '17 12:06 cdillon

Hi @dannyvankooten, any progress on this? Anything I can do to help?

cdillon avatar Jul 24 '17 10:07 cdillon

Hi, Any news on this? It would be a really useful option either way you decide to create it.

Thanks

alexandramisleanu avatar Feb 05 '18 14:02 alexandramisleanu

Hey, sorry for being a little absent here, my daughter was born a few months ago so that left me with a huge backlog to work through. Sorry.

The strong-testimonials branch here for MailChimp for WordPress is still at this point:

Our side of the integration is ready, just without the additional fields right now (as with much of our other integrations). I haven't yet released this as it seems the current stable version of ST does not yet contain the "action" field code.

@cdillon Did anything change in ST and do you agree that we should ship this as an initial version and then work from there? A really large part (I don't have real numbers but if I had to guess, definitely at least 7 out of 10) of our users do not use any of the additional fields and just want to send an email address + name to their MailChimp list, so it would be nice to help those out already.

dannyvankooten avatar Feb 05 '18 15:02 dannyvankooten