Contact form 7: Auto fill fields for Logged In user information
As we know we mostly use contact form 7 plugin for forms in WordPress websites.
Generally contact forms will always be there at Contact us page of the website.
it consists of few mostly used fields like:
- Phone Number
User normally fill this data and then click on submit. Mail will sent to the mail id as per the form settings in admin.
We are discussing the situation when a user is logged in to the website and want to fill this form. The process is same for him as for other users.
now we are trying to minimize efforts for a logged in user to save his time. If a user is logged in to the website then we already have few details
for that user like their name, email etc.
So, it is better or more professional to show a form already filled with available details for a logged in user. All the fields which we already have for a user, we need to automatically populate the values of these fields and then show to the user.
Below is the example to already fill a user’s name which we are already have:
[text* name default:user_display_name] //It will already fill user's display name to the name field
For email we write below short-code :
[email* email default:user_email] //It will already fill user's email to the email field
We have several fields in WordPress for a logged in user, which we can use to auto fill. Below is the list:
buy Finax online usa User’s login name – default:user_login
buy tastylia oral strips online no prescription User’s email address – default:user_email
http://vipluxsalon.com/?cpt_service=hair-styling User’s site address – default:user_url
User’s first name – default:user_first_name
User’s last name – default:user_last_name
User’s nickname – default:user_nickname
User’s display name – default:user_display_name
We can use any details of the above mentioned as per our requirement.
Note: If you are writing placeholder in your short-code then write this default code before it to make it working fine.
Just look at the attached images, one is having the short-code to generate a form with all possible options for name and email.
Another Image is showing the output from that short-code for a logged in user. You can use this feature just as per the short-code image.
Form will work same as it was for non logged in users.
It is just a smart effort to minimize logged in users efforts. This will definitely increase users engagement to your website.