Automattic\WooCommerce\Internal\Email\Unsubscribes
Storage::record_action
Append an action row.
Method of the class: Storage{}
No Hooks.
Returns
bool.
Usage
// private - for code of main (parent) class only $result = $this->record_action( $hash, $kind, $action ): bool;
- $hash(string) (required)
- SHA-256 hex digest of the normalized email.
- $kind(string) (required)
- Email-kind identifier.
- $action(string) (required)
unsubscribedorresubscribed.
Storage::record_action() Storage::record action code WC 11.1.2
private function record_action( string $hash, string $kind, string $action ): bool {
if ( '' === $hash || '' === $kind ) {
return false;
}
global $wpdb;
// phpcs:disable WordPress.DB.DirectDatabaseQuery -- write to an internal preference table.
$inserted = $wpdb->insert(
$this->get_table_name(),
array(
'email_hash' => $hash,
'email_kind' => $kind,
'action' => $action,
'created_at' => current_time( 'mysql', true ),
),
array( '%s', '%s', '%s', '%s' )
);
// phpcs:enable
return false !== $inserted;
}