You mean you want the first X characters or words from a first post?
This is possible. I am playing with this myself so users of my bbPortal plugin can use a read more button on the portal if they want to. It wil count the first 100 words and then ad a read more link.
Think this is something you want (without the read more link). This can be done with a plugin and a new function. I haven’t got something working yet else I would post it here…
try this..
create a plugin with this code..
function your_function_name($where) {
global $topic;
return $where . ' AND topic_id = ' . $topic->topic_id;
}
function get_first_post_of_current_topic() {
add_filter('get_latest_posts_where','your_function_name');
get_latest_posts(1);
}
call get_first_post_of_current_topic in the loop where you show tipc name.
let me know if works.. this is just a hunch
cheers
so1o thanks for the hint, but unfortunately i don’t get any result..
ok..
try this plugin
<?php
function your_function_name($where) {
global $topic;
if ($topic)
return $where . ' AND topic_id = ' . $topic->topic_id;
else
return $where;
}
function get_first_post_of_current_topic() {
global $bb_post;
add_filter('get_latest_posts_where','your_function_name');
$bb_post = get_latest_posts(1);
if(count($bb_post) == 1 ) {
$bb_post = $bb_post[0];
post_text();
}
}
?>
where you want call get_first_post_of_current_topic();
Is there also a way to get a link to the first REPLY in a post? There is a link option to go to the last reply, but i wanta link ti the first reply. So the sec post (if you see them all as posts)
so1o, thanks, that looks better, but it grabs the last post of the topic, not the first one..
..
by declaring $bb_post = $bb_post[0]; i assume $bb_post is an array. now, since i see appearing the last post of a topic i tried to substitute that line with $bb_post = end($bb_post), thinking that maybe the actual first post stayed at the end of the array; i still get the last post though.. any other suggestion?
guys, any other suggestion?
Sorry, phollo, can’t offer any meaningful help here, but I did just want to say that I’m interested in seeing your results.
$first_post = $bbdb->get_results("SELECT * FROM $bbdb->posts WHERE topic_id = $topic->topic_id AND post_position = 1");
That will give you the post OBJECT… from there you can pull out the text like this:
echo $first_post->post_text;
Or since it seems you want to pull out just the first little bit, just use a php string function to make it look and act like you want it to.
It’s not the most eloquent method, but it’s certainly simple.