Skip to content

Library RatingPrompt

bwmarkle edited this page Feb 6, 2019 · 3 revisions

The RatingPrompt class is designed to manage and display rating prompts.

What is a rating prompt?

A rating prompt is an admin notice asking the user to rate a plugin within the wp.org repo.

General FAQ

  1. Each plugin can add multiple rating prompts, and multiple plugins can add rating prompts.
  2. Only one rating prompt will be shown at a time. We do not want 5 different plugins asking for wp.org ratings all at the same time.
  3. When a rating prompt for a particular plugin has been dismissed, rating prompts for that plugin will never be shown again.
  4. The actual rating prompts are required to be in a config file all by themselves.

What goes in the config file for a rating prompt?

Please see BoldGrid Backup's /includes/config/config.rating-prompt.php as an example.

Example

  1. Init the classes - https://github.com/BoldGrid/boldgrid-backup/blob/dev/admin/class-boldgrid-backup-admin-core.php#L654-L662
  2. When an event happens, add 1 to the counter - https://github.com/BoldGrid/boldgrid-backup/blob/dev/admin/class-boldgrid-backup-admin-core.php#L1874
  3. In the Activity class' add() method, it will add a rating prompt if the threshold has been reached - https://github.com/BoldGrid/library/blob/dev/src/Library/Activity.php#L89-L91
  4. The threshold is defined in a config file like this - https://github.com/BoldGrid/boldgrid-backup/blob/dev/includes/config/config.rating-prompt.php#L121
Clone this wiki locally