Skip to:
Content
Pages
Categories
Search
Top
Bottom

Write last post of user


  • H
    Participant

    @helgetry

    I am working on an ajax function, and currently I write a plugin which gives the last post of the logged-in user.

    The post should be displayed using the post.php template of the current theme.

    I try to get the last post from the DB as an object, and give it to the bb_post_template() function, like written below, but that doesn’t work.

    What should I do?

    I have $user = 2 as an example.

    $lastpost = $bbdb->get_results("SELECT * FROM bbpress_posts WHERE poster_id = ".$user." ORDER BY post_time desc LIMIT 0, 1");

    foreach ($lastpost as $bb_post)
    {
    $id = $bb_post->post_id;
    $post = bb_get_post($id);
    if($post)
    {
    bb_post_template();
    }
    }

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Skip to toolbar