phpdoc for wp_dropdown_roles(). Add role_names_listing filter. Props jeremyclarke. fixes #8761

git-svn-id: https://develop.svn.wordpress.org/trunk@10285 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2008-12-31 17:40:05 +00:00
parent 44363b9f5f
commit 6bc1f53e0f

View File

@ -2586,20 +2586,28 @@ function the_attachment_links( $id = false ) {
<?php <?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; global $wp_roles;
$p = ''; $p = '';
$r = ''; $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); $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>"; $p = "\n\t<option selected='selected' value='$role'>$name</option>";
else else
$r .= "\n\t<option value='$role'>$name</option>"; $r .= "\n\t<option value='$role'>$name</option>";