Skip to content
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

taxonomy hook with a filter #8

Closed
netzgestaltung opened this issue Dec 7, 2020 · 5 comments
Closed

taxonomy hook with a filter #8

netzgestaltung opened this issue Dec 7, 2020 · 5 comments

Comments

@netzgestaltung
Copy link
Collaborator

netzgestaltung commented Dec 7, 2020

in /includes/class-cf7-2-post-factory.php on line 1442 the true condition leads to adding an empty array instead of a filter function.

if( 0 === strpos($form_field,'cf7_2_post_filter-') ) {
  $value = apply_filters($form_field, array(), $post_id, $cf7_form_data);
}

i think there should be 'cf7_2_post_filter-' . $this->post_properties['type'] . '-' . $field_to_map instead of that empty array. Also the usage of $this->post_properties['type'] seems unconsistent sometimes with and somethimes without.

@netzgestaltung
Copy link
Collaborator Author

i will inspect my issue more after reading some docs

@aurovrata
Copy link
Owner

i think there should be 'cf7_2_post_filter-' . $this->post_properties['type'] . '-' . $field_to_map

this is to identiy the field in the form? When I created the plugin, I wasn't very consistent in my creation of filters. I would change this filter to:

$value = apply_filters($form_field, array(), $post_id, $cf7_form_data, $cf7_key);

which would allow a user to identify the form being submitted.

Also the usage of $this->post_properties['type'] seems unconsistent sometimes with and somethimes without.

yes, that's quite possible, and hopefully can be improved in v5

@netzgestaltung
Copy link
Collaborator Author

please refer to #9 where i figured it all out.

i think a filter should not only get an empty array but instead the possible estimated value instead

@aurovrata
Copy link
Owner

i think a filter should not only get an empty array

Well, if multiple functions are hooked then you want the same value type to be passed, in this case an array.

instead the possible estimated value instead

in this case there is no estimated value, since the user opts for the filtered option (ie no form fields mapped here).

@aurovrata
Copy link
Owner

I am going through the code and creating a Wiki Page on key functionality in processes handled by the plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants