From 54a665ff4dd9e01a72b87ae9dc05dac12dd1f40a Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Tue, 6 Jun 2006 04:50:41 +0000 Subject: [PATCH] Deprecate list_authors(). Clean up wp_list_authors(). git-svn-id: https://develop.svn.wordpress.org/trunk@3848 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/deprecated.php | 6 ++++++ wp-includes/template-functions-author.php | 26 ++++++++--------------- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/wp-includes/deprecated.php b/wp-includes/deprecated.php index 2150e0d490..9b34885ca2 100644 --- a/wp-includes/deprecated.php +++ b/wp-includes/deprecated.php @@ -456,4 +456,10 @@ function dropdown_cats($optionall = 1, $all = 'All', $orderby = 'ID', $order = ' function tinymce_include() { wp_print_script( 'wp_tiny_mce' ); } + +function list_authors($optioncount = false, $exclude_admin = true, $show_fullname = false, $hide_empty = true, $feed = '', $feed_image = '') { + $args = compact('optioncount', 'exclude_admin', 'show_fullname', 'hide_empty', 'feed', 'feed_image'); + return wp_list_authors($args); +} + ?> diff --git a/wp-includes/template-functions-author.php b/wp-includes/template-functions-author.php index 4f443b38f2..3e5f2c5d92 100644 --- a/wp-includes/template-functions-author.php +++ b/wp-includes/template-functions-author.php @@ -156,26 +156,18 @@ function get_author_link($echo = false, $author_id, $author_nicename) { } function wp_list_authors($args = '') { - parse_str($args, $r); + if ( is_array($args) ) + $r = &$args; + else + parse_str($args, $r); - if ( !isset($r['optioncount']) ) - $r['optioncount'] = false; - if ( !isset($r['exclude_admin']) ) - $r['exclude_admin'] = true; - if ( !isset($r['show_fullname']) ) - $r['show_fullname'] = false; - if ( !isset($r['hide_empty']) ) - $r['hide_empty'] = true; - if ( !isset($r['feed']) ) - $r['feed'] = ''; - if ( !isset($r['feed_image']) ) - $r['feed_image'] = ''; + $defaults = array('optioncount' => false, 'exclude_admin' => true, 'show_fullname' => false, 'hide_empty' => true, + 'feed' => '', 'feed_image' => ''); + $r = array_merge($defaults, $r); + extract($r); - list_authors($r['optioncount'], $r['exclude_admin'], $r['show_fullname'], $r['hide_empty'], $r['feed'], $r['feed_image']); -} - -function list_authors($optioncount = false, $exclude_admin = true, $show_fullname = false, $hide_empty = true, $feed = '', $feed_image = '') { global $wpdb; + // TODO: Move select to get_authors(). $query = "SELECT ID, user_nicename from $wpdb->users " . ($exclude_admin ? "WHERE user_login <> 'admin' " : '') . "ORDER BY display_name"; $authors = $wpdb->get_results($query);