sabecs
asked on
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-Ema il"]
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-Ema il"]
<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>
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-Ema
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-Ema
<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>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER