LLMS_Notification::set( string $key, mixed $val )

Set object variables


Parameters Parameters

$key

(string) (Required) variable name

$val

(mixed) (Required) data


Top ↑

Source Source

File: includes/models/model.llms.notification.php

	 *
	 * @since    3.8.0
	 *
	 * @param    string $key  variable name
	 * @param    mixed  $val  data
	 */
	public function set( $key, $val ) {

		global $wpdb;

		switch ( $key ) {

			case 'created':
			case 'id':
			case 'updated':
				return false;
			break;

			default:
				$this->$key = $val;
				if ( $this->id ) {
					// phpcs:disable WordPress.DB.PreparedSQL.InterpolatedNotPrepared
					return $wpdb->query(
						$wpdb->prepare(
							"UPDATE {$this->get_table()} SET {$key} = %s, updated = %s WHERE id = %d",
							$val,
							current_time( 'mysql' ),
							$this->id
						)
					); // db call ok; no-cache ok.
					// phpcs:enable WordPress.DB.PreparedSQL.InterpolatedNotPrepared
				}

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.