LLMS_Notification::create( array $data = array() )
Create a new notification in the database
Parameters Parameters
- $data
-
(array) (Optional) notification data
Default value: array()
Return Return
(int|false) new notification id on success, false otherwise
Source Source
File: includes/models/model.llms.notification.php
public function create( $data = array() ) {
$time = current_time( 'mysql' );
$data = wp_parse_args(
$data,
array(
'created' => $time,
'post_id' => null,
'status' => 'new',
'subscriber' => null,
'trigger_id' => null,
'type' => '',
'updated' => $time,
'user_id' => null,
)
);
ksort( $data ); // Maintain alpha sort you savages.
$format = array(
'%s', // For created.
'%d', // For post_id.
'%s', // For status.
'%s', // For subscriber.
'%s', // For trigger_id.
'%s', // For type.
'%s', // For updated.
'%d', // For user_id.
);
global $wpdb;
if ( 1 !== $wpdb->insert( $this->get_table(), $data, $format ) ) {
return false;
}
$this->id = $wpdb->insert_id;
return $this->id;
}
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
| Version | Description |
|---|---|
| 3.8.0 | Introduced. |