feat: add subscribe notice in dashboard#1139
Conversation
|
Plugin build for e94c4bd is ready 🛎️!
Note You can preview the changes in the Playground |
29edca3 to
13b88ee
Compare
Add the JS and CSS into a single PHP file since it will used only one time
There was a problem hiding this comment.
Pull Request Overview
This PR adds a subscription notice to the dashboard that appears when users skip the subscription step during onboarding. The notice allows users to subscribe to updates or dismiss it permanently.
- Adds a new subscribe notice template that displays on the dashboard for users who skipped onboarding subscription
- Implements AJAX handlers for subscription and notice dismissal functionality
- Tracks user subscription status and notice dismissal state through WordPress options
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| includes/layouts/feedzy-support.php | Conditionally displays the subscribe notice and reformats some existing HTML |
| includes/layouts/feedzy-subscribe-notice.php | New template file containing the subscription notice UI, styling, and JavaScript |
| includes/feedzy-rss-feeds.php | Registers the new AJAX action for dashboard subscription handling |
| includes/admin/feedzy-rss-feeds-admin.php | Adds subscription tracking and implements AJAX handlers for the dashboard notice |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.
| $onboarding_user_subscribed = get_option( 'feedzy_onboarding_user_subscribed' ); | ||
| $subscribed_notice_dismissed = get_option( 'feedzy_dismiss_subscribe_notice_dashboard' ); | ||
|
|
||
| if ( 'yes' !== $onboarding_user_subscribed && 'yes' !== $subscribed_notice_dismissed ) { |
There was a problem hiding this comment.
This PHP code is placed outside of PHP tags and will be rendered as plain text in the HTML output. It should be moved inside the PHP block that starts on line 5.
| $subscribed_notice_dismissed = get_option( 'feedzy_dismiss_subscribe_notice_dashboard' ); | ||
|
|
||
| if ( 'yes' !== $onboarding_user_subscribed && 'yes' !== $subscribed_notice_dismissed ) { | ||
| load_template( FEEDZY_ABSPATH . '/includes/layouts/feedzy-subscribe-notice.php' ); |
There was a problem hiding this comment.
This PHP code is also outside of PHP tags and will be rendered as plain text. It should be moved inside the PHP block.
| if ( 'yes' !== $onboarding_user_subscribed && 'yes' !== $subscribed_notice_dismissed ) { | ||
| load_template( FEEDZY_ABSPATH . '/includes/layouts/feedzy-subscribe-notice.php' ); | ||
| } | ||
|
|
There was a problem hiding this comment.
This closing brace is outside of PHP tags and will be rendered as plain text. It should be moved inside the PHP block.
| } |
| */ | ||
|
|
||
| ?> | ||
| <div class ="feedzy-container"> |
There was a problem hiding this comment.
There's an extra space in the class attribute. It should be class="feedzy-container" instead of class ="feedzy-container".
| <div class ="feedzy-container"> | |
| <div class="feedzy-container"> |
| const handleSubscription = async (button) => { | ||
| try { | ||
| hideError(); | ||
| const withSubscribe = button.dataset.fz_subscribe || true; |
There was a problem hiding this comment.
The logical OR with true will always result in true regardless of the dataset value. This should likely be button.dataset.fz_subscribe !== 'false' or similar logic to properly check the dataset value.
| const withSubscribe = button.dataset.fz_subscribe || true; | |
| const withSubscribe = button.dataset.fz_subscribe !== 'false'; |
| $this->dismiss_subscribe_notice(); | ||
| wp_send_json_success(); | ||
| } else { | ||
| wp_send_json_error( |
There was a problem hiding this comment.
There's a trailing space after the opening parenthesis. It should be wp_send_json_error( without the trailing space.
| wp_send_json_error( | |
| wp_send_json_error( |
|
🎉 This PR is included in version 5.1.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Summary
The user is now prompted with a notice after skipping the subscription step in the setup wizard page.
Will affect visual aspect of the product
YES
Screenshots
Closes https://github.com/Codeinwp/feedzy-rss-feeds-pro/issues/875