WordPress.org

Make WordPress Core

Ticket #43936: 43936.diff

File 43936.diff, 834 bytes (added by subrataemfluence, 14 months ago)
  • .php

    diff --git a/template.php b/template-new.php
    index 5b659f0..28dce49 100755
    old new function parent_dropdown( $default = 0, $parent = 0, $level = 0, $post = null ) 
    827827 * @param string $selected Slug for the role that should be already selected.
    828828 * @param array $roles_to_exclude Array of roles to exclude in dropdown.
    829829 */
    830 function wp_dropdown_roles( $selected = '' ) {
     830function wp_dropdown_roles( $selected = '', $roles_to_exclude = array() ) {
    831831        $r = '';
    832832
    833833        $editable_roles = array_reverse( get_editable_roles() );
    834834
     835        if( ! empty( $roles_to_exclude ) ) {
     836                foreach( $roles_to_exclude as $role_to_exclude ) {
     837                        unset( $editable_roles[$role_to_exclude] );
     838                }
     839        }
     840
    835841        foreach ( $editable_roles as $role => $details ) {
    836842                $name = translate_user_role($details['name'] );
    837843