Closed wpsmort closed 4 years ago
This is good also.
So is this
Specs:
1) Should give 3 options: a) link to rate 5 stars on .org b) Not now/remind me later c) already rated
2) Explanation of why: keep developing free software, etc
3) free version only
4) Should be in its own class/file'
5) It should only show up after x days. "I see you've been using AIOSEOP for a while..." *We need to start storing the activation date in the db, so we'll need to add this in our update class as well for older users (this would just be the current date).
6) Should be dismissible at the top.
*Use code from other plugins as a guide if needed.
Wanted to provide some screenshots to the update. However, I had a few things I wanted to mention for any feedback needed on this.
My feedback:
-I'd remove the number of days... maybe just say "for a while". -10 days? -We either need to remove the number of days or be able to determine if we started tracking when they updated or activated. If they've been using it for two years, we certainly don't want to tell them they've been using it for 10 days. If we do have a number, it should definitely be an integer. -I'm not sure what you're asking. -Off the top of my head, I'm pretty sure we don't, but you can certainly search the plugin's code to see.
https://codex.wordpress.org/Function_Reference/register_deactivation_hook https://developer.wordpress.org/reference/functions/register_uninstall_hook/
Also, https://github.com/EkoJr/all-in-one-seo-pack/commit/25268eed3fdaf723208e5bc4ffff10158e3c4427 adds to aioseop_class.php. We should be extracting code out of the big files and reorganizing/refactoring/etc, not adding to the mess. :)
Understood. Some of what was applied was for conceptual use, and to present the data.
1-3 Agreed. There's really no benefit to other users. It mainly started off as dev code that got thrown into the mix. I'll also change it to 10 days.
4 Currently, it dismisses the Notification if they go to WP site to rate the plugin, but thinking about it now I should probably prevent dismissing the Notification until they've clicked "Already rated" afterwards.
5 I didn't see any deactivation or uninstall hook. I was just curious if there might of been a different kind of method being applied. I was a bit surprised there wasn't an uninstall method actually.
The admin footer in 25268eed3fdaf723208e5bc4ffff10158e3c4427 was the first piece of code I had worked on, and I was also planning on changing to a more appropriate location. So, no worries there :) Ty for the reminder tho.
From what I've seen. Most other plugins just dismiss the notification at that point. Probably because there is no way to check if the user did rate the plugin, but I still believe it may help to reserve it til 'Already rated' is clicked.
The uninstall method was just a bit of a surprise to see missing. The plugin itself has no need for it, but I thought it was a standard that WP has been trying to push. In this case, there is still no need for it...I was just going to add the timestamp to the deactivation & uninstall method for any possible future use was all, but no worries.
The only reason I can think of is to remove the database when the plugin in uninstalled. Other than that, there's no other purpose that I can think.
We're not going to remove our database entries on uninstall.
I understand.
/*
* @param type $slug Notice unique slug.
* @param type $delay_time Time to begin displaying notice site-wide.
* @param type $message Message, or notice body, to display to user. HTML can be used.
* @param type $delay_options See self::notices for more details. Contains the buttons/options to display to the user.
* @param type $target Target is either the site as a whole, or based on each user.
* @param type $screens Which screens to exclusively load the notice on. 'aioseop' = all aioseop screens. Default empty is all screens.
* @return boolean True on success.
*/
Strictly for adding data if no data is for. Used only for adding on initialization.
insert_notice( $slug, $delay_time = 0, $message = '', $delay_options = array(), $target = 'site', $screens = array() )
Updates a Notice without cause it to reset.
update_notice( $slug, $delay_time = 0, $message = '', $delay_options = array(), $target = 'site', $screens = array() )
Activates a notice, or can be used to reset a notice after updating.
activate_notice( $slug )
Structure of the code that would be used to add a notice. There's various operations that can occur. It can Insert (but NOT update), Update (but NOT reset), and Reset/Activate notices.
function aioseop_activation_review_plugin_set_notice() {
global $aioseop_notices;
$slug = 'activation_review_plugin';
$delay_time = 0;//864000;// 10 days. // CHANGE AFTER DEV TESTS.
$message = __( 'Looks like you\'ve been using All in One SEO Plugin for awhile now, and that\'s awesome! We are an open source community built from other\'s contributions. By helping us with a 5-star review, it also helps us to reach out to more people.', 'all-in-one-seo-pack' );
$delay_options = array();
$delay_options[] = array(
'time' => 15,
'text' => __( 'Yes, absolutely!', 'all-in-one-seo-pack' ),
'link' => 'https://wordpress.org/support/plugin/all-in-one-seo-pack/reviews?rate=5#new-post',
'dismiss' => false,
'class' => '',
);
$delay_options[] = array(
'text' => 'Remind me in an Hour',
'time' => 3600,
'dismiss' => false,
'class' => '',
);
$delay_options[] = array(
'text' => 'Maybe, give me a Week.',
'time' => 432000,// 5 days.
'dismiss' => false,
'class' => '',
);
$delay_options[] = array(
'time' => 0,
'text' => 'Already Rated. Thank You!',
'dismiss' => true,
'class' => '',
);
$target = 'user';
$screen = array();
// Methods of adding Notices.
$update = true;
$reset = true;
if ( $aioseop_notices->insert_notice( $slug, $delay_time, $message, $delay_options, $target, $screen ) ) {
aioseop_footer_review();
} elseif ( $update ) {
$aioseop_notices->update_notice( $slug, $delay_time, $message, $delay_options, $target, $screen );
if ( $reset ) {
$aioseop_notices->activate_notice( $slug );
aioseop_footer_review_remove();
aioseop_footer_review();
}
}
}
/**
* Collection of notices to display.
*
* @since 2.4.2
* @access public
*
* @var array $notices {
* @type array $slug {
* @type string $slug Required and is a unique ID.
* @type int $delay_time Amount of time to begin showing message.
* @type string $message Content message to display in the container.
* @type array $delay_option {
* Show options for users to click on. Default: See self::delay_option_defaults().
* @type array {
* @type int $time Optional. The amount of time to delay. Zero immediately displays Default: 0.
* @type string $text Optional. Button/Link HTML text to display. Default: ''.
* @type string $class Optional. Class names to add to the link/button for styling. Default: ''.
* @type string $link Optional. The elements href source/link. Default: '#'.
* @type boolean $dismiss Optional. Variable for AJAX to dismiss showing a notice.
* }
* }
* @type int $time_start The time the notice was added to the object.
* @type string $target Shows based on site-wide or user notice data.
* @type array $screens Which screens to exclusively display the notice on.
* An empty array() = all,
* array('aioseop') = $this->aioseop_screens,
* and array('CUSTOM') = specific screen(s).
* Default: array().
* }
* }
*/
Function similar to notices, but does have some key differences. Layer Level being one, the ajax actions, and a few others. So functionality was made separate, but was kept simple in comparison to Notice functionality.
/**
* Collection of footers saved to AIOSEOP_Notice database. Footers are
* shown if they are active, and are deactivated in self::ajax_footer_action().
*
* @since 2.4.2
*
* @var array $footers {
* @type array $slug {
* @type string $slug Required and is a unique ID.
* @type int $delay_time Amount of time to begin showing message.
* @type string $html Content HTML to rendered in the container.
* @type array $action_option {
* Show options for users to click on. Default: See self::delay_option_defaults().
* @type array {
* @type int $time Optional. The amount of time to delay. Zero immediately displays Default: 0.
* @type string $text Optional. Button/Link HTML text to display. Default: ''.
* @type string $class Optional. Class names to add to the link/button for styling. Default: ''.
* @type string $link Optional. The elements href source/link. Default: '#'.
* @type boolean $dismiss Optional. Variable for AJAX to dismiss showing a notice.
* }
* }
* @type int $layer_level When multiple footers exist, the highest number is shown.
* @type int $time_start The time the notice was added to the object.
* @type array $screens Which screens to exclusively display the notice on.
* An empty array() = all,
* array('aioseop') = $this->aioseop_screens,
* and array('CUSTOM') = specific screen(s).
* Default: array().
* }
* }
*/
This may help to give an overall visual explanation.
Issue moved to awesomemotive/aioseop-pro #643 via ZenHub
Look at how WooCommerce does this and add something similar. See screenshot.