Find out when a user was created and display varied content depending on time since creation

I am looking to display different content after a user registers. Is there a way to find out the registration date and then if it’s been 1 day display one thing, but if it’s been 2 days display something else?

Something like this, but based on the registration date and not a post entry date:

<?php if (strtotime($post->post_date) > strtotime('-30 days')): ?>
   //Text for posts created in the last 30 days
<?php endif; ?>

Related posts

Leave a Reply

2 comments

  1. Yes you can!

    <?php 
    get_currentuserinfo(); 
    $user_data = get_userdata($user_ID);
    $registered_date = $user_data->user_registered;
    if (strtotime($registered_date) > strtotime('-30 days')){
       //Text for users registered in the last 30 days
    }
    ?>
    

    hope this helps

  2. The above code is now deprecated.

        <?php  
    $user_data = get_userdata(get_current_user_id());
    $registered_date = $user_data->user_registered;
    if (strtotime($registered_date) > strtotime('-30 days')){
       //Text for users registered in the last 30 days
    }
    ?>