How do you use a users email in a form?

Ok so I have successfully modified the MarketPress Shipping form to only show specific Cities from a dropdown <select> where it normally has a text field instead. This allows me to restrict my service to a specific region.

The email field by default is

<input size="35" name="email" type="text" value="" />

What should I use to fill in the value with the email of the user account from wordpress? I do not want this field to be editable also. It's meant to ensure I can track a purchase to a specific account in wordpress.

I'll be looking out for this solution in the meantime but any advice would be great :smiley:

Thanks,
Tyler

  • _981
    • Site Builder, Child of Zeus

    In template-functions.php I changed the following from

    $content .= '<input size="35" name="email" type="text" value="'.esc_attr($email).'" /></td>';

    to

    <input size="35" name="email" type="text" value="'.esc_attr($current_user->user_email).'" readonly />

    Hope this helps anyone else who wants to do this or something similar.

  • _981
    • Site Builder, Child of Zeus

    Sorry, missed some code in what I change it to.

    I changed it to...

    $content .= '<input size="35" name="email" type="text" value="'.esc_attr($current_user->user_email).'" readonly /></td>';

    I can't edit my last post because too much time passed so I had to repost.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.