Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

if test on wp user registration date

Posted on 2012-09-09
2
Medium Priority
?
478 Views
Last Modified: 2012-09-09
I need to test to see if a wordpress user registered more than 2 months ago.

I can get the registration date using this:

$user_reg_dt = get_the_author_meta('user_registered');

if I echo $user_reg_dt I find the date is displayed like this: 2011-09-01 21:53:31

Now, I need to do this:

if ($user_reg_dt > (two months ago) ) { /* do this */ }

Can you show me how to write the (two months ago) part to make this work?

Thanks,

Chris
0
Comment
Question by:St_Aug_Beach_Bum
2 Comments
 
LVL 10

Accepted Solution

by:
honestman31 earned 2000 total points
ID: 38381178
if   ( strtotime ( "now" ) -  strtotime ($user_reg_dt)   >60*60*24*60   )   { do something }


last 60  means 60 days , it could be 61 or 62

to make the script run a bit faster you can use 5184000  instead of   60*60*24*60
but i like to use   60*60*24*60
0
 

Author Comment

by:St_Aug_Beach_Bum
ID: 38381321
Working great - thank you!!!
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
It’s a season to be thankful, and we’re thankful for users like you who engage on site, solve technology problems, and network with others in the industry. What tech are we most thankful for? Keep reading.
The purpose of this video is to demonstrate how to add AdSense Ads to a WordPress Website, and how to set up WordPress to automatically place Ads in Sidebars. This will be demonstrated using a Windows 8 PC. Log into your AdSense account. : Cli…
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses
Course of the Month20 days, 14 hours left to enroll

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question