1
kwaltman
Newbb 4.3 jump to last read post
  • 2012/9/27 18:21

  • kwaltman

  • Just popping in

  • Posts: 17

  • Since: 2006/4/19


I have an older 2.3 Xoops site running CBB 3.07 which is pretty hacked. Would really like to update to the lastest Xoops core, but want to make sure if I migrate to NewBB 4.3 in the process that I wont totally loose some of the functionality that was in my hacked CBB 3.07.

The most important hack I have in place is that it remembers where a user was in in a particular topic. So if new posts have been added to particular topic since that User last read it, and the User goes back and clicks on that topic from the forum topic list, he is taken to the directly to the point in the thread where the oldest unread post starts. I believe for every Topic, it stores a marker in the DB per user where they left off at.

Is that feature/behavior already part of NewBB 4.3?

2
Anonymous
Re: Newbb 4.3 jump to last read post
  • 2012/9/27 20:36

  • Anonymous

  • Posts: 0

  • Since:


This feature is not part of the 4.3 version as I know it (I use an earlier version), but sounds like a nice new feature.

3
irmtfan
Re: Newbb 4.3 jump to last read post
  • 2012/9/29 8:49

  • irmtfan

  • Module Developer

  • Posts: 3419

  • Since: 2003/12/7


Hi kwaltman.
This feature is nice and can be easily added to newbb 4.3 because the base functions for doing it is already exist in newbb43/include/functions.session.php.
that function can get/set any kind of session from/for users.

I can add that feature to the "irmtfan" experimental branch but if you send me your hacked version it will be easier for me.

Also i will be glad to see your other hacks.


4
irmtfan
Re: Newbb 4.3 jump to last read post
  • 2012/9/30 4:38

  • irmtfan

  • Module Developer

  • Posts: 3419

  • Since: 2003/12/7


Ok it was easier than i expected.
fortunately, the last developer of newbb (the great phppp) put some functionality in newbb reserve for future using.
to enable jump to last read post in newbb 4.3 or any other newbb versions do this.

open viewtopic.php around line 100 find this:
newbb_setRead("topic"$topic_id$topic_obj->getVar("topic_last_post_id"));


and add this above it:
// 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$xoopsUser->getVar('uid'));
    if (!empty(
$topic_last_post_id_read))
        
header("Location: ".$_SERVER['REQUEST_URI']."&post_id=".$topic_last_post_id_read);
}
// END irmtfan - jump to last post read

newbb_setRead("topic"$topic_id$topic_obj->getVar("topic_last_post_id"));

EDIT:
You can add that code just above newbb_setRead but it is better to add that above newbb_setRead right after the last redirect_header.

to avoid hardcode i add a configuration so after the above open include/plugin.php and add this:

$customConfig["jump_to_topic_last_post_read_enabled"] = true;



you can change the header to what you prefer like the below:
header("Location: ".XOOPS_URL."/modules/".$xoopsModule->getVar("dirname")."/viewtopic.php?post_id=".$topic_last_post_id_read);


but i think the REQUEST_URI would be best one.

kwaltman, i think the above is the final solution but if you send me your 3.07 hack or show us your website we will see what is the exact hack in your website and also we can see your other hacks on newbb.

Also we need more testers for newbb 4.3
currently i solved many bugs that even remained unsolved for 8 years from 3.08 and earlier newbb versions.
with more testers we can find more bugs.
follow here:
https://xoops.org/modules/newbb/viewtopic.php?post_id=349548

5
irmtfan
Re: Newbb 4.3 jump to last read post
  • 2012/9/30 7:45

  • irmtfan

  • Module Developer

  • Posts: 3419

  • Since: 2003/12/7


a bug in my code.
please remove the uid and it will get it inside the function.
// 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))
        
header("Location: ".$_SERVER['REQUEST_URI']."&post_id=".$topic_last_post_id_read);
}
// END irmtfan - jump to last post read

newbb_setRead("topic"$topic_id$topic_obj->getVar("topic_last_post_id"));


IMO the above have no bugs.

6
kwaltman
Re: Newbb 4.3 jump to last read post
  • 2012/9/30 17:37

  • kwaltman

  • Just popping in

  • Posts: 17

  • Since: 2006/4/19


Thanks a lot for this! As soon as I get my site migrated, I will get 4.3 installed, and these changes made.

Regards

7
irmtfan
Re: Newbb 4.3 jump to last read post
  • 2012/10/1 8:03

  • irmtfan

  • Module Developer

  • Posts: 3419

  • Since: 2003/12/7


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?

8
kwaltman
Re: Newbb 4.3 jump to last read post
  • 2012/10/4 20:44

  • kwaltman

  • Just popping in

  • Posts: 17

  • Since: 2006/4/19


Will Newbb 4.3 work with Xoops 2.3?

Also curious have there been any changes to the upload mechanism since CBB 3.07? Many of my users post pictures to my forum pages, and want to be able to "Multi-Select" several pictures at once and them upload them together. Instead of having to attach each picture one at a time. So was just curious if anything like this has been added.

Also any plans to add Tapatalk integration? Would be great for mobile users.




9
irmtfan
Re: Newbb 4.3 jump to last read post
  • 2012/10/6 5:09

  • irmtfan

  • Module Developer

  • Posts: 3419

  • Since: 2003/12/7


Quote:

Will Newbb 4.3 work with Xoops 2.3?

No. the minimum version is xoops 2.5.x but 2.5.5 is recommended.
Anyway I dont test newbb 4.3 in any other version than 2.5.5

Quote:

want to be able to "Multi-Select" several pictures at once

newbb 4.3 upload system is not change but there are some enhancements and new functionality.
but there is not a "multi-select" feature. it seems it is another hack in your site?
i will take a look to add this feature too.

Quote:

Also any plans to add Tapatalk integration? Would be great for mobile users.


currently im very busy with my works. Also in my free times i prefer to debug newbb 4.3 because it is more important than adding new features.
Almost 80% of these bugs are remained from newbb 2 and cbb3.

but i will take a look when i have more free times.

10
Mamba
Re: Newbb 4.3 jump to last read post
  • 2012/10/6 5:24

  • Mamba

  • Moderator

  • Posts: 11377

  • Since: 2004/4/23


Quote:
Also in my free times i prefer to debug newbb 4.3 because it is more important than adding new features.

Irmtfan, I really appreciate your focus on making NewBB 4.3 bug-free! We need more people like you who could take a module and contribute to it to make it bug free!

Once again: THANK YOU!
Support XOOPS => DONATE
Use 2.5.10 | Docs | Modules | Bugs

Login

Who's Online

190 user(s) are online (154 user(s) are browsing Support Forums)


Members: 0


Guests: 190


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Jun 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits