get_results(); } else { global $wpdb; $userIDs = $wpdb->get_col(' SELECT ID FROM '.$wpdb->users.' INNER JOIN '.$wpdb->usermeta.' ON '.$wpdb->users.'.ID = '.$wpdb->usermeta.'.user_id WHERE '.$wpdb->usermeta.'.meta_key = \''.$wpdb->prefix.'capabilities\' AND '.$wpdb->usermeta.'.meta_value LIKE \'%"'.$role.'"%\' '); } // echo "
"; // echo print_r( $userIDs ); // echo ""; return $userIDs; } function midea_list_authors($user_role='contributor', $show_fullname = true) { // Generate a list of authors for a given role // default is to list authors and show full name global $wpdb; $blog_url = get_bloginfo('url'); // store base URL of blog $holding_pen = array(); // this is cheap, a holder for author data // get array of all author ids for a role $authors = getUsersByRole( $user_role ); foreach ( $authors as $item ) { // get number of posts by this author; custom query $post_count = $wpdb->get_results("SELECT COUNT( * ) as cnt FROM $wpdb->posts WHERE post_author =" . $item . " AND post_type = 'post' AND post_status = 'publish'"); // only output authors with posts; ugly way to get to the result, but it works.... if ($post_count[0]->cnt) { // load info on this user $author = get_userdata( $item); // store output in temp array; we use last names as an index in this array $holding_pen[$author->last_name] = '
"; // echo print_r( $holding_pen ); // echo ""; // now we can spit the output out. ob_start(); echo '