Auto Fill Forms in Contact Form 7

If you have a contact form for example and want logged in users to have their information auto filled, this might be what you want.

In your contact form, you will see something like this by default:

[email* your-email]

By adding default:get, you will able to auto fill the forms.

[email* your-email default:get]

You will need to create a dynamic link that will contain those infomation.

<?php $user_info = $user_id ? new WP_User( $user_id ) : wp_get_current_user(); ?>

This will get you started as a base and you can query any information as you wish, like First Name, Email (which we will use in this example), Website etc.

<a href="http://yoursite.com/?your-email=<?php $user_info->user_email; ?>">Contact Me</a>

You can also add additional auto fills by adding default:get in the form you want to appear. Then append ampersand and start again.

http://yoursite.com/?your-email=test@test&first-name=John

No Comment Yet

Leave a Reply

Your email address will not be published. Required fields are marked *