• I have a form that is not made using any plugins, I am looking for a way to see if a user is logged in, get their email address and then fill the field:
    <tr><td><span style='nowrap:nowrap;font-size:15px;font-family:Arial;width:200px;line-height: 22px;'>Email'</span><br><input type='text' maxlength='100' style='width:250px;' name='Email'></input></td></tr>

    I would use a plugin but there’s gotta be a way to not use any plugins. And since the form isn’t made with a plugin, CF7 dyanmic text extension won’t work for me (yet i spose) or gravity forms.
    Thanks in advance.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter joeyjosay

    (@joeyjosay)

    Now how to fill the field…… that has me stumped

    There are examples in the first link of how to grab the data using the function and then output it. A good grasp of both HTML and PHP will be needed, but here is a working example:

    <?php
    if ( is_user_logged_in() ) {
    $current_user = wp_get_current_user();
    $emuser = $current_user->user_email;
    echo $emuser;
    } ?>

    Put above in a template somewhere on the site and run it (it will do nothing if the user is not logged in). How you use that in your form is beyond the scope of this forum, as it is for troubleshooting, not site design.

    Thread Starter joeyjosay

    (@joeyjosay)

    Ahhh, well done & appreciated sir! Does what it needs to. I don’t do wp/php syntax very well, thanks!

    <tr><td><span style='nowrap:nowrap;font-size:17px;font-family:Arial;width:200px;line-height: 22px;'>Email<span style='color:red;'>*</span></span><br><input type='text' maxlength='100' style='width:250px;' name='Email' value="  <?php
    if ( is_user_logged_in() ) {
    $current_user = wp_get_current_user();
    $emuser = $current_user->user_email;
    echo $emuser;
    } ?>"></input></td></tr>
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Auto fill text inputs with user meta – email’ is closed to new replies.