-
Notifications
You must be signed in to change notification settings - Fork 92
gpns-add-other-fields-to-date-schedule.php: Added other fields to the GP Notification Scheduler.
#618
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gpns-add-other-fields-to-date-schedule.php: Added other fields to the GP Notification Scheduler.
#618
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| <?php | ||
| /** | ||
| * Gravity Perks // Notification Scheduler // Add other fields to the Date Schedule | ||
| * https://gravitywiz.com/documentation/gravity-forms-notification-scheduler/ | ||
| */ | ||
| // Replace 131 in 'gpns_date_fields_131' with your form ID, and replace 5 in '$field->id == 5' with the field ID to add. | ||
| add_filter( 'gpns_date_fields_131', 'add_field_to_ns', 10 ,2 ); | ||
|
Check failure on line 7 in gp-notification-scheduler/gpns-add-other-fields-to-date-schedule.php
|
||
| function add_field_to_ns( $fields, $form ) { | ||
|
|
||
| // loop over the form fields | ||
| foreach( $form['fields'] as $field ) { | ||
|
Check failure on line 11 in gp-notification-scheduler/gpns-add-other-fields-to-date-schedule.php
|
||
|
|
||
| // find your target field (to add to gpns) | ||
| if( $field->id == 5 ) { | ||
|
Check failure on line 14 in gp-notification-scheduler/gpns-add-other-fields-to-date-schedule.php
|
||
| // add the target field to fields array | ||
| array_push( $fields, $field ); | ||
| } | ||
| } | ||
|
|
||
| return $fields; | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would
$fields[] = $field;work here?