Download the PHP package collizo4sky/persist-admin-notices-dismissal without Composer

On this page you can find all versions of the php package collizo4sky/persist-admin-notices-dismissal. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package persist-admin-notices-dismissal

Persist Admin notice Dismissals

Latest Stable Version Total Downloads

Simple framework library that persists the dismissal of admin notices across pages in WordPress dashboard.

Installation

Run composer require collizo4sky/persist-admin-notices-dismissal

Alternatively, clone or download this repo into the vendor/ folder in your plugin, and include/require the persist-admin-notices-dismissal.php file like so

or let Composer's autoloader do the work.

How to Use

Firstly, install and activate this library within a plugin.

Say you have the following markup as your admin notice,

To make it hidden forever when dismissed, add the following data attribute data-dismissible="disable-done-notice-forever" to the div markup like so:

Autoloaders

When using the framework with an autoloader you must also load the class outside of the admin_notices or network_admin_notices hooks. The reason is that these hooks come after the admin_enqueue_script hook that loads the javascript.

Just add the following in your main plugin file.

Usage Instructions and Examples

If you have two notices displayed when certain actions are triggered; firstly, choose a string to uniquely identify them, e.g. notice-one and notice-two

To make the first notice never appear once dismissed, its data-dismissible attribute will be data-dismissible="notice-one-forever" where notice-one is its unique identifier and forever is the dismissal time period.

To make the second notice only hidden for 2 days, its data-dismissible attribute will be data-dismissible="notice-two-2" where notice-two is its unique identifier and the 2, the number of days it will be hidden is the dismissal time period.

You must append the dismissal time period to the end of your unique identifier with a hyphen (-) and this value must be an integer. The only exception is the string forever.

To actually make the dismissed admin notice not to appear, use the is_admin_notice_active() function like so:

Please note that if you cleanup after your plugin deletion please try to make the removal of stored options as specific as possible. Otherwise you may end up deleting the stored options from other projects.

A filter hook is available to return the proper URL to the Javascript file. An example usage is as follows, especially if this is being used in a theme.

The pand_theme_loader runs the following hook if true. You can directly change the URL to the Javascript file by using another hook in the following manner by changing the return value.

Cool beans. Isn't it?


All versions of persist-admin-notices-dismissal with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package collizo4sky/persist-admin-notices-dismissal contains the following files

Loading the files please wait ....