• Resolved SomebodyWithAName

    (@dreamwire)


    So i have mapped some fields and all is working fine but i want to have a validation check on 2 fields. So a user needs to use one of the 2 fields. Or upload a image or put a link in a URL field.

    So i have this code:

    function alter_wpcf7_posted_data( $data ) {
    	
    	if($_FILES['imageupload']['size'] != 0) {
    		$_POST['videourl'] = "https://fileupload.com";
    	}
    	if($_POST['videourl'] != "") {
    		$_FILES['imageupload']['tmp_name'] = "urlprovided";
    	}
    	
    	return $data;
    }
    add_filter("wpcf7_posted_data", "alter_wpcf7_posted_data");

    This is working for the URL field but if you select a image with the upload field the image dont get set a featured image anymore, its even not getting saved in the WordPress libary?

    So is this something from “Post My CF7 Form” that this is not working or?

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Required one of 2 different fields’ is closed to new replies.