Skip to:

Re: Getting forum page number



@_ck_ – The reason is, I have some breadcrumb links in the header of my edit_post.php file. It displays something like this:

The Volturi’s Castle Forum » Forum Games » Count to 10,000 » Edit Post

I have the topic link pointing to the exact position of the post being edited, and I want the forum link to point to the exact page of the topic as well. The code I have is this:

$forum_id = $bbdb->get_var("SELECT forum_id FROM $bbdb->posts WHERE post_id=" . get_post_id() . " LIMIT 1");
$forum_name = get_forum_name($forum_id);
/*$topic_array = $bbdb->get_var("SELECT topic_id FROM $bbdb->topics WHERE forum_id=" . $forum_id . " ORDER BY topic_time ASC");
while ($topic_id = current($topic_array))
if ($topic_id == get_topic_id())
$topic_index = key($topic_array);
$forum_page = get_page_number($topic_index);*/
$forum_link = '<a href="' . get_forum_link($forum_id, $forum_page) . '">' . $forum_name . '</a>';
<a href="<?php bb_option('uri'); ?>"><?php bb_option('name'); ?></a> &raquo; <?php echo $forum_link; ?> &raquo; <a href="<?php post_link(); ?>"><?php topic_title(); ?></a> &raquo; <?php _e('Edit Post','rag'); ?>

The commented stuff is what’s giving me trouble. When executed, it issues an error saying that $topic_array isn’t an object or array. I inserted an echo $topic_array;, and it spit out 3. The topic_id is 13, the forum_id is 6, and no matter what post I edit, the same number is echoed, so I have no idea where it’s getting 3.

Skip to toolbar