List of Tasks by Assigned User

This topic contains 4 reply and 2 voices, and was last updated by Elitivia 10 years, 11 months ago
Viewing 4 Posts - 1 through 4 (of 4 total)
Author Posts
April 29, 2013 at 11:17 am 2976
Elitivia Hi there, This is a great plugin, thank you. I can display a list of the most recent tasks for all users, but I'm having trouble showing tasks only assigned to a specific user. Could you please confirm the code that displays this? I have; 'post_type' => 'task', 'meta_key' => '_assigned', 'meta_value' => '3' Thank you in advance, Claire
April 29, 2013 at 11:34 am 2977
Tareq Hasan Tareq Hasan

The query should work.

April 29, 2013 at 11:40 am 2978
Elitivia Elitivia

Hi Tareq,

The full query is $query = new WP_Query( array( ‘numberposts’ => 8, ‘post_type’ => ‘task’, ‘meta_key’ => ‘_assigned’, ‘meta_value’ => ‘3’ ) ); and it doesn’t work. Am I missing something?

Thanks,

Claire

April 29, 2013 at 11:50 am 2980
Tareq Hasan Tareq Hasan
$tasks = new WP_Query( array( 'post_type' => 'task', 'meta_key' => '_assigned', 'meta_value' => '1' ) );
var_dump( $tasks->get_posts() );

Just worked!

April 29, 2013 at 10:46 pm 2994
Elitivia Elitivia

Thank you very much for the quick response. The code you sent didn’t work for me, but the following did;

global $post; $myposts = get_posts('numberposts=50&offset=0&post_type=task&meta_value=3'); foreach($myposts as $post) : setup_postdata($post); ?>
<li><a>ID ); ?>"><?php echo get_the_title( $task->ID ); ?></a></li>
<?php endforeach;
Viewing 4 Posts - 1 through 4 (of 4 total)