File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -425,3 +425,26 @@ function osi_wpdc_comment_body( string $comment_body ) {
425425 return $ trimmed_comment_body ;
426426}
427427add_filter ( 'wpdc_comment_body ' , 'osi_wpdc_comment_body ' , 10 , 1 );
428+
429+
430+
431+ /**
432+ *
433+ * Create a new Supporter CPT.
434+ *
435+ */
436+ add_action ('wpcf7_before_send_mail ' , 'save_form_data_to_cpt ' );
437+ function save_form_data_to_cpt ($ contact_form ) {
438+ $ submission = WPF7_Submission::get_instance ();
439+ if ($ submission ) {
440+ $ data = $ submission ->get_posted_data ();
441+
442+ $ post_id = wp_insert_post (array (
443+ 'post_title ' => $ data ['your-name ' ],
444+ 'post_type ' => 'supporter ' ,
445+ 'post_status ' => 'draft '
446+ ));
447+ update_field ('name ' , $ data ['your-name ' ], $ post_id );
448+ update_field ('organization ' , $ data ['your-org ' ], $ post_id );
449+ }
450+ }
You can’t perform that action at this time.
0 commit comments