Changeset 5229
- Timestamp:
- 02/18/06 05:16:44 (2 years ago)
- Location:
- wp-stats/trunk
- Files:
-
- 3 modified
-
readme.txt (modified) (1 diff)
-
stats.php (modified) (6 diffs)
-
wp-stats.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-stats/trunk/readme.txt
r5122 r5229 15 15 - NEW: Slightly Changed The Grouping Of Stats 16 16 - NEW: WP-Stats Now Can Be Found ALso On The Dashboard 17 - NEW: Added Author Status 17 18 - FIXED: Moved All Stats Functions To stats.php 18 19 -
wp-stats/trunk/stats.php
r5124 r5229 44 44 <h2>General Stats</h2> 45 45 <ul> 46 <li><b><?php get_totalauthors(); ?></b> Authors To This Blog.</li> 46 47 <li><b><?php get_totalposts(); ?></b> Posts Were Posted.</li> 47 48 <li><b><?php get_totalpages(); ?></b> Pages Were Created.</li> … … 153 154 </div> 154 155 156 <!-- Author Stats --> 157 <div class="wrap"> 158 <h2>Authors Stats</h2> 159 <ol> 160 <?php get_authorsstats(); ?> 161 </ol> 162 </div> 163 155 164 <!-- Comments' Members Stats --> 156 165 <div class="wrap"> … … 182 191 183 192 193 ### Function: Get Total Authors 194 function get_totalauthors() { 195 global $wpdb; 196 $totalauthors = $wpdb->get_var("SELECT COUNT(ID) FROM $wpdb->users WHERE user_activation_key = ''"); 197 echo $totalauthors; 198 } 199 200 184 201 ### Function: Get Total Posts 185 202 function get_totalposts() { … … 233 250 $where = '(post_status = \'publish\' OR post_status = \'static\')'; 234 251 } 235 $recentposts = $wpdb->get_results("SELECT $wpdb->posts.ID, post_title, post_name, post_status, post_date, user_login FROM $wpdb->posts LEFT JOIN $wpdb->users ON $wpdb->users.ID = $wpdb->posts.post_author WHERE post_date < '".current_time('mysql')."' AND $where AND post_password = '' ORDER BY post_date DESC LIMIT $limit");252 $recentposts = $wpdb->get_results("SELECT $wpdb->posts.ID, post_title, post_name, post_status, post_date, user_login, display_name FROM $wpdb->posts LEFT JOIN $wpdb->users ON $wpdb->users.ID = $wpdb->posts.post_author WHERE post_date < '".current_time('mysql')."' AND $where AND post_password = '' ORDER BY post_date DESC LIMIT $limit"); 236 253 if($recentposts) { 237 254 foreach ($recentposts as $post) { 238 255 $post_title = htmlspecialchars(stripslashes($post->post_title)); 239 256 $post_date = mysql2date('d.m.Y', $post->post_date); 240 $ user_nickname = htmlspecialchars(stripslashes($post->user_login));241 echo "<li>$post_date - <a href=\"".get_permalink()."\">$post_title</a> ($ user_nickname)</li>";257 $display_name = htmlspecialchars(stripslashes($post->display_name)); 258 echo "<li>$post_date - <a href=\"".get_permalink()."\">$post_title</a> ($display_name)</li>"; 242 259 } 243 260 } else { … … 289 306 $comment_total = intval($post->comment_total); 290 307 echo "<li><a href=\"".get_permalink()."\">$post_title</a> - $comment_total ".__('comments')."</li>"; 308 } 309 } else { 310 echo '<li>'.__('N/A').'</li>'; 311 } 312 } 313 314 315 ### Function: Get Author Stats 316 function get_authorsstats() { 317 global $wpdb, $wp_rewrite; 318 $where = ''; 319 if($mode == 'post') { 320 $where = 'post_status = \'publish\''; 321 } elseif($mode == 'page') { 322 $where = 'post_status = \'static\''; 323 } else { 324 $where = '(post_status = \'publish\' OR post_status = \'static\')'; 325 } 326 $posts = $wpdb->get_results("SELECT COUNT($wpdb->posts.ID) AS 'posts_total', $wpdb->users.display_name, $wpdb->users.user_nicename FROM $wpdb->posts LEFT JOIN $wpdb->users ON $wpdb->users.ID = $wpdb->posts.post_author AND user_activation_key = '' AND $where GROUP BY $wpdb->posts.post_author"); 327 if($posts) { 328 $using_permalink = get_settings('permalink_structure'); 329 $permalink = $wp_rewrite->get_author_permastruct(); 330 foreach ($posts as $post) { 331 $author_link = str_replace('%author%', strip_tags(stripslashes($post->user_nicename)), $permalink); 332 $display_name = urlencode($post->display_name); 333 $posts_total = intval($post->posts_total); 334 if($using_permalink) { 335 echo "<li><a href=\"".get_settings('siteurl').$author_link."\">$display_name</a> ($posts_total)</li>"; 336 } else { 337 echo "<li><a href=\"".get_settings('siteurl')."/?author_name=$post_author\">$display_name</a> ($posts_total)</li>"; 338 } 291 339 } 292 340 } else { … … 529 577 530 578 579 ### Function: Display UserOnline 580 if(!function_exists('get_useronline')) { 581 function get_useronline($user = 'User', $users = 'Users', $display = true) { 582 global $useronline; 583 // Display User Online 584 if($display) { 585 if($useronline > 1) { 586 echo "<b>$useronline</b> $users ".__('Online'); 587 } else { 588 echo "<b>$useronline</b> $user ".__('Online'); 589 } 590 } else { 591 return $useronline; 592 } 593 } 594 } 595 596 531 597 ### Function: Display Max UserOnline 532 598 if(!function_exists('get_most_useronline')) { -
wp-stats/trunk/wp-stats.php
r5124 r5229 34 34 <h2 class="pagetitle">General Stats</h2> 35 35 <ul> 36 <li><b><?php get_totalauthors(); ?></b> Authors To This Blog.</li> 36 37 <li><b><?php get_totalposts(); ?></b> Posts Were Posted.</li> 37 38 <li><b><?php get_totalpages(); ?></b> Pages Were Created.</li> … … 138 139 </ul> 139 140 141 <!-- Author Stats --> 142 <h2 class="pagetitle">Authors Stats</h2> 143 <ol> 144 <?php get_authorsstats(); ?> 145 </ol> 146 140 147 <!-- Comments' Members Stats --> 141 148 <h2 class="pagetitle">Comments' Members Stats</h2>
