Prefill Wordpress contact form with current logged in users details.

I have enabled a plugin call "PHP Code Snippets"
and have added code below

$current_user = wp_get_current_user();
    echo  $current_user->user_email ;

which creates a Snippet Short Code

[xyz-ips snippet="Current-Users-Email"]


If I include the xyz-ips short code  in my form "Contact Form 7" as below, it displays the email address at top of the form but how can I set it as a placeholder?

So, basically I want to have a users email already prefilled in the form if they have logged on?


[xyz-ips snippet="Current-Users-Email"]

<fieldset>
      <legend>Compliance Question</legend>
      <ol>
            <li> Name [text cf7s-name] </li>
            <li> Email [email* cf7s-email placeholder "current-users-email"] </li>
                <li> Question [textarea cf7s-comments] </li>
      </ol>
[recaptcha]
      [submit "Submit"]
      <p>* Required</p>
</fieldset>
sabecsAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

James RodgersWeb Applications DeveloperCommented:
should be

default:user_email

as

[email* your-email default:user_email]
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
sabecsAuthor Commented:
Thanks, that is perfect..
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
WordPress

From novice to tech pro — start learning today.