Quantcast
Channel: Question and Answer » wpdb
Viewing all articles
Browse latest Browse all 44

Getting users who registered 360 days from current date

$
0
0

As per the title, what I want to do is run a custom query that (using WP-Cron) will run once a day to check for users who registered exactly 360 days before the current date (don’t need time, just date) and gather their ID. I have this:

global $wpdb;
$sql = $wpdb->prepare(
    "SELECT * FROM {$wpdb->users} 
     WHERE {$wpdb->users}.user_registered = CURRENT-DATE-MINUS-360-DAYS";
);
$userdata = HOW-DO-I-GET-THE-RESULTS-IN-AN-ARRAY

Where the bit in caps represents the bit I have no idea what to do :) Any help much appreciated.


Viewing all articles
Browse latest Browse all 44

Trending Articles