-
Notifications
You must be signed in to change notification settings - Fork 88
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
gw-multiple-entries-list-field.php
: Added the ability to process feeds per list data row.
#816
base: master
Are you sure you want to change the base?
Conversation
…eds per list data row.
1 similar comment
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.
Lookin' good, @lanresmith! A few questions and one suggestion. 😄
* 1. With `append_list_data` set to false (the default), the first row of the list data is actually appended - counter-intuitive, uh? - to the main entry via the admin-only fields and not stored as a separate entry. Subsequent rows are always stored as separate entries. | ||
* 2. Feeds are processed per list data row when `process_feeds` is `true`. | ||
* 3. Use the admin-only fields - NOT the original List field - in the field maps for feeds. | ||
* 4. The original List field data is also stored in the 'child' entries when `preserve_list_data` is `true`. |
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.
* 4. The original List field data is also stored in the 'child' entries when `preserve_list_data` is `true`. | |
* 4. The original List field data is also stored in the "child" entries when `preserve_list_data` is `true`. |
Good inline notes! I'd use double quotes in this context.
// We use 5 to ensure that this runs before the ones in GF core. | ||
add_filter( 'gform_entry_post_save', array( $this, 'create_multiple_entries' ), 5, 2 ); |
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.
Could you explain what you were experiencing that prompted this change?
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.
This is just to ensure that the callback here runs first. If we use the default priority 10
here, the ones in GF core also have priority 10
and may run 1st and what they do is to process feeds, so feeds might be processed for the 'parent' entry. We might not want that e.g. for the reason stated around lines 131-138:
if ( $this->_args['append_list_data'] && $this->_args['process_feeds'] ) {
.
.
.
}
return $entry; | ||
} | ||
|
||
public function maybe_disable_parent_notification( $disable, $notification, $form, $entry ) { |
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.
What were you seeing that motivated this?
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.
The method may not always do what it should do, hence why its name starts with maybe
. Kindly see the comment in this block of code therein:
if ( rgar( $entry, 'gwmelf_parent_entry' )
&& ! $this->_args['append_list_data']
&& $this->_args['preserve_list_data']
&& $this->_args['send_notifications'] ) {
/**
* The 'parent' & the first row notifications will have exactly the same
* content - unnecessary duplication. Disable the 'parent' notification.
*/
$disable = true;
}
PS: it doesn't mean no notifications are sent at all - a duplicate (in this case the "parent's" ) is just disabled.
We can remove it anyway if you feel like it doesn't matter getting notifications that are exactly the same in content.
Context
⛑️ Ticket(s): https://secure.helpscout.net/conversation/2569827939/64882
Summary
With this change, feeds are processed per list data row.