Home Forums Plugin Support WP User Frontend (Free Version) List of Tasks by Assigned User

This topic is: resolved

This topic contains 4 replies, has 2 voices, and was last updated by  Elitivia 6 years, 1 month ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #2976

    Elitivia
    Participant
    Post count: 4

    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

    #2977

    Tareq Hasan
    Keymaster
    Post count: 2831

    The query should work.

    #2978

    Elitivia
    Participant
    Post count: 4

    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

    #2980

    Tareq Hasan
    Keymaster
    Post count: 2831
    $tasks = new WP_Query( array( 'post_type' => 'task', 'meta_key' => '_assigned', 'meta_value' => '1' ) );
    var_dump( $tasks->get_posts() );
    

    Just worked!

    #2994

    Elitivia
    Participant
    Post count: 4

    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 5 posts - 1 through 5 (of 5 total)

The topic ‘List of Tasks by Assigned User’ is closed to new replies.