Skip to content

Commit

Permalink
phpdoc for wp_dropdown_roles(). Add role_names_listing filter. Props …
Browse files Browse the repository at this point in the history
…jeremyclarke. fixes #8761

git-svn-id: http://svn.automattic.com/wordpress/trunk@10285 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information
ryan committed Dec 31, 2008
1 parent c7c9f46 commit 6bc4151
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions wp-admin/includes/template.php
Expand Up @@ -2586,20 +2586,28 @@ function the_attachment_links( $id = false ) {
<?php
}


/**
* {@internal Missing Short Description}}
* Print out <option> html elements for role selectors based on $wp_roles
*
* @since unknown
* @package WordPress
* @subpackage Administration
* @since 2.1
*
* @param unknown_type $default
* @uses $wp_roles
* @param string $default slug for the role that should be already selected
*/
function wp_dropdown_roles( $default = false ) {
function wp_dropdown_roles( $selected = false ) {
global $wp_roles;
$p = '';
$r = '';
foreach( $wp_roles->role_names as $role => $name ) {

$role_names = $wp_roles->role_names;
$role_names = apply_filters('role_names_listing', $role_names);

foreach( $role_names as $role => $name ) {
$name = translate_with_context($name);
if ( $default == $role ) // Make default first in list
if ( $selected == $role ) // Make default first in list
$p = "\n\t<option selected='selected' value='$role'>$name</option>";
else
$r .= "\n\t<option value='$role'>$name</option>";
Expand Down

0 comments on commit 6bc4151

Please sign in to comment.