firstDate); $lastDate = strtotime($dates->lastDate); function dayofweek(){ $days = array("Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"); return array_search(date("D"), $days) + 1; } $current_date = time(); $current_day = dayofweek(); $last_monday = mktime(0,0,0, date("m", $current_date), date("d", $current_date)-($current_day-1), date("Y", $current_date)); $day = $last_monday; $weeks = array(); while ($day > $firstDate){ $prevWeek = strtotime ( '-7 days' , $day); array_push($weeks, date('m/d/y', $prevWeek) . ' - ' . date('m/d/y', strtotime ( '-1 days' , $day))); $day = $prevWeek; } ?>

Author Manager


About

Peter Mandell (developer)

I am a young web developer currently based out of Philadelphia, PA. My skills include PHP, ColdFusion, MySQL, jQuery, and more.

Visit my site


Donate

If you found this plugin useful, please donate!


General

This plugin will let you search all published posts and display a list of authors who posted during a given time frame. Choose a week from the drop-down menu, or input a specific date range.


Search Posts

Search by:

Week
value='am-week-filter'/>
  Dates
value='am-date-filter'/>
------ OR ------
Start Date: '/>
End Date: '/>
   

Results

Name # of Posts Show Posts
Show

No results founds.


query("SELECT (SELECT post_date FROM $wpdb->posts WHERE post_type = 'post' ORDER BY post_date LIMIT 1) AS firstDate, (SELECT post_date FROM $wpdb->posts WHERE post_type = 'post' ORDER BY post_date DESC LIMIT 1) AS lastDate"); return $wpdb->last_result[0]; } function get_posts_by_author($splitWeek){ global $wpdb; $start = date("Y-m-d H:i:s", strtotime(trim($splitWeek[0]))); $end = date("Y-m-d H:i:s", strtotime(trim($splitWeek[1]))); $end = date('Y-m-d H:i:s', strtotime($end) + 86399); $wpdb->query("SELECT p.post_title as title, p.ID as postID, p.post_author as authorID, u.display_name as name FROM $wpdb->posts p JOIN $wpdb->users u ON p.post_author = u.id WHERE post_type = 'post' AND post_status = 'publish' AND post_date >= '$start' AND post_date <= '$end' ORDER BY post_date ASC"); $results = $wpdb->last_result; $authorPosts = array(); for ($i=0; $ilast_result); $i++){ if (!array_key_exists($results[$i]->authorID, $authorPosts)){ $authorPosts[$results[$i]->authorID] = array('name' => $results[$i]->name, 'posts' => array(), 'count' => 0); } array_push($authorPosts[$results[$i]->authorID]['posts'], array('title'=>$results[$i]->title, 'postID' => $results[$i]->postID)); $authorPosts[$results[$i]->authorID]['count'] = $authorPosts[$results[$i]->authorID]['count'] + 1; } return $authorPosts; } ?>