ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

How To Display Raw "join_date" Variable

May 26, 2011 6:49pm

Subscribe [3]
  • #1 / May 26, 2011 6:49pm

    ovation01

    42 posts

    Hi - I have a need to output the raw “join_date” variable for the logged-in member, shown in the original unix timestamp - not the date formatting.

    I’ve played with {exp:query} but cannot get it to look for the join_date of the logged-in member. Ex code that doesn’t work:

    {exp:query sql="SELECT join_date FROM exp_members WHERE username = '{logged_in_username}' "}
    
    {join_date}
    
    {/exp:query}

    This returns nothing, as it cannot read the variable {logged_in_username} inside the query tag.

    Similarly, the {exp:member:custom_profile_data} will not give the join_date unless I specify a format—but I don’t need a format.

    Any ideas how to render the raw join_date?

  • #2 / May 26, 2011 7:24pm

    Mark Bowen

    12637 posts

    Hiya,

    You’ll probably need to use some PHP in the template to get what you want here. This should give you what you need. You’ll need to enable PHP in your template set to Input modein order for this to work.

    <?php
    
    global $SESS;
    $member_username = $SESS->userdata['username'];
    
    ?>
    
    {exp:query sql="
    
    SELECT
            join_date
    FROM
            exp_members
    WHERE
            username = '<?php echo $member_username; ?>'
    
    "}
    
    {join_date}
    
    {/exp:query}

    Hope that helps a bit.

    Best wishes,

    Mark

  • #3 / May 26, 2011 7:39pm

    ovation01

    42 posts

    You’re awesome! I had a feeling PHP may have been the solution, just didn’t know how to access the info like that. Worked perfectly, thank you! I think I owe you a drink 😊

  • #4 / May 26, 2011 8:30pm

    Mark Bowen

    12637 posts

    You’re awesome! I had a feeling PHP may have been the solution, just didn’t know how to access the info like that. Worked perfectly, thank you! I think I owe you a drink 😊

    No problems. Glad that got it sorted for you.

    Hope everything else goes well for you.

    Best wishes,

    Mark

  • #5 / May 26, 2011 10:44pm

    Sue Crocker

    26054 posts

    Thanks for the assist, Mark.

    Carlyn, fel free to post again as needed.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases