{"id":19894592,"url":"https://github.com/amarkal/amarkal-admin-notification","last_synced_at":"2025-05-02T20:30:42.816Z","repository":{"id":62488693,"uuid":"63735255","full_name":"amarkal/amarkal-admin-notification","owner":"amarkal","description":"Add static/dismissible admin notifications to WordPress","archived":false,"fork":false,"pushed_at":"2017-12-24T22:02:03.000Z","size":29,"stargazers_count":16,"open_issues_count":1,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-07T05:11:12.374Z","etag":null,"topics":["amarkal","wordpress","wordpress-framework"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/amarkal.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-07-19T23:47:13.000Z","updated_at":"2023-10-03T00:05:56.000Z","dependencies_parsed_at":"2022-11-02T11:00:53.387Z","dependency_job_id":null,"html_url":"https://github.com/amarkal/amarkal-admin-notification","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amarkal%2Famarkal-admin-notification","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amarkal%2Famarkal-admin-notification/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amarkal%2Famarkal-admin-notification/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amarkal%2Famarkal-admin-notification/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/amarkal","download_url":"https://codeload.github.com/amarkal/amarkal-admin-notification/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252103930,"owners_count":21695388,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["amarkal","wordpress","wordpress-framework"],"created_at":"2024-11-12T18:33:56.410Z","updated_at":"2025-05-02T20:30:42.560Z","avatar_url":"https://github.com/amarkal.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# amarkal-admin-notification [![Build Status](https://scrutinizer-ci.com/g/amarkal/amarkal-admin-notification/badges/build.png?b=master)](https://scrutinizer-ci.com/g/amarkal/amarkal-admin-notification/build-status/master) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/amarkal/amarkal-admin-notification/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/amarkal/amarkal-admin-notification/?branch=master) [![License](https://img.shields.io/badge/license-GPL--3.0%2B-red.svg)](https://raw.githubusercontent.com/amarkal/amarkal-admin-notification/master/LICENSE)\n**amarkal-admin-notification** lets you add static/dismissible notifications to the WordPress administration. Dismissible notifications are permanently dismissed and will not show when the page reloads. For an in-depth tutorial, see [Adding Static/Dismissible Admin Notifications to WordPress](https://blog.askupasoftware.com/adding-staticdismissible-admin-notifications-wordpress/)\n\n![amarkal-admin-notification - ](https://askupasoftware.com/wp-content/uploads/2014/01/wp-admin-notifications.gif)\n\n## Overview\n**amarkal-admin-notification** lets you easily add notifications to the WordPress administration with different options to choose from. In WordPress 4.2 [dismissible notifications became supported](https://make.wordpress.org/core/2015/04/23/spinners-and-dismissible-admin-notices-in-4-2/). However, a dismissed notification becomes visible again when the user refreshes the page or navigates away. **amarkal-admin-notification** handles that by storing an option in the database once a notification is dismissed.  \n**amarkal-admin-notification** is lightweight and trace free - it will only initiate if there is at least one registered notification, and will only store a database option if a user dismisses a notification. `amarkal_reset_admin_notification()` will remove the option from the database if there are no more dismissed notifications.\n\n## Installation\n\n### Via Composer\n\nIf you are using the command line:  \n```\n$ composer require askupa-software/amarkal-admin-notification:dev-master\n```\n\nOr simply add the following to your `composer.json` file:\n```javascript\n\"require\": {\n    \"askupa-software/amarkal-admin-notification\": \"dev-master\"\n}\n```\nAnd run the command \n```\n$ composer install\n```\n\nThis will install the package in the directory `vendors/askupa-software/amarkal-admin-notification`.\nNow all you need to do is include the composer autoloader.\n\n```php\nrequire_once 'path/to/vendor/autoload.php';\n```\n\n### Manually\n\n[Download the package](https://github.com/amarkal/amarkal-admin-notification/archive/master.zip) from github and include `bootstrap.php` in your project:\n\n```php\nrequire_once 'path/to/amarkal-admin-notification/bootstrap.php';\n```\n\n## Usage\n\n### amarkal_admin_notification\n*Register a notification to be printed in the administration.*\n```php\namarkal_admin_notification( $handle, $html, $type = 'success', $dismissible = false, $class = '', $network = false )\n```\nThis function is used to register a notification for a given handle. The handle is used as the notification's ID. If the notification is dismissible, the handle is used to permanently dismiss the notification. When a dismissible notification is dismissed, the `amarkal_dismissed_notices` option is updated with the handle added to it.\n\n**Parameters**  \n* `$handle` (*String*) The notification's ID. Also used to permanently dismiss a dismissible notification. If a given handle has previously been registered, a PHP notice will be triggered.\n* `$html` (*String*)  The text/HTML content of the notification.\n* `$type` (*String*)  The notification's type. One of `error`, `warning`, `info`, `success`.\n* `$dismissible` (*Boolean*)  Whether to add a \"dismiss\" button to allow the user to permanently dismiss the notification.\n* `$class` (*String*)  An additional CSS class to be added to the notification for styling purposes.\n* `$network` (*Boolean*)  Whether to show this notification in the network administration as well. Uses the [network_admin_notices](https://codex.wordpress.org/Plugin_API/Action_Reference/network_admin_notices) hook internally.\n\n### amarkal_reset_admin_notification\n*Reset a dismissible notification.*\n```php\namarkal_reset_admin_notification( $handle )\n```\nThis function can be used to make a previously dismissed notification visible again. It does that by removing the given `$handle` from the list of dismissed notifications stored in the option `amarkal_dismissed_notices`. If the list of dismissed notification is empty, the option will be removed from the database.\n\n**Parameters**  \n* `$handle` (*String*)  The handle of the notification to be reset.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famarkal%2Famarkal-admin-notification","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famarkal%2Famarkal-admin-notification","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famarkal%2Famarkal-admin-notification/lists"}