Allright, I did some more testing. The hooks solution doesn’t work, because the plugin takes the $_POST data directly. The problem lies in the Email_Before_Download_Process class.
This part specifically:
public function process_cf7($form_obj)
{
if (!isset($_POST['ebd_settings'])) {
return $form_obj; // make sure this only fires when there is EBD info
}
$post_data = $_POST;
$user_input = [];
$settings = $this->parse_post_array($post_data['ebd_settings']);
$downloads = $this->parse_post_array($post_data['ebd_downloads']);
foreach ($post_data as $key => $value) {
if (!is_array($value))
$user_input[$key] = $value;
}
$this->log($post_data, $user_input);
...
All CF7 hooks are skipped like this. CF7 does the following in their WPCF7_Submission class:
private function setup_posted_data() {
$posted_data = (array) $_POST;
$posted_data = array_diff_key( $posted_data, array( '_wpnonce' => '' ) );
$posted_data = $this->sanitize_posted_data( $posted_data );
$tags = $this->contact_form->scan_form_tags();
foreach ( (array) $tags as $tag ) {
if ( empty( $tag['name'] ) ) {
continue;
}
$name = $tag['name'];
$value = '';
if ( isset( $posted_data[$name] ) ) {
$value = $posted_data[$name];
}
$pipes = $tag['pipes'];
if ( WPCF7_USE_PIPE
&& $pipes instanceof WPCF7_Pipes
&& ! $pipes->zero() ) {
if ( is_array( $value) ) {
$new_value = array();
foreach ( $value as $v ) {
$new_value[] = $pipes->do_pipe( wp_unslash( $v ) );
}
$value = $new_value;
} else {
$value = $pipes->do_pipe( wp_unslash( $value ) );
}
}
$posted_data[$name] = $value;
}
$this->posted_data = apply_filters( 'wpcf7_posted_data', $posted_data );
return $this->posted_data;
}
Wouldn’t something similar be a better way to get all the data? For instance:
$submission = WPCF7_Submission::get_instance($form_obj, ['skip_mail' => true]);
$posted_data = $submission->get_posted_data();
-
This reply was modified 6 years, 10 months ago by absolutist.