Skip to content

Mailchimp: save a shortcode when pasting a form code in the widget#7991

Merged
zinigor merged 1 commit intofix/mailchimp-shortcode-7945from
fix/mailchimp-widget-save-7960
Oct 18, 2017
Merged

Mailchimp: save a shortcode when pasting a form code in the widget#7991
zinigor merged 1 commit intofix/mailchimp-shortcode-7945from
fix/mailchimp-widget-save-7960

Conversation

@jeherve
Copy link
Copy Markdown
Member

@jeherve jeherve commented Oct 13, 2017

Important: this PR is set to be merged into the fix/mailchimp-shortcode-7945 branch, since the widget is broken right now and this PR couldn't be tested without the changes included in #7989

Fixes #7960
Fixes #7990

  • The widget now calls the shortcode file even when the shortcodes are not active, so you do not need to activate the shortcode module for this to work.
  • On save, the widget uses the reversal function provided in the shortcode to save a valid shortcode.
  • That shortcode is then displayed in the widget, as before.

Testing instructions:

  1. Start activating both the widget and the shortcode module.
  2. Add “MailChimp Subscriber Popup (Jetpack)” widget in a widget area.
  3. Copy code from mail chimp into the code area, as explained in the documentation:
    https://en.support.wordpress.com/mailchimp/
  4. Save & watch the script get transformed into a shortcode.
  5. The form should appear on your site.

Repeat those steps when the Shortcodes module is deactivated; nothing should change.

Proposed changelog entry for your changes:

  • Mailchimp: do not require the use of the shortcodes feature to use the Mailchimp widget.
  • Mailchimp: fix issue where Mailchimp form code could not be added to the Mailchimp widget.

Fixes #7960
Fixes #7990

- The widget now calls the shortcode file even when the shortcodes are not active, so you do not need to activate the shortcode module for this to work.
- On save, the widget uses the reversal function provided in the shortcode to save a valid shortcode.
- That shortcode is then displayed in the widget, as before.
@jeherve jeherve added [Feature] Extra Sidebar Widgets [Feature] Shortcodes / Embeds [Pri] High [Status] Needs Review This PR is ready for review. Bug When a feature is broken and / or not performing as intended labels Oct 13, 2017
@jeherve jeherve self-assigned this Oct 13, 2017
@jeherve jeherve requested a review from a team as a code owner October 13, 2017 21:12
Copy link
Copy Markdown
Contributor

@dereksmart dereksmart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@dereksmart dereksmart added [Status] Ready to Merge Go ahead, you can push that green button! and removed [Status] Needs Review This PR is ready for review. labels Oct 17, 2017
@zinigor zinigor merged commit 2633540 into fix/mailchimp-shortcode-7945 Oct 18, 2017
@zinigor zinigor deleted the fix/mailchimp-widget-save-7960 branch October 18, 2017 09:24
@zinigor zinigor removed the [Status] Ready to Merge Go ahead, you can push that green button! label Oct 18, 2017
zinigor added a commit that referenced this pull request Oct 19, 2017
This is needed since #7991 has landed in Jetpack. There is a particular edge case that illustrates the problem. After #7991 the widget would check if a shortcode is present, and would load it if it wasn't. If then the shortcode would try to include that file again, it would fatal. This could happen when you have the widgets module enabled, and shortcode modules disabled. The fatal would appear in the request when you're trying to enable the shortcodes module.
oskosk pushed a commit that referenced this pull request Oct 19, 2017
This is needed since #7991 has landed in Jetpack. There is a particular edge case that illustrates the problem. After #7991 the widget would check if a shortcode is present, and would load it if it wasn't. If then the shortcode would try to include that file again, it would fatal. This could happen when you have the widgets module enabled, and shortcode modules disabled. The fatal would appear in the request when you're trying to enable the shortcodes module.
jeherve added a commit that referenced this pull request Oct 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug When a feature is broken and / or not performing as intended [Feature] Extra Sidebar Widgets [Feature] Shortcodes / Embeds [Pri] High

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants