yanknudtskov
4/1/2014 - 2:36 PM

Code to change pre-set the e-mail field for a contactform7. Remember to: * Replace CONTACT_FORM_7_SHORTCODEwith the appropriate CF7 shortco

Code to change pre-set the e-mail field for a contactform7.

Remember to:

  • Replace CONTACT_FORM_7_SHORTCODEwith the appropriate CF7 shortcode
  • Replace contact-form-7-email-field-class-selector with the appropriate class/id selector for the CF7 e-mail field
<?php if ( is_user_logged_in() ) : ?>

	<?php global $current_user;
	      get_currentuserinfo();
	?>

	/* INSERT ContactForm7 ShortCode HERE */
	<?php echo do_shortcode( 'CONTACT_FORM_7_SHORTCODE' ); ?>

	<script> $(function() { 
		$('.contact-form-7-email-field-class-selector').val(<?php echo $current_user->email; ?>);
	});
	</script>

<?php endif; ?>