WC_Notes_Run_Db_Update::update_done_notice() private WC 1.0
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.
{} Это метод класса: WC_Notes_Run_Db_Update{}
Хуков нет.
Возвращает
Null. Ничего.
Использование
$result = WC_Notes_Run_Db_Update::update_done_notice( $note_id );
- $note_id(число) (обязательный)
- Note id to update.
Код WC_Notes_Run_Db_Update::update_done_notice() WC Notes Run Db Update::update done notice WC 5.0.0
private static function update_done_notice( $note_id ) {
$hide_notices_url = html_entity_decode( // to convert &s to normal &, otherwise produces invalid link.
wp_nonce_url(
add_query_arg(
'wc-hide-notice',
'update',
wc_get_current_admin_url() ? wc_get_current_admin_url() : admin_url( 'admin.php?page=wc-settings' )
),
'woocommerce_hide_notices_nonce',
'_wc_notice_nonce'
)
);
$note_actions = array(
array(
'name' => 'update-db_done',
'label' => __( 'Thanks!', 'woocommerce' ),
'url' => $hide_notices_url,
'status' => 'actioned',
'primary' => true,
),
);
$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 ) );
}
$note->save();
}