Info
- 3 posts
- 2 voices
- Started 1 year ago by helgetry
- Latest reply from helgetry
- This topic is not resolved
Write last post of user
-
- Posted 1 year ago #
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(); } } -
- Posted 1 year ago #
What happens when you use this?
-
- Posted 1 year ago #
I get just the template (post.php) without data in it.
-
You must log in to post.