* New note: manage activity from home screen

* update readme and fix compared version

* tweak the newly installed action name
This commit is contained in:
Bec Scott 2021-01-15 11:34:00 +10:00 committed by GitHub
parent 3835cfc13a
commit b606a6933e
4 changed files with 83 additions and 0 deletions

View File

@ -104,6 +104,7 @@ Release and roadmap notes are available on the [WooCommerce Developers Blog](htt
- Tweak: update the content for the ChooseNiche note. #6048
- Fix: Generate JSON translation chunks on plugin activation #6028
- Dev: Update travis CI distribution. #6067
- Add: Manage activity from home screen inbox message. #6072
== 1.8.3 1/5/2021 ==

View File

@ -21,6 +21,7 @@ use \Automattic\WooCommerce\Admin\Notes\TestCheckout;
use \Automattic\WooCommerce\Admin\Notes\SellingOnlineCourses;
use \Automattic\WooCommerce\Admin\Notes\MerchantEmailNotifications\MerchantEmailNotifications;
use \Automattic\WooCommerce\Admin\Notes\WelcomeToWooCommerceForStoreUsers;
use \Automattic\WooCommerce\Admin\Notes\ManageStoreActivityFromHomeScreen;
/**
* Feature plugin main class.
@ -193,6 +194,7 @@ class FeaturePlugin {
new SellingOnlineCourses();
new LearnMoreAboutVariableProducts();
new WelcomeToWooCommerceForStoreUsers();
new ManageStoreActivityFromHomeScreen();
// Initialize RemoteInboxNotificationsEngine.
RemoteInboxNotificationsEngine::init();

View File

@ -137,7 +137,25 @@ class Install {
*/
if ( ! $version_option || $requires_update ) {
self::install();
/**
* WooCommerce Admin has been installed or updated.
*/
do_action( 'woocommerce_admin_updated' );
if ( ! $version_option ) {
/**
* WooCommerce Admin has been installed.
*/
do_action( 'woocommerce_admin_newly_installed' );
}
if ( $requires_update ) {
/**
* An existing installation of WooCommerce Admin has been
* updated.
*/
do_action( 'woocommerce_admin_updated_existing' );
}
}
/*

View File

@ -0,0 +1,62 @@
<?php
/**
* New! Manage your store activity from the Home screen.
*/
namespace Automattic\WooCommerce\Admin\Notes;
defined( 'ABSPATH' ) || exit;
/**
* New! Manage your store activity from the Home screen.
*/
class ManageStoreActivityFromHomeScreen {
/**
* Note traits.
*/
use NoteTraits;
/**
* Name of the note for use in the database.
*/
const NOTE_NAME = 'wc-admin-manage-store-activity-from-home-screen';
/**
* Attach hooks.
*/
public function __construct() {
add_action(
'woocommerce_admin_updated_existing',
array( $this, 'possibly_add_note' )
);
}
/**
* Get the note.
*
* @return Note|null
*/
public static function get_note() {
$installed_version = get_option( 'woocommerce_admin_version' );
if ( ! version_compare( $installed_version, '1.9.0', '=' ) ) {
return;
}
$note = new Note();
$note->set_title( __( 'New! Manage your store activity from the Home screen', 'woocommerce-admin' ) );
$note->set_content( __( 'Start your day knowing the next steps you need to take with your orders, products, and customer feedback.<br/><br/>Read more about how to use the activity panels on the Home screen.', 'woocommerce-admin' ) );
$note->set_type( Note::E_WC_ADMIN_NOTE_INFORMATIONAL );
$note->set_name( self::NOTE_NAME );
$note->set_source( 'woocommerce-admin' );
$note->add_action(
'learn-more',
__( 'Learn more', 'woocommerce-admin' ),
'https://docs.woocommerce.com/document/home-screen/?utm_source=inbox"',
Note::E_WC_ADMIN_NOTE_ACTIONED,
true
);
return $note;
}
}