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; ?>
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; ?>
Share
Improve this question
asked Jan 31, 2011 at 4:01
RedRed
4233 gold badges9 silver badges15 bronze badges
2 Answers
Reset to default 6Yes 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
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
}
?>