Automattic\WooCommerce\Admin\Notes
DataStore::read_actions
Read actions from the database.
Method of the class: DataStore{}
No Hooks.
Returns
null. Nothing (null).
Usage
// private - for code of main (parent) class only $result = $this->read_actions( $note );
- $note(Note) (required) (passed by reference — &)
- Admin note.
DataStore::read_actions() DataStore::read actions code WC 10.4.3
private function read_actions( &$note ) {
global $wpdb;
$db_actions = $wpdb->get_results(
$wpdb->prepare(
"SELECT action_id, name, label, query, status, actioned_text, nonce_action, nonce_name
FROM {$wpdb->prefix}wc_admin_note_actions
WHERE note_id = %d",
$note->get_id()
)
);
$note_actions = array();
if ( $db_actions ) {
foreach ( $db_actions as $action ) {
$note_actions[] = (object) array(
'id' => (int) $action->action_id,
'name' => $action->name,
'label' => $action->label,
'query' => $action->query,
'status' => $action->status,
'actioned_text' => $action->actioned_text,
'nonce_action' => $action->nonce_action,
'nonce_name' => $action->nonce_name,
);
}
}
$note->set_actions( $note_actions );
}