Calculate days since last log entry
-
I want to GET (the number) of days since last log entry.
For example, the following code looks through the mycred logs for
approved_comment
:global $wpdb, $mycred; $comments = $wpdb->get_var( $wpdb->prepare( " SELECT COUNT(*) FROM {$mycred->log_table} WHERE ref = %s AND user_id = %d", 'approved_comment', $userID ) ); echo 'You have posted a total of ' . $comments . ' comments.';
I want to find out when the user posted their last comment and calculate how many days it has been.
For example, if the user’s last comment was 20 days ago, then I want to get
20
in a variable.Is this possible to do?
Viewing 8 replies - 1 through 8 (of 8 total)
Viewing 8 replies - 1 through 8 (of 8 total)
- The topic ‘Calculate days since last log entry’ is closed to new replies.