Skip to content
Docs
Get RestroPress

Action

rpress_pre_insert_customer_note

Updated
On this page

Fires after a note is added to a customer, before the note HTML is rendered.

Runs in rpress_customer_save_note() immediately after RPRESS_Customer::add_note() is called. The second argument is the string returned by RPRESS_Customer::add_note(): the note prefixed with a timestamp, or false when the note text was empty. Use it to react to new notes.

Parameters#

ParameterTypeDescription
$customer_idintThe customer ID.
$new_notestring|falseThe timestamp-prefixed note string returned by RPRESS_Customer::add_note(), or false if the note was empty.

Example#

function my_after_customer_note( $customer_id, $new_note ) {
	if ( $new_note ) {
		update_user_meta( get_current_user_id(), 'my_last_note_customer', (int) $customer_id );
	}
}
add_action( 'rpress_pre_insert_customer_note', 'my_after_customer_note', 10, 2 );

Notes#

The name says pre-insert but the note is already stored when it fires.

Source#

Fired from:

  • includes/admin/customers/customer-actions.php (line 327), in rpress_customer_save_note()

See also#

Was this page helpful?