-
Notifications
You must be signed in to change notification settings - Fork 1
Enhancement/update success error messages to wp admin notices #85
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
Merged
iamdharmesh
merged 24 commits into
develop
from
enhancement/update-success-error-messages-to-wp-admin-notices
Apr 7, 2025
Merged
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
b6c7b0b
Add WP admin notices to plugin settings page
MaxwellGarceau 8382b91
Move admin-notices to separate file
MaxwellGarceau 135094c
Add wp_kses to allow links for admin notices
MaxwellGarceau b6cf2a7
Use admin notices for MC list errors
MaxwellGarceau 9c02369
Remove global message output from settings page
MaxwellGarceau d30bfa3
Rename global message to frontend message
MaxwellGarceau 85c6632
Fix typo
MaxwellGarceau 222e6db
Remove void return type to maintain compatibility with php 7.0
MaxwellGarceau 90b0289
Update comment
MaxwellGarceau 8db2531
Update success message selectors in settings.test.js
MaxwellGarceau 9652226
Namespace admin notice functions
MaxwellGarceau 65ecf2b
Add autoloading via composer PSR-4
MaxwellGarceau d6bd14b
Fix lint errors
MaxwellGarceau 868a777
Update build workflows to install composer dependencies
MaxwellGarceau 1e5a9fa
Revert autoload commits
MaxwellGarceau 7fce632
Change todo note to info note
MaxwellGarceau 7aeb042
Fix lint issue
MaxwellGarceau fe3b7ba
Load admin functions with autoload
MaxwellGarceau 8d48faf
Add back the build steps for composer autoload
MaxwellGarceau da89938
Add "mailchimp_sf_global_msg" back to fix fatal error in other PR. (T…
iamdharmesh 7d78013
Fix PHPCS
iamdharmesh e9b6465
Formatting fix for the admin notice message.
iamdharmesh b9603ed
Merge branch 'develop' of github.com:mailchimp/wordpress into enhance…
iamdharmesh fc788c9
Merge branch 'develop' of github.com:mailchimp/wordpress into enhance…
iamdharmesh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| <?php | ||
| /** | ||
| * Admin notices. | ||
| * | ||
| * @package Mailchimp | ||
| */ | ||
|
|
||
| namespace Mailchimp\WordPress\Includes\Admin; | ||
|
|
||
| /** | ||
| * Display success admin notice. | ||
| * | ||
| * NOTE: WordPress localization i18n functionality should be done | ||
| * on string literals outside of this function in order to work | ||
| * correctly. | ||
| * | ||
| * For more info read here: https://salferrarello.com/why-__-needs-a-hardcoded-string-in-wordpress/ | ||
| * | ||
| * @since 1.7.0 | ||
| * @param string $msg The message to display. | ||
| * @return void | ||
| */ | ||
| function admin_notice_success( string $msg ) { | ||
| ?> | ||
| <div class="notice notice-success is-dismissible"> | ||
| <p> | ||
| <?php | ||
| echo wp_kses( | ||
| $msg, | ||
| array( | ||
| 'a' => array( | ||
| 'href' => array(), | ||
| 'title' => array(), | ||
| 'target' => array(), | ||
| ), | ||
| 'strong' => array(), | ||
| 'em' => array(), | ||
| 'br' => array(), | ||
| ) | ||
| ); | ||
| ?> | ||
| </p> | ||
| </div> | ||
| <?php | ||
| } | ||
|
|
||
| /** | ||
| * Display error admin notice. | ||
| * | ||
| * NOTE: WordPress localization i18n functionality should be done | ||
| * on string literals outside of this function in order to work | ||
| * correctly. | ||
| * | ||
| * For more info read here: https://salferrarello.com/why-__-needs-a-hardcoded-string-in-wordpress/ | ||
| * | ||
| * @since 1.7.0 | ||
| * @param string $msg The message to display. | ||
| * @return void | ||
| */ | ||
| function admin_notice_error( string $msg ) { | ||
| ?> | ||
| <div class="notice notice-error"> | ||
| <p> | ||
| <?php | ||
| echo wp_kses( | ||
| $msg, | ||
| array( | ||
| 'a' => array( | ||
| 'href' => array(), | ||
| 'title' => array(), | ||
| 'target' => array(), | ||
| ), | ||
| 'strong' => array(), | ||
| 'em' => array(), | ||
| ) | ||
| ); | ||
| ?> | ||
| </p> | ||
| </div> | ||
| <?php | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.