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

  1. snowcrash
    Posted 9 years ago #


    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 ?>"
    value="<?php echo (the_author_email()); ?>"

    but nothing shows up.

    Any help would be appreciated - thanks

  2. snowcrash
    Posted 9 years ago #

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

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

    And for

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

  3. snowcrash
    Posted 9 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
    Posted 9 years ago #

    Maybe a set cookie statement?

Topic Closed

This topic has been closed to new replies.

About this Topic