WordPress.org

Ready to get started?Download WordPress

Forums

display logged in user email in a subscription form? (4 posts)

  1. snowcrash
    Member
    Posted 8 years ago #

    Hello

    Based on the mailing-list plugin which has a subscription page at the root level of the blog, I'm trying to automatically include the email of a user that is already logged-in. (As its a bother typing in an email address when you are already logged-in)
    So when the user goes to the subscribe.php page, their email is already displayed in the subscription box

    The code snippet is:


    <input class="subscribe" name="email" type="text" id="email" />

    I've tried adding either:
    value="<?php echo $user_email ?>"
    or
    value="<?php echo (the_author_email()); ?>"

    but nothing shows up.

    Any help would be appreciated - thanks

  2. snowcrash
    Member
    Posted 8 years ago #

    In case anyone else finds this useful, I figured it out (I think) with help from function ref info in the docs

    Used:
    <?php global $userdata; get_currentuserinfo(); ?>

    And for

    value="<?php echo($userdata->user_email) ?>"

  3. snowcrash
    Member
    Posted 8 years ago #

    Hmm...after some testing, there seems to be a problem with the value (email address) being 'remembered' when trying to subscribe a different email address.

  4. Samuel B
    moderator
    Posted 8 years ago #

    Maybe a set cookie statement?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags