Write last post of user
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);
- You must be logged in to reply to this topic.