nf_insert_notification

Insert a notification into the database.

Description

(int) nf_insert_notification( (string) $form_id = '' ); 

Calls nf_insert_object() Calls nf_add_relationship() Calls nf_update_object_meta()

Returns (int)

$n_id

Parameters (1)

0. $form_id — Optional. (string) => ''
The form id.

Usage

  1. if ( !function_exists( 'nf_insert_notification' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'ninja-forms/deprecated/includes/functions.php'; 
  3.  
  4. // The form id. 
  5. $form_id = ''; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = nf_insert_notification($form_id); 
  9.  

Defined (1)

The function is defined in the following location(s).

/deprecated/includes/functions.php  
  1. function nf_insert_notification( $form_id = '' ) { 
  2. if ( empty ( $form_id ) ) 
  3. return false; 
  4.  
  5. $n_id = nf_insert_object( 'notification' ); 
  6. nf_add_relationship( $n_id, 'notification', $form_id, 'form' ); 
  7. $date_updated = date( 'Y-m-d', current_time( 'timestamp' ) ); 
  8. nf_update_object_meta( $n_id, 'date_updated', $date_updated ); 
  9. return $n_id;