I posted the solution I found, but after a last test, it did’nt work… So I edited my post… ??
But now, I think I found a solution… Seems to work…
Since I’m almost a php/sql analphabet, I didn’t understand very well your last answer, especially the first idea with “post__in”.
So here is what I did :
I made a function, on the same principle than “get_users_of_blog”…
function the_last_post_per_user(){
global $wpdb;
$the_authors = $wpdb->get_results( "SELECT DISTINCT post_author FROM $wpdb->posts WHERE post_status='publish' AND post_type='post' AND post_author !='1' ORDER BY post_date DESC LIMIT 0,10");
return $the_authors;
}
I use the post table to retreive the authors Ids… this way, I’m able to order by post date… I made a “Select distinct” query to avoid duplication of post_author Ids…
Then, I use this function before the query you gave me yesterday, instead of “get_users_of_blog”… And I replace the $bloguser->user_id
by : $bloguser->post_author
:
<?php
//get all users, iterate through users, query for one post for the user,
//if there is a post then display the post title, author, content info
$blogusers = the_last_post_per_user;
if ($blogusers) {
foreach ($blogusers as $bloguser) {
$args = array(
'author' => $bloguser->post_author,
'showposts' => 1,
'caller_get_posts' => 1
);
$my_query = new WP_Query($args);
if( $my_query->have_posts() ) {
[...]
endwhile;
}
}
}
?>
Seems to work, so far…
Do you have any opinion, or see any problem about this solution Michael? I would be glad if you can give me some feedback about it…
S.