Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integration with Strong Testimonials #442

Open
cdillon opened this issue May 28, 2017 · 12 comments
Open

Integration with Strong Testimonials #442

cdillon opened this issue May 28, 2017 · 12 comments

Comments

@cdillon
Copy link

cdillon commented May 28, 2017

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

@dannyvankooten
Copy link
Member

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
Copy link
Member

@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
Copy link
Member

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

@cdillon
Copy link
Author

cdillon commented Jun 13, 2017

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?

@dannyvankooten
Copy link
Member

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?

@cdillon
Copy link
Author

cdillon commented Jun 13, 2017

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).

@dannyvankooten
Copy link
Member

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?

@cdillon
Copy link
Author

cdillon commented Jun 19, 2017

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
Copy link
Author

cdillon commented Jun 21, 2017

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
Copy link
Author

cdillon commented Jul 24, 2017

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

@alexandramisleanu
Copy link

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

Thanks

@dannyvankooten
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants