1

I wanted to know if you know of a plugin, or a method so that when the user fills in and sends it to the form, they automatically download a file. I currently use the plugin contact form 7

Thanks.

closed as off-topic by Tom J Nowell Jun 26 '18 at 16:09

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

1

You can use "actions". More info: http://hookr.io/actions/wpcf7_mail_sent/

Put this code in your functions.php:

function action_wpcf7_mail_sent( $contact_form ) { 
    // here your file redirect
    header("Location: http://yourfileurl.com"); 
}; 

add_action( 'wpcf7_mail_sent', 'action_wpcf7_mail_sent', 10, 1 );

let me you if it is working i cannot test right now.

  • It does not work, I currently have a multisite wordpress environment, will it be for that? – Horiuko Jun 26 '18 at 16:01
  • @Horiuko if it doesn't do what you expected, what does it do instead? Be careful, saying it doesn't work might mean that when you clicked the button, your computer turned into a drone and flew away, or that instead of downloading a file, an amazon delivery person arrived at the door with the file on a USB drive, or that it downloaded the wrong file, or that your browser crashed etc etc – Tom J Nowell Jun 26 '18 at 16:08
  • It was not necessary so much sarcasm, I do not have your knowledge, my mistake ... but I feel that my answer is valid. It did not work, because the action of the hook is not calling the download file. That's why I say, if it is feasible that this happens because I have the wordpress environment as a multisite. But in the same way, thank you for your help. – Horiuko Jun 26 '18 at 16:15
  • 1
    OK, probably what i wrote is deprecated. Try this: https://wordpress.org/plugins/contact-form-7-extras/ image: example image – Tommy89 Jun 26 '18 at 16:51

Not the answer you're looking for? Browse other questions tagged or ask your own question.