-
Notifications
You must be signed in to change notification settings - Fork 2
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
- Each plugin can add multiple rating prompts, and multiple plugins can add rating prompts.
- 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.
- When a rating prompt for a particular plugin has been dismissed, rating prompts for that plugin will never be shown again.
- 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
- Init the classes - https://github.com/BoldGrid/boldgrid-backup/blob/dev/admin/class-boldgrid-backup-admin-core.php#L654-L662
- 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
- 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
- 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