{"id":65474,"date":"2016-07-17T22:07:06","date_gmt":"2016-07-17T22:07:06","guid":{"rendered":"https:\/\/wordpress.org\/plugins\/admin-notices\/"},"modified":"2016-07-17T22:07:06","modified_gmt":"2016-07-17T22:07:06","slug":"admin-notices","status":"closed","type":"plugin","link":"https:\/\/wordpress.org\/plugins\/admin-notices\/","author":14472519,"comment_status":"closed","ping_status":"closed","template":"","meta":{"version":"","stable_tag":"trunk","tested":"","requires":"","requires_php":"","requires_plugins":"","header_name":"admin-notices","header_author":"","header_description":"","assets_banners_color":"","last_updated":"2016-07-17 22:07:06","external_support_url":"","external_repository_url":"","donate_link":"","header_plugin_uri":"https:\/\/github.com\/Solpatium\/WP-Admin-Notices\/archive\/master.zip","header_author_uri":"","rating":0,"author_block_rating":0,"active_installs":30,"downloads":511,"num_ratings":0,"support_threads":0,"support_threads_resolved":0,"author_block_count":0,"sections":[],"tags":[],"upgrade_notice":[],"ratings":[],"assets_icons":[],"assets_banners":[],"assets_blueprints":{},"all_blocks":[],"tagged_versions":[],"block_files":[],"assets_screenshots":[],"screenshots":[]},"plugin_section":[],"plugin_tags":[],"plugin_category":[],"plugin_contributors":[],"plugin_business_model":[],"class_list":["post-65474","plugin","type-plugin","status-closed","hentry","plugin_committers-solpatium"],"banners":[],"icons":{"svg":false,"icon":"https:\/\/s.w.org\/plugins\/geopattern-icon\/admin-notices.svg","icon_2x":false,"generated":true},"screenshots":[],"raw_content":"","raw_excerpt":"<p># WP Admin Notices<br \/>\nA Wordpress developer&#039;s plugin that makes adding notices less painful. I felt a need for something like this while working on a project and decided to make one.<\/p>\n<p>### Setup<br \/>\nAlthought this code can be used as a plugin, I reccomend using it within your own plugin, just include <code>admin-notices.php<\/code> in your code - otherwise if user accidently turns off this plugin your code will produce errors.<\/p>\n<p>Using this code as a plugin is simple - just add folder to wp-content\/plugins folder and turn it in the admin panel. For multisite turn this plugin network wide (if you want to have multisite funcionality of course).<\/p>\n<p>### Usage<\/p>\n<p>Plugin provides a very simple API, althought I reccomend using defined classes.<br \/>\n##### Functions (wrappers for creating objects):<br \/>\n- single site (not multisite) functions:<br \/>\n    - <code>add_user_notice( int $user_id, string $content [, array $args ] )<\/code><br \/>\n    - <code>add_current_user_notice( string $content [, array $args ] )<\/code><br \/>\n    - <code>add_users_notice( array $users_ids, string $content [, array $args ] )<\/code><br \/>\n- multisite functions:<br \/>\n    - <code>mu_add_user_notice( int $user_id, string $content [, array $args ] )<\/code><br \/>\n    - <code>mu_add_current_user_notice( string $content [, array $args ] )<\/code><br \/>\n    - <code>mu_add_users_notice( array $users_ids, string $content [, array $args ] )<\/code><\/p>\n<p>##### Arguments:<br \/>\n- <code>$content<\/code> - Notice content. It gets wrapped in paragraph. Must be a string.<br \/>\n- <code>$args<\/code> - General arguments in an associative array. Possible are:<br \/>\n    -  <code>user_id<\/code> - User&#039;s ID for who you want to display notice. By default is set to current user id<br \/>\n    -  <code>type<\/code> - Notice&#039;s type. Possible are:<br \/>\n        - <code>&amp;quot;success&amp;quot;<\/code> (green)<br \/>\n        - <code>&amp;quot;error&amp;quot;<\/code> (red)<br \/>\n        - <code>&amp;quot;warning&amp;quot;<\/code> (orange)<br \/>\n        - _[default]_ <code>&amp;quot;info&amp;quot;<\/code> (blue)<br \/>\n        - <code>&amp;quot;blank&amp;quot;<\/code> (no color)<br \/>\n    -   <code>place<\/code> - Determines where the notice should be displayed. For now the possibilities are rather small:<br \/>\n        - _[default]_ <code>&amp;quot;all&amp;quot;<\/code> - notice is displayed everywhere on the admin panel<br \/>\n        - <code>post_id)<\/code> - notice is displayed on edit screen of a post of this id (works with products as well). Must be an intiger<br \/>\n        - <code>page_name<\/code> - id of an admin page (contained by WP_Screen object)<br \/>\n    -  <code>display<\/code> - Determines how notice should be displayed:<br \/>\n        - <code>until_closed<\/code> - Notice is displayed on the refreshes until gets deleted by link under it. Useful when you want to be sure that user has noticed your message<br \/>\n        - _[default]_ <code>&amp;quot;once&amp;quot;<\/code> - Notice is displayed just once and can be closed by X button<\/p>\n<p>#### That should be enough to use this plugin, more info below:<br \/>\n###### Deleting all notices<br \/>\nYou can delete all user notices by using <code>Admin_Notice::delete_all_user_notices( int $user_id )<\/code> for single sites and <code>MU_Admin_Notice::delete_all_user_notices( int $user_id )<\/code> if you want to remove global user notices.<br \/>\n###### Tests<br \/>\nYou can remove comment in admin-notices.php saying &quot;ONLY FOR TESTS&quot; to launch test. Make sure you comment it again after the code gets executed (on viewing admin panel).<\/p>\n<p>### That&#039;s all.<br \/>\nI hope someone finds it useful :)\n<\/p>","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/65474","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=65474"}],"author":[{"embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/solpatium"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=65474"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=65474"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=65474"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=65474"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=65474"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=65474"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}