| | 123 | <?php $user_result = $wpdb->get_results("SELECT DISTINCT post_author AS user_ID FROM $wpdb->posts WHERE post_type = 'post'"); |
| | 124 | |
| | 125 | if ( count($user_result) > 1 ) { ?> |
| | 126 | |
| | 127 | <form name="viewuser" action="" method="get" style="float: left; width: 20em; margin-bottom: 1em;"> |
| | 128 | <fieldset> |
| | 129 | <legend><?php _e('Browse Author…') ?></legend> |
| | 130 | <select name='author'> |
| | 131 | <option value=''><?php _e('All') ?></option> |
| | 132 | <?php |
| | 133 | foreach ($user_result as $user_row) { |
| | 134 | |
| | 135 | if( isset($_GET['author']) && $user_row->user_ID == (int) $_GET['author'] ) |
| | 136 | $default = 'selected="selected"'; |
| | 137 | else |
| | 138 | $default = null; |
| | 139 | |
| | 140 | echo "<option $default value='$user_row->user_ID'>"; |
| | 141 | $user = get_userdata($user_row->user_ID); |
| | 142 | echo $user->display_name; |
| | 143 | echo "</option>\n"; |
| | 144 | } |
| | 145 | ?> |
| | 146 | </select> |
| | 147 | <input type="submit" name="submit" value="<?php _e('Show Author') ?>" /> |
| | 148 | </fieldset> |
| | 149 | </form> |
| | 150 | |
| | 151 | <?php } ?> |
| | 152 | |