wp_dropdown_users example

<?php _ex( 'Posts', 'post type general name' ); ?></label></p> <ul id="post-filters" class="export-filters"> <li> <label><span class="label-responsive"><?php _e( 'Categories:' ); ?></span> <?php wp_dropdown_categories( array( 'show_option_all' => __( 'All' ) ) ); ?> </label> </li> <li> <label><span class="label-responsive"><?php _e( 'Authors:' ); ?></span> <?php         $authors = $wpdb->get_col( "SELECT DISTINCT post_author FROM {$wpdb->posts} WHERE post_type = 'post'" );
        wp_dropdown_users(
            array(
                'include'         => $authors,
                'name'            => 'post_author',
                'multi'           => true,
                'show_option_all' => __( 'All' ),
                'show'            => 'display_name_with_login',
            )
        );
        ?> </label> </li> <li> <fieldset> <legend class="screen-reader-text">
<?php endif; ?> <ul style="list-style:none;"> <li> <input type="radio" id="delete_option0" name="delete_option" value="delete" /> <label for="delete_option0"><?php _e( 'Delete all content.' ); ?></label> </li> <li> <input type="radio" id="delete_option1" name="delete_option" value="reassign" /> <label for="delete_option1"><?php _e( 'Attribute all content to:' ); ?></label> <?php                         wp_dropdown_users(
                            array(
                                'name'    => 'reassign_user',
                                'exclude' => $user_ids,
                                'show'    => 'display_name_with_login',
                            )
                        );
                        ?> </li> </ul> </fieldset> <?php

                            $users_opt = apply_filters( 'quick_edit_dropdown_authors_args', $users_opt$bulk );

                            $authors = wp_dropdown_users( $users_opt );

                            if ( $authors ) {
                                $authors_dropdown  = '<label class="inline-edit-author">';
                                $authors_dropdown .= '<span class="title">' . __( 'Author' ) . '</span>';
                                $authors_dropdown .= $authors;
                                $authors_dropdown .= '</label>';
                            }
                        }
                    } // current_user_can( 'edit_others_posts' )
                    if ( ! $bulk ) {
                        
global $user_ID;

    $post_type_object = get_post_type_object( $post->post_type );
    ?> <label class="screen-reader-text" for="post_author_override"> <?php     /* translators: Hidden accessibility text. */
    _e( 'Author' );
    ?> </label> <?php     wp_dropdown_users(
        array(
            'capability'       => array( $post_type_object->cap->edit_posts ),
            'name'             => 'post_author_override',
            'selected'         => empty( $post->ID ) ? $user_ID : $post->post_author,
            'include_selected' => true,
            'show'             => 'display_name_with_login',
        )
    );
}

/** * Displays list of revisions. * * @since 2.6.0 * * @param WP_Post $post Current post object. */
Home | Imprint | This part of the site doesn't use cookies.