before migrate to xoops.2.5.5 I recommend first test newbb 4.3 in your test website. you should have a test local website.
kwaltman wrote me in the pm:
Quote:
Couple of things I have hacked in the Forum is:
1) Just to last post
1A) Click on the New Post Indication Icon will take you to the first unread post
1B) Clicking on Topic title will take you to the first unread post.
I see your hack and can see you have to find the read post for each topic
before enter into that topic. but my code is far better because:
1- you will go to the last read post
after click on the topic link
2- you have much simple links
like this:
http://site.com/modules/newbb/viewtopic.php?topic_id=534
instead of this:
http://site.com/modules/newbb/viewtopic.php?post_id=58607&topic_id=534#forumpost58607
or this:
http://site.com/modules/newbb/viewtopic.php?post_id=58607&topic_id=534
3- your hack needs a lot of change in files but my hack just change the target file viewtopic.php
4- your hack needs many more queries and will increase the memory/cpu usage
I also think it is better to dont redirect when the (last read post == last topic post)
so you can change the hack like this.
// START irmtfan - jump to last post read
if (empty($post_id) && !empty($xoopsModuleConfig['jump_to_topic_last_post_read_enabled'])) {
$topic_last_post_id_read = newbb_getRead("topic", $topic_id);
if (!empty($topic_last_post_id_read) && $topic_last_post_id_read!=$topic_obj->getVar("topic_last_post_id"))
header("Location: ".$_SERVER['REQUEST_URI']."&post_id=".$topic_last_post_id_read);
}
// END irmtfan - jump to last post read
Also maybe you think the redirect is not necessary here.
generally we can set $post_id = $topic_last_post_id_read and follow without a redirect but it may cause some issues for example when the post is moved.
so you have to get the topic object from the post_id again like this:
// START irmtfan - jump to last post read
if (empty($post_id) && !empty($xoopsModuleConfig['jump_to_topic_last_post_read_enabled'])) {
$topic_last_post_id_read = newbb_getRead("topic", $topic_id);
if (!empty($topic_last_post_id_read) && $topic_last_post_id_read!=$topic_obj->getVar("topic_last_post_id")) {
$post_id = $topic_last_post_id_read;
$topic_obj = $topic_handler->getByPost($post_id);
$topic_id = $topic_obj->getVar("topic_id");
}
}
// END irmtfan - jump to last post read
the above will work without a redirect. but I personally prefer to redirect the page to have the post id in the URL.
Anybody have comments about that?