WC_Notes_Run_Db_Update::update_done_notice()
Update the existing note with $note_id with information that db upgrade is done.
This is the last notice (3 out of 3 notices) displayed to the user.
Method of the class: WC_Notes_Run_Db_Update{}
No Hooks.
Return
null
. Nothing (null).
Usage
$result = WC_Notes_Run_Db_Update::update_done_notice( $note_id );
- $note_id(int) (required)
- Note id to update.
WC_Notes_Run_Db_Update::update_done_notice() WC Notes Run Db Update::update done notice code WC 9.7.1
private static function update_done_notice( $note_id ) { $hide_notices_url = html_entity_decode( // to convert &s to normal &, otherwise produces invalid link. add_query_arg( array( 'wc-hide-notice' => 'update', ), wc_get_current_admin_url() ? remove_query_arg( 'do_update_woocommerce', wc_get_current_admin_url() ) : admin_url( 'admin.php?page=wc-settings' ) ) ); $note_actions = array( array( 'name' => 'update-db_done', 'label' => __( 'Thanks!', 'woocommerce' ), 'url' => $hide_notices_url, 'status' => 'actioned', 'primary' => true, 'nonce_action' => 'woocommerce_hide_notices_nonce', 'nonce_name' => '_wc_notice_nonce', ), ); $note = new Note( $note_id ); // Check if the note needs to be updated (e.g. expired nonce or different note type stored in the previous run). if ( self::note_up_to_date( $note, $hide_notices_url, wp_list_pluck( $note_actions, 'name' ) ) ) { return $note_id; } $note->set_title( __( 'WooCommerce database update done', 'woocommerce' ) ); $note->set_content( __( 'WooCommerce database update complete. Thank you for updating to the latest version!', 'woocommerce' ) ); $note->clear_actions(); foreach ( $note_actions as $note_action ) { $note->add_action( ...array_values( $note_action ) ); if ( isset( $note_action['nonce_action'] ) ) { $note->add_nonce_to_action( $note_action['name'], $note_action['nonce_action'], $note_action['nonce_name'] ); } } $note->save(); }