diff --git a/export_old.php b/export_new.php
index 2efd040..52c7422 100644
old
|
new
|
function export_wp( $args = array() ) { |
237 | 237 | global $wpdb; |
238 | 238 | |
239 | 239 | $authors = array(); |
240 | | $results = $wpdb->get_results( "SELECT DISTINCT post_author FROM $wpdb->posts" ); |
| 240 | $results = $wpdb->get_results( "SELECT DISTINCT ID FROM $wpdb->users" ); |
241 | 241 | foreach ( (array) $results as $result ) |
242 | | $authors[] = get_userdata( $result->post_author ); |
| 242 | $authors[] = get_userdata( $result->ID ); |
243 | 243 | |
244 | 244 | $authors = array_filter( $authors ); |
245 | | |
| 245 | |
246 | 246 | foreach( $authors as $author ) { |
247 | | echo "\t<wp:author>"; |
248 | | echo '<wp:author_id>' . $author->ID . '</wp:author_id>'; |
249 | | echo '<wp:author_login>' . $author->user_login . '</wp:author_login>'; |
250 | | echo '<wp:author_email>' . $author->user_email . '</wp:author_email>'; |
251 | | echo '<wp:author_display_name>' . wxr_cdata( $author->display_name ) . '</wp:author_display_name>'; |
252 | | echo '<wp:author_first_name>' . wxr_cdata( $author->user_firstname ) . '</wp:author_first_name>'; |
253 | | echo '<wp:author_last_name>' . wxr_cdata( $author->user_lastname ) . '</wp:author_last_name>'; |
254 | | echo "</wp:author>\n"; |
| 247 | /* |
| 248 | We can allow specific access level user in following approach |
| 249 | if($author->wp_capabilities['editor'] || $author->wp_capabilities['author'] || $author->wp_capabilities['administrator'] || $author->wp_capabilities['contributor']) |
| 250 | */ |
| 251 | if($author->user_level>0) |
| 252 | { |
| 253 | echo "\t<wp:author>"; |
| 254 | echo '<wp:author_id>' . $author->ID . '</wp:author_id>'; |
| 255 | echo '<wp:author_login>' . $author->user_login . '</wp:author_login>'; |
| 256 | echo '<wp:author_email>' . $author->user_email . '</wp:author_email>'; |
| 257 | echo '<wp:author_display_name>' . wxr_cdata( $author->display_name ) . '</wp:author_display_name>'; |
| 258 | echo '<wp:author_first_name>' . wxr_cdata( $author->user_firstname ) . '</wp:author_first_name>'; |
| 259 | echo '<wp:author_last_name>' . wxr_cdata( $author->user_lastname ) . '</wp:author_last_name>'; |
| 260 | echo "</wp:author>\n"; |
| 261 | } |
255 | 262 | } |
256 | 263 | } |
257 | 264 | |