gform_post_note_added

gform_post_note_added

DescriptionUsageParametersExamplesSend notifications configured for the custom event note_addedSource Code

Description
The 「gform_post_note_added」 action is triggered after a note is added to an entry in Gravity Forms, allowing further actions to be performed.
Usage
1add_action( 'gform_post_note_added', 'my_function', 10, 6 );

Parameters

$insert_id int
The ID generated from the auto incremented column within the database. See $wpdb->insert.

$entry_id int
The ID of the entry that the note is being added to.

$user_id int
The user that is adding the note.

$user_name string
The name of the user that created the note.

$note string
The content of the note being added.

$note_type string
The type associated with the note.

Examples
Send notifications configured for the custom event note_added
The following example assumes you have already added a custom notification event with the filter gform_notification_events defined as 『note_added』. It will check if there』s any active notification configured for that event, and process them if any.
12345678910111213141516171819202122add_action( 'gform_post_note_added', 'send_note_added_notifications', 10, 2 ); function send_note_added_notifications( $insert_id, $entry_id ) {     GFCommon::log_debug( __METHOD__ . "(): Running for entry id {$entry_id}" );       $entry = GFAPI::get_entry( $entry_id );    $form_id = rgar( $entry, 'form_id' );    $form = GFAPI::get_form( $form_id );     // Replace note_added with the name you have used to define your event    $event = 'note_added';     $notifications_to_send = GFCommon::get_notifications_to_send( $event, $form, $entry );     $log_notification_event = empty( $notifications_to_send ) ? 'No notifications to process' : 'Processing notifications';    GFCommon::log_debug( "GFFormDisplay::process_form(): {$log_notification_event} for {$event} event." );           if ( ! empty ( $notifications_to_send ) ) {        GFAPI::send_notifications( $form, $entry, $event );     }}
Source Code
This action hook is located in forms_model.php.

發表回覆

您的郵箱地址不會被公開。 必填項已用 * 標註