• Hi,

    I have made a simple script which graps some basic information from linkedin if a user authorize the app. Now with a plain form i now how to prefill the form fields, but i like to use CF7.

    What is the best way to prefill a form with CF7??

    Any info?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Possibly this: Contact Form 7 Dynamic Text Extension.

    There also seem to be some ideas here, but they seem to involve hacking at the Contact Form 7 code, which most people will tell you is inadvisable (you lose your changes when the plugin gets updated).

    I have to do the same thing with an online (animal) adoptions application. If have any great revelations in the process, I’ll post a follow-up here.

    Hi! You can use this code I wrote. Is kinda hacky but is better than
    hacking the plugin core code or rely on javascript tricks. Hope someone find this useful.

    function cfvalues( $a ) {
    	$field_name = 'subject';
    	$default_value = 'custom';
    	if ( preg_match_all( '/<input.*?name="' . $field_name . '".*?\/>/', $a, $match ) ) {
    		$subject = $match[ 0 ][ 0 ];
    		$new_subject = preg_replace( '/value=""/', 'value="' . $default_value . '"', $subject );
    		$a = str_replace( $subject, $new_subject, $a );
    	}
    	return $a;
    }
    add_filter( 'wpcf7_form_elements', 'cfvalues' );
Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘[Plugin: Contact Form 7] Prefill certain fields from linkedin?’ is closed to new replies.