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
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 | 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. |