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

Notices from [paypal] shortcode causes Gutenberg to report Updating failed #101

Open
bobbingwide opened this issue Feb 5, 2018 · 2 comments

Comments

Projects
None yet
1 participant
@bobbingwide
Copy link
Owner

commented Feb 5, 2018

Problem

The following shortcode produces a Notice during expansion

[paypal type="pay" shipadd="0"]

Notice: Undefined index: amount in plugins\oik\shortcodes\oik-paypal.php on line 133

When saving the post in Gutenberg the response is
image

Problem explanation

  • The default [paypal] shortcode, generated by oik's paypal button does not include an amount.
  • During shortcode expansion the Notice is produced
  • Gutenberg's use of the REST API means that this Notice is returned to the JavaScript in the browser
  • It can't handle it
  • So reckons that the update has failed.
  • Which isn't actually true.

Proposed solution

There are two things here:

  1. The paypal shortcode should not produce Notices or Warnings.
  2. Gutenberg should be more resilient to common PHP problems.

For oik, we can only address the first part.

  • It's true that the notice message is produced when the page is viewed and WP_DEBUG is true
  • But that was quite helpful.
  • It triggered a user response to correct the shortcode.
  • We'll have to do something different now.

Workaround

Correct the shortcode to add the missing amount= parameter.

[paypal type=pay shipadd=0 amount=101]

Long term solution

Implement the PayPal button as a block.

@bobbingwide

This comment has been minimized.

Copy link
Owner Author

commented Feb 8, 2018

I've now raised an issue against Gutenberg to improve its resilience.

@bobbingwide bobbingwide changed the title Notices from [paypal] shortcode cause Gutenberg to report failure Notices from [paypal] shortcode causes Gutenberg to report Updating failed Feb 8, 2018

@bobbingwide

This comment has been minimized.

Copy link
Owner Author

commented Nov 18, 2018

Note. At present, the Paypal button doesn’t work. It doesn’t display the dialog box. See #100

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.