Warning: Array to string conversion in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 825

Warning: foreach() argument must be of type array|object, string given in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 830
Automator_Notifications::add( array $notification )

Add a manual notification event.


Warning: Array to string conversion in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 825

Warning: foreach() argument must be of type array|object, string given in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 830

Parameters Parameters

$notification

(Required) Notification data.


Source Source

File: src/core/admin/notifications/notifications.php

	public function add( $notification ) {
		if ( empty( $notification['id'] ) ) {
			return;
		}
		$option = $this->get_option();
		foreach ( $option['dismissed'] as $item ) {
			if ( $item['id'] === $notification['id'] ) {
				return;
			}
		}
		foreach ( $option['events'] as $item ) {
			if ( $item['id'] === $notification['id'] ) {
				return;
			}
		}
		$notification = $this->verify( array( $notification ) );
		update_option(
			$this->option_name,
			array(
				'update'    => $option['update'],
				'feed'      => $option['feed'],
				'events'    => array_merge( $notification, $option['events'] ),
				'dismissed' => $option['dismissed'],
			),
			false
		);
	}


Top ↑

Changelog Changelog

Changelog
VersionDescription
{VERSION}Introduced.