Changeset 818500
- Timestamp:
- 12/10/2013 10:26:42 PM (12 years ago)
- Location:
- authors/trunk
- Files:
-
- 2 added
- 3 edited
-
authors.php (modified) (7 diffs)
-
lang/authors-sr_RS.mo (added)
-
lang/authors-sr_RS.po (added)
-
lang/authors.pot (modified) (1 diff)
-
readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
authors/trunk/authors.php
r720128 r818500 4 4 Plugin URI: http://blog.fleischer.hu/wordpress/authors/ 5 5 Description: Authors Widget shows the list or cloud of the authors, with the number of posts, link to RSS feed next to their name, avatar. It is useful in a multi-author blog, where you want to have the list in the sidemenu. 6 Version: 2. 36 Version: 2.4 7 7 Author: Gavriel Fleischer 8 8 Author URI: http://blog.fleischer.hu/author/gavriel/ … … 87 87 if ( function_exists('seo_tag_cloud_generate') ) : 88 88 function widget_authors_cloud($args = '') { 89 global $wpdb;90 91 89 $defaults = array( 92 90 'optioncount' => false, 'exclude_admin' => true, … … 104 102 $return = ''; 105 103 106 if (empty($include)) { 107 $include_sql = ''; 108 $exclude_sql = ' AND ID NOT IN (' . $exclude . ') AND user_login NOT IN (' . $exclude . ')'; 109 } else { 110 $include_sql = ' AND (ID IN (' . $include . ') OR user_login IN (' . $include . '))'; 111 $exclude_sql = ''; 112 } 113 $authors = $wpdb->get_results('SELECT ID, user_nicename, display_name FROM ' . $wpdb->users . ' WHERE 0=0' . ($exclude_admin ? ' AND ID <> 1' : '') . $exclude_sql . $include_sql . ' ORDER BY display_name'); 114 115 $author_count = array(); 116 foreach ((array) $wpdb->get_results('SELECT DISTINCT post_author, COUNT(ID) AS count FROM '.$wpdb->posts.' WHERE post_type = "post" AND ' . get_private_posts_cap_sql( 'post' ) . ' GROUP BY post_author') as $row) { 117 $author_count[$row->post_author] = $row->count; 118 } 119 104 $authors = widget_authors_get_authors( $include, $exclude ); 105 $author_count = widget_authors_count_authors ( $authors ); 120 106 widget_authors_sort_by($orderby, $authors); 121 107 … … 124 110 if ( $posts != 0 || !$hide_empty ) { 125 111 $author = get_userdata( $author->ID ); 112 if ($exclude_admin && 10 == $author->user_level) 113 continue; 126 114 $name = $author->display_name; 127 115 if ( $show_fullname && ($author->first_name != '' && $author->last_name != '') ) … … 202 190 */ 203 191 function widget_authors_list_authors($args = '') { 204 global $wpdb;205 206 192 $defaults = array( 207 193 'optioncount' => false, 'exclude_admin' => true, … … 219 205 $return = ''; 220 206 221 if (empty($include)) { 222 $include_sql = ''; 223 $exclude_sql = ' AND ID NOT IN (' . $exclude . ') AND user_login NOT IN (' . $exclude . ')'; 224 } else { 225 $include_sql = ' AND (ID IN (' . $include . ') OR user_login IN (' . $include . '))'; 226 $exclude_sql = ''; 227 } 228 /** @todo Move select to get_authors(). */ 229 $authors = $wpdb->get_results('SELECT ID, user_nicename FROM ' . $wpdb->users . ' WHERE 0=0' . ($exclude_admin ? ' AND ID <> 1' : '') . $exclude_sql . $include_sql . ' ORDER BY display_name'); 230 231 $author_count = array(); 232 foreach ((array) $wpdb->get_results('SELECT DISTINCT post_author, COUNT(ID) AS count FROM ' . $wpdb->posts . ' WHERE post_type = "post" AND ' . get_private_posts_cap_sql('post') . ' GROUP BY post_author') as $row) { 233 $author_count[$row->post_author] = $row->count; 234 } 235 207 $authors = widget_authors_get_authors( $include, $exclude); 208 $author_count = widget_authors_count_authors ( $authors ); 236 209 widget_authors_sort_by($orderby, $authors); 237 210 … … 534 507 return $newoptions; 535 508 } 509 function widget_authors_get_authors( $include = array(), $exclude = array()) { 510 if ( !empty( $include ) ) { 511 $include = explode( ',', $include); 512 foreach ( $include as $key => $val ) { 513 if ( !is_int( $val ) ) { 514 $user = get_user_by( 'login', $val ); 515 $include[$key] = $user->ID; 516 } 517 } 518 } 519 if ( !empty( $exclude ) ) { 520 $exclude = explode( ',', $exclude); 521 foreach ( $exclude as $key => $val ) { 522 if ( !is_int( $val ) ) { 523 $user = get_user_by( 'login', $val ); 524 $exclude[$key] = $user->ID; 525 } 526 } 527 } 528 $user_args = array( 529 'fields' => array( 'ID', 'user_nicename', 'display_name' ), 530 'who' => 'authors', 531 'orderby' => 'display_name', 532 'include' => $include, 533 'exclude' => $exclude 534 ); 535 $wp_user_search = new WP_User_Query( $user_args ); 536 $authors = $wp_user_search->get_results(); 537 return $authors; 538 } 539 540 function widget_authors_count_authors( $authors ) { 541 $author_ids = array(); 542 foreach( $authors as $author) { 543 $author_ids[] = $author->ID; 544 } 545 $author_count = count_many_users_posts($author_ids); 546 return $author_count; 547 } 536 548 537 549 if ( !$options = get_option( 'widget_authors' ) ) -
authors/trunk/lang/authors.pot
r642402 r818500 1 # Copyright (C) 201 2Authors Widget1 # Copyright (C) 2013 Authors Widget 2 2 # This file is distributed under the same license as the Authors Widget package. 3 3 msgid "" 4 4 msgstr "" 5 "Project-Id-Version: Authors Widget 2. 2.1\n"5 "Project-Id-Version: Authors Widget 2.4\n" 6 6 "Report-Msgid-Bugs-To: http://wordpress.org/tag/authors\n" 7 "POT-Creation-Date: 201 2-12-20 16:35:58+00:00\n"7 "POT-Creation-Date: 2013-12-10 20:46:18+00:00\n" 8 8 "MIME-Version: 1.0\n" 9 9 "Content-Type: text/plain; charset=UTF-8\n" 10 10 "Content-Transfer-Encoding: 8bit\n" 11 "PO-Revision-Date: 201 2-MO-DA HO:MI+ZONE\n"11 "PO-Revision-Date: 2013-MO-DA HO:MI+ZONE\n" 12 12 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" 13 13 "Language-Team: LANGUAGE <LL@li.org>\n" 14 14 15 #: authors.php:15 115 #: authors.php:159 16 16 msgid "Select Author..." 17 17 msgstr "" 18 18 19 #: authors.php:2 5519 #: authors.php:248 20 20 msgid "Posts by %s" 21 21 msgstr "" 22 22 23 #: authors.php:3 15 authors.php:53323 #: authors.php:308 authors.php:557 24 24 msgid "Authors" 25 25 msgstr "" 26 26 27 #: authors.php:3 5027 #: authors.php:343 28 28 msgid "Powered by %s" 29 29 msgstr "" 30 30 31 #: authors.php:3 5031 #: authors.php:343 32 32 msgid "Authors Widget Plugin for Wordpress" 33 33 msgstr "" 34 34 35 #. #-#-#-#-# plugin.pot (Authors Widget 2.2.1) #-#-#-#-#35 #. #-#-#-#-# authors.pot (Authors Widget 2.4) #-#-#-#-# 36 36 #. Plugin Name of the plugin/theme 37 #: authors.php:3 5037 #: authors.php:343 38 38 msgid "Authors Widget" 39 39 msgstr "" 40 40 41 #: authors.php:4 6141 #: authors.php:445 42 42 msgid "Title" 43 43 msgstr "" 44 44 45 #: authors.php:4 6345 #: authors.php:447 46 46 msgid "Format" 47 47 msgstr "" 48 48 49 #: authors.php:4 6449 #: authors.php:448 50 50 msgid "List" 51 51 msgstr "" 52 52 53 #: authors.php:4 6653 #: authors.php:450 54 54 msgid "Cloud" 55 55 msgstr "" 56 56 57 #: authors.php:4 6857 #: authors.php:452 58 58 msgid "Dropdown" 59 59 msgstr "" 60 60 61 #: authors.php:4 7161 #: authors.php:455 62 62 msgid "Order by" 63 63 msgstr "" 64 64 65 #: authors.php:4 7265 #: authors.php:456 66 66 msgid "Display name" 67 67 msgstr "" 68 68 69 #: authors.php:4 7369 #: authors.php:457 70 70 msgid "First name" 71 71 msgstr "" 72 72 73 #: authors.php:4 7473 #: authors.php:458 74 74 msgid "Last name" 75 75 msgstr "" 76 76 77 #: authors.php:4 7577 #: authors.php:459 78 78 msgid "Post count" 79 79 msgstr "" 80 80 81 #: authors.php:477 81 #: authors.php:460 82 msgid "ID" 83 msgstr "" 84 85 #: authors.php:462 82 86 msgid "Number of authors to show" 83 87 msgstr "" 84 88 85 #: authors.php:4 7889 #: authors.php:463 86 90 msgid "Show full name" 87 91 msgstr "" 88 92 89 #: authors.php:4 7993 #: authors.php:464 90 94 msgid "Show avatar" 91 95 msgstr "" 92 96 93 #: authors.php:4 8097 #: authors.php:465 94 98 msgid "Avatar size" 95 99 msgstr "" 96 100 97 #: authors.php:4 81101 #: authors.php:466 98 102 msgid "Show RSS links" 99 103 msgstr "" 100 104 101 #: authors.php:4 82105 #: authors.php:467 102 106 msgid "Show post counts" 103 107 msgstr "" 104 108 105 #: authors.php:4 83109 #: authors.php:468 106 110 msgid "Hide empty" 107 111 msgstr "" 108 112 109 #: authors.php:4 84113 #: authors.php:469 110 114 msgid "Exclude admin" 111 115 msgstr "" 112 116 113 #: authors.php:4 85117 #: authors.php:470 114 118 msgid "Exclude" 115 119 msgstr "" 116 120 117 #: authors.php:4 86121 #: authors.php:471 118 122 msgid "Include" 119 123 msgstr "" 120 124 121 #: authors.php:4 88125 #: authors.php:473 122 126 msgid "How satisfied you are with the plugin?" 123 127 msgstr "" 124 128 125 #: authors.php:4 90129 #: authors.php:475 126 130 msgid "Donate" 127 131 msgstr "" 128 132 129 #: authors.php:491 130 msgid "Display \"Powered by Authors widget\" link" 131 msgstr "" 132 133 #: authors.php:491 133 #: authors.php:476 134 134 msgid "Show credit" 135 135 msgstr "" 136 136 137 #: authors.php:5 31137 #: authors.php:555 138 138 msgid "A list of the authors" 139 139 msgstr "" -
authors/trunk/readme.txt
r720128 r818500 4 4 Tags: authors, author, multi-author, multi-user, list, sidemenu, sidebar, links, widgets, widget, plugin, avatar, gravatar 5 5 Requires at least: 2.0.2 6 Tested up to: 3. 5.16 Tested up to: 3.8 7 7 Stable tag: trunk 8 8 … … 55 55 * Belarusian / беларуская by [Alexander Ovsov](http://webhostinggeeks.com/science/ "Web Geek Sciense") 56 56 * Polish / Polski [Krzysztof](http://pl2wp.prywatny.eu/) 57 * Serbian / srpski by [Borisa Djuraskovic] 58 * Italian / italiano by [Aurezio](http://www.sognoesondesto.it) 57 59 58 60 = How can I exclude certain authors from being displayed? = … … 83 85 84 86 == Changelog == 87 88 = 2.4 = 89 * Optimized for blogs with many authors 90 * Added Serbian translation 91 * Added Italian translation 85 92 86 93 = 2.3 =
Note: See TracChangeset
for help on using the changeset viewer.