Here is what you need.
<?php
$date = new DateTime('NOW');
$date->sub(new DateInterval('P30D')); //30 Days Interval
echo $back30days= $date->format('Y-m-d H:i:s') . "\n";
global $wpdp;
$top_users = $wpdb->get_results("select count(users.user_nicename) as posts, users.user_nicename as user_name from $wpdb->users as users join $wpdb->posts as posts where users.ID = posts.post_author AND posts.post_status="publish" AND posts.post_date_gmt > '$back30days' GROUP BY users.user_nicename ORDER BY count(users.user_nicename) DESC");
echo '<h3>In Past 30 Days</h3>';
foreach ($top_users as $top_user){
echo '<p>'.$top_user->user_name.' has written '.$top_user->posts.' posts</p>';
}
?>
Related Posts:
- $wpdb to insert html form information
- Getting Error Trying to Create Table
- Setting up foreign keys in phpMyAdmin?
- #1045 – Access denied for user ‘root’@’localhost’ (using password: YES)
- MySQL Error #1133 – Can’t find any matching row in the user table
- phpmyadmin #1045 Cannot log in to the MySQL server. after installing mysql command line client
- How to create a foreign key in phpmyadmin
- importing a CSV into phpmyadmin
- MySQL said: Documentation #1045 – Access denied for user ‘root’@’localhost’ (using password: NO)
- How do you properly prepare a %LIKE% SQL statement?
- $wpdb and MySQL Create Trigger
- wpdb->prepare function remove single quote for %s in SQL statment
- What specific database privileges does WordPress need?
- “#1067 – Invalid default value for ‘post_date'” when trying to reset AI after backup
- Alternative to mysql_real_escape_string
- Increment value (value = value+1) of $wpdb->update
- wpdb Custom Meta Data with 2 conditions
- wpdb prepare syntax
- SQL query not working in alphabetical post title/content search
- How to copy post titles to post slug in phpmyadmin
- MySQL LIKE not working
- How to do a MySQL dump from production site without using a search and replace script for local development?
- Proper way to work with wpdb to get user’s firstname
- How to check for empty and not a failure
- Database: Custom table: sprintf value for DateTime column
- Converting mysql to $wpdb
- How to Create a Admin User for A WordPress Site via MySQL (PHPMyAdmin)?
- WP_USE_EXT_MYSQL
- wpdb insert and boolean fields
- SQL error #1062 – Duplicate entry ‘1’ for key ‘PRIMARY’ [closed]
- Join new table with SQL query
- writing inner join in wpdb
- Set meta_key and meta_value for all registered user in wordpress using sql query [closed]
- Can’t find my wordpress DB in phpmyadmin
- How to split the a table in database?
- MySQL Rank & $wpdb
- When WordPress Default table, Echo Success. When Plugin Table, Echo Blank
- How do I join a $wpdb query with user meta using default value if not exist?
- Backing up and restoring multiple sites efficiently
- How to translate this mySQL query to $wpdb query
- $wpdb select all meta for each post
- Proper usage of $wpdb->update()?
- WordPress(wpdb class) and mysql stored procedures
- Can’t run database query
- Using WPDB->Insert()
- Active DB queries in WordPress?
- How to stop $wpdb from prepending database name
- WordPress $wpdb get posts from category and sort by custom meta
- Setting up WordPress Locally on WAMP for a new site (with one already)
- How to get INSERT errors from $wpdb?
- How to set MYSQLI_OPT_INT_AND_FLOAT_NATIVE option
- Export Yoast Keywords from MySQL/phpMyAdmin
- Editing mysql tables/database with wordpress or other app/cms
- Understanding custom php that reads from WP MYSQL
- How to insert dash (-) into database using wpdb and new_to_publish hook?
- $wpdb->get_var multiple queries in one database check
- Insert two row in wordpress database
- WordPress $wpdb no result
- PHP variables in mysql query
- Export SQL query based on custom field?
- Mysql Server keeps crashing
- MySQL ‘duplicate entry’ error
- User set date and time from frontend doesn’t get stored into database
- Wpdb query with dynamic table name
- get posts whether meta_key exists or not
- when using $wpdb sudden connection rejection without changing anything. Access denied, with errors from repair tool
- How to bulk delete a certain part of all wordpress posts
- When I add metadata, metavalue length is added in to the value in some cases
- WordPress fails to install with “Can’t Select Database” Error (WAMPServer)
- How to search usermeta table
- Find locations of all featured images of draft posts via SQL
- How to add virtual column in wpdb get_result statement
- SQL query to change custom field in WordPress database
- wpdb insert into point column in db
- An SQL query to find orphaned image attachments and their meta
- WPDB delivers wrong results from complex queries
- $wpdb post type and term query only works when there are no dashes or spaces in the term slug and title
- CONCAT_WS in custom sql query
- Geographical proximity query using post_meta
- MySQL Select within WP Page template
- Saving custom term value to the database in new table
- why is $wpdb->update() causing a DB error from within wp_set_password()
- $wpdb->get_var returns 0
- cannot log in to the mysql server (wamp and wordpress)
- SQL command to export post_content from wp_posts using phpMyAdmin
- Need SQL query to find&replace image URL
- Initialization of table in database using ‘CREATE … IF NOT EXISTS’
- SQL – Update multiple records in one query
- Get the Plugin Which Triggered a MySql Query in WordPress?
- Update results, Before deleting the related category [closed]
- Will changing the folder name two directories above a fresh wordpress installation break the site?
- Site not responding error – taking long to load [closed]
- Broken wordpress site, non-working links and no access to wp-admin page
- Valid SQL query return empty
- mysql query – how to escape apostrophe?
- WordPress database error: [Query was empty] – using $wpdb->prepare()
- Delete all users with Editor role and their content mysql
- Conditional formatting on data fetched from MYSQL
- Missing latest posts and options after DB migration via phpMyAdmin
- Complicated MySQL Query