• I’ve tried doing this, but with no success, so I thought I’d see if anyone else knows how to do it.

    Basically I want to include PHP as the value within some of the form fields so that I can pre-fill information, like the user’s name and e-mail when they are logged in to my site.

    I tried this: [text text-411 "<?php if ( is_user_logged_in() ) { ?><?php global $current_user; get_currentuserinfo(); echo $current_user->user_email; ?><?php } ?>"]

    But the form showed all the PHP code there and not my e-mail. I also had the Exec PHP plugin turned on so that PHP should run in pages/posts.

    Any ideas on how to make this work? Thanks so much in advance!

    -Adam

Viewing 3 replies - 1 through 3 (of 3 total)
  • For the username maybe this can help you out?

    For some other dynamic Text maybe this PlugIn is for you?

    Thread Starter Adam Capriola

    (@adamcapriola)

    Not quite. ??

    The first link will output a username or e-mail, but not prefill a field.

    The second one doesn’t seem to have the right capability either. It can only get limited stuff.

    I know that’s no prefill but if you need the mail or username…

    For a prefill I saw only (somewhere here in the forum) a solution via JavaScript in a own template in combination with a given name/id for the target-field in the form.

    No solution for an included way to prefill the fields…

    If you found a way, please post it here, thanks.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: Contact Form 7] Trick to include PHP in the form fields?’ is closed to new replies.