LLMS_Notification::create( array $data = array() )

Create a new notification in the database


Description Description


Parameters Parameters

$data

(array) (Optional) notification data

Default value: array()


Top ↑

Return Return

(int|false) new notification id on success, false otherwise


Top ↑

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', // created
			'%d', // post_id
			'%s', // status
			'%s', // subscriber
			'%s', // trigger_id
			'%s', // type
			'%s', // updated
			'%d', // user_id
		);

		global $wpdb;
		if ( 1 !== $wpdb->insert( $this->get_table(), $data, $format ) ) {
			return false;
		}

		$this->id = $wpdb->insert_id;

		return $this->id;

	}

Top ↑

Changelog Changelog

Changelog
Version Description
3.8.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.