Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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

View workflow job for this annotation

GitHub Actions / PHPCS (Files Changed)

Space found before comma in argument list

Check failure on line 7 in gp-notification-scheduler/gpns-add-other-fields-to-date-schedule.php

View workflow job for this annotation

GitHub Actions / PHPCS (Files Changed)

No space found after comma in argument list
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

View workflow job for this annotation

GitHub Actions / PHPCS (Files Changed)

Expected 1 space(s) after FOREACH keyword; 0 found

Check failure on line 11 in gp-notification-scheduler/gpns-add-other-fields-to-date-schedule.php

View workflow job for this annotation

GitHub Actions / PHPCS (Files Changed)

Space after opening control structure is required

Check failure on line 11 in gp-notification-scheduler/gpns-add-other-fields-to-date-schedule.php

View workflow job for this annotation

GitHub Actions / PHPCS (Files Changed)

No space before opening parenthesis is prohibited

// 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

View workflow job for this annotation

GitHub Actions / PHPCS (Files Changed)

Expected 1 space(s) after IF keyword; 0 found

Check failure on line 14 in gp-notification-scheduler/gpns-add-other-fields-to-date-schedule.php

View workflow job for this annotation

GitHub Actions / PHPCS (Files Changed)

Space after opening control structure is required

Check failure on line 14 in gp-notification-scheduler/gpns-add-other-fields-to-date-schedule.php

View workflow job for this annotation

GitHub Actions / PHPCS (Files Changed)

No space before opening parenthesis is prohibited
// add the target field to fields array
array_push( $fields, $field );
Comment on lines +15 to +16
Copy link
Contributor

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?

}
}

Check failure on line 19 in gp-notification-scheduler/gpns-add-other-fields-to-date-schedule.php

View workflow job for this annotation

GitHub Actions / PHPCS (Files Changed)

Whitespace found at end of line
return $fields;
}
Loading