-
Notifications
You must be signed in to change notification settings - Fork 802
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
Shield memberships blocks for unconnected jetpack sites #39390
Shield memberships blocks for unconnected jetpack sites #39390
Conversation
Use of Jetpack_Memberships::is_enabled_jetpack_recurring_payments()
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 The e2e test report can be found here. Please note that it can take a few minutes after the e2e tests checks are complete for the report to be available. Follow this PR Review Process:
Still unsure? Reach out in #jetpack-developers for guidance! Jetpack plugin: The Jetpack plugin has different release cadences depending on the platform:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. |
projects/plugins/jetpack/modules/memberships/class-jetpack-memberships.php
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good and this tested as expected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to test well for me on WordPress.com Simple.
@millerf and @jeherve, as part of this project (pbNhbs-bHl-p2) we are trying to make the connection nudge consistent across Jetpack including the editor with the Jetpack blocks. Read this comment for more context (pbNhbs-bHl-p2#comment-23877) but we were wondering if we could initialize the blocks in the case of a site without a connected user and show a connection banner instead? That way the user still knows they exist and can still find them, but is directed towards what to do to resolve the issue. cc: @robertsreberski The banner would look like it does in this PR and is currently used in the AI block. |
FYI, this PR is what I have in mind for this |
That seems like a better user experience indeed. We would just need to account for cases like this PR solved: some blocks may need the user connection to display their original state or to make an API request that will return information the block needs. For such blocks, it would be better if there was some kind of placeholder state imo. |
In the PR that I shared, the connection banner component there is a prop called "explanation" that displays a message as to what they'd be connecting their user account for (ex. "Connect your WordPress.com account to enable payment buttons on your site.") Was that the kind of thing you had in mind or am I misunderstanding? |
The PR I opened got approved but I'll wait for confirmation that is what you meant before merging 😄 |
* Do not register memberships buttons when site is not available Use of Jetpack_Memberships::is_enabled_jetpack_recurring_payments() * Create add-shield-memberships-blocks-for-unconnected-jetpack-sites * Introduce should_enable_monetize_blocks_in_editor * Use manager * Replace ( defined( 'IS_WPCOM' ) && IS_WPCOM ) with ( new Host() )->is_wpcom_simple() * Use $is_offline_mode * return is_enabled_jetpack_recurring_payments() in front-end * Update add-shield-memberships-blocks-for-unconnected-jetpack-sites * Prevent paid-content to be displayed if the site is not connected
Fixes #39308
Proposed changes:
Jetpack_Memberships::is_enabled_jetpack_recurring_payments()
Note: Simple payments blocks. (aka as Paypal button) is not shielded as it does not need a JP connection to be working
Other information:
Jetpack product discussion
See #39308 (comment)
Does this pull request change what data or activity we track or use?
No
Testing instructions:
wp-admin/admin.php?page=my-jetpack