Closed benlk closed 5 years ago
@kaylima assigning this to you for several tasks:
The WordPress Mailchimp API submodule https://bitbucket.org/mailchimp/mailchimp-api-php hasn't been updated since 2015.
The Mailchimp API settings block seen in https://github.com/INN/link-roundups/blob/136-update-wordpress-mailchimp-tools/docs/mailchimp.md isn't appearing, in my specific install, at this time. This appears to be because my install lacks the entire vendor/
directory of components, which was present in wp-release.zip
above. I don't know where or how that came from, and git submodule update --init --recursive
is failing to create at least one submodule that should be in the vendor/
directory.
Next steps:
Correction: the MailChimp settings page is no longer in Link Roundups > Options; it's in Settings > MailChimp Settings. This is true of both the pure-git-clone branch and the wp-release.zip install above.
Edited 2019-05-02 to add: This, too, was caused by https://github.com/INN/link-roundups/commit/675a1631f85cb056ca183206749e1cf60b9bc498's removal of a lot of code into the INN/wordpress-mailchimp-tools module
After enabling the MailChimp API key in the energynews.test
site settings, the site begins timing out when trying to reach https://energynews.test/wp-admin/edit.php?post_type=roundup&page=roundup_mailchimp_settings
The timing-out page doesn't come from this plugin directly; it's generated by the WordPress MailChimp Tools:
I'm guessing this is because the API query to get the list of campaigns, which runs on every fetch of the page, is timing out:
The Mailchimp Tools Settings Page only displays 10 templates; the account I'm testing with has more than 10.
10
count in the same spot in the post editorDraft created? Yes. Send a drafted campaign? Yes. Campaign works as described? No.
So it looks like 675a1631f85cb056ca183206749e1cf60b9bc498 removed this bit by removing the entire inc/lroundups/mailchimp-admin.php
:
function _lroundups_render_mailchimp_template( $source, $post ) {
$author = get_user_by( 'id', $post->post_author );
$tags = array(
'*|ROUNDUPLINKS|*' => apply_filters( 'the_content', $post->post_content ),
'*|ROUNDUPTITLE|*' => $post->post_title,
'*|ROUNDUPAUTHOR|*' => $author->display_name,
'*|ROUNDUPDATE|*' => get_the_date( '',$post->ID ),
'*|ROUNDUPPERMALINK|*' => get_post_permalink( $post->ID )
);
foreach ( $tags as $tag => $value )
$source = str_replace( $tag, $value, $source );
return $source;
}
That commit just outright removed the file, and the file doesn't appear to have been replaced. Nor was the functionality in there.
That was release v0.4.
I remember us having bug reports about it, but I can't find an issue for it.
In https://secure.helpscout.net/conversation/573233977/1940?folderId=1259183 on May 30, 2018:
I wanted to make sure that MailChimp merge tags worked, and they do in the single-column templates we were experimenting with (Sherry made one and I made an additional one to troubleshoot). Neither will pull in the link roundup tags. I tried in caps and in all lowercase in case it was a syntax error on my part. None of the other link roundup tags were working for me either (
*|ROUNDUPAUTHOR|*
, etc.). Do you have any idea of where we went wrong?
What's not clear there yet is:
The removed function was applied here:
/**
* Replace the template tags in the MailChimp post
*/
$html = _lroundups_render_mailchimp_template( $template_info['source'], $post );
$campaign_content = array(
'html' => $html, // the content!
'text' => '' // Leave blank for the auto-generated text content
);
The analogous functionality in the current WP MC Tools is:
But there's no way to configure the parameters that are set on that email. So:
template
parameter: https://developer.mailchimp.com/documentation/mailchimp/reference/campaigns/content/#%20mc:edit=""
areas, which will be filled with the information from the parameters https://templates.mailchimp.com/getting-started/template-language/It is currently creating the email, but entirely replacing the content of the email with the *|ROUNDUPLINKS|*
content rather than filling the template areas. This should be investigated.
Right now it's using a drag-and-drop template with a block that contains the following:
This should be the roundup title:
<section mc:edit="ROUNDUPTITLE">This should be replaced with the roundup title</section>
This should be the roundup author:
<section mc:edit="ROUNDUPAUTHOR">This should be replaced with the roundup author</section>
This should be the roundup date:
<section mc:edit="ROUNDUPDATE">This should be replaced with the roundup date</section>
This should be the roundup links:
<section mc:edit="ROUNDUPLINKS">This should be replaced with the roundup links</section>
This should be the roundup permalink:
<section mc:edit="ROUNDUPPERMALINK">This should be replaced with the roundup permalink</section>
<hr />
<h1 style="text-align: center;">*|ROUNDUPTITLE|*</h1>
<p><em>*|ROUNDUPAUTHOR|* — *|ROUNDUPDATE|*</em></p>
*|ROUNDUPLINKS|*
<p>Originally posted at *|ROUNDUPPERMALINK|*</p>
It's not possible to get the whole default content of a template via the API.
The closest thing is https://developer.mailchimp.com/documentation/mailchimp/reference/templates/default-content/, which returns the default content of the various editable areas defined in the template, but not the whole body content of the campaign. Therefore, the approach taken in the previous version of the WordPress MailChimp Tools to set the $html parameter to the post content will not work for the Link Roundup Plugin's purposes.
The filter introduced in https://github.com/INN/wordpress-mailchimp-tools/commit/4e768f7661a2fe8fc2785140e8313280eb230c3f will have to be used to set the HTML parameter on the campaign content, if the user of the WMT package desires to have that set.
Because the whole content cannot be accessed, the idea of filtering that content for the various merge tags in this plugin to do a search and replace for this plugin's desired content output is no longer valid.
*|ROUNDPLINKS|*
and other such tags$html
in https://github.com/INN/wordpress-mailchimp-tools/blob/6271fd78bce655f4dfd8c685cf4f024d0c8ee923/inc/admin/class-mailchimp-campaign-editor.php#L233-L241Consolidating earlier checklists:
*|ROUNDPLINKS|*
and other such tagsmc:edit=""
areas, which will be filled with the information from the parameters https://templates.mailchimp.com/getting-started/template-language/🎉
Next step: Someone please test that this works for them.
Changes
This PR merges the last couple year's work from the WordPress Mailchimp Tools repo into this plugin. Resolves https://github.com/INN/link-roundups/issues/136
Notable change from https://github.com/INN/wordpress-mailchimp-tools/commits/master:
Also:
Source:
label in the Saved Links List widget in aspan.source-label
, resolves https://github.com/INN/link-roundups/issues/144release.sh
and adds maintainer docs, resolves https://github.com/INN/link-roundups/issues/140Tested up to:
to 5.2 and adds a minimum PHP version, resolves https://github.com/INN/link-roundups/issues/134Testing
Can these steps still be followed? https://github.com/INN/link-roundups/blob/master/docs/mailchimp.md
Why
To address several PHP errors and notices in the WordPress MailChimp Tools.
To support the new version of the MailChimp API, introduced in 2017: https://mailchi.mp/f2bbb62b3016/were-shutting-down-api-11-12-and-13