Forum Moderators: coopster

Message Too Old, No Replies

Problems figuring out how to make forum check if posts are read.

         

Gero_Master

6:51 am on Feb 1, 2006 (gmt 0)

10+ Year Member



Hello!

I'm planning to make my own hosting system for custom built blog/forum software. I have everything planned out, except that how do i make my forum check if registered member has read posts or not.

I figured out one way, but it would take awful lot of resources and would definately be not usable for mass blog host.

Does anyone know some tutorial or anything like that to help me?

I didn't find anything in Google. Only some Vbulletin and IPB bug fixes and mods.

Tomi

jatar_k

1:55 am on Feb 2, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



you could start by using posts since last login

Gero_Master

11:08 am on Feb 2, 2006 (gmt 0)

10+ Year Member



THat's true, but there is one vulnerability in that method: If members session times out (or any other event leading to logout) before he has read all posts, all unread posts will be marked as read.

And if member doesn't log out after he/she has read a message, the message will still be marked as unread.

tomda

11:19 am on Feb 2, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I figured out one way

I guess your way is to use an array(post, post, post) in the user database?

Agree with Jatar, posts since last login is the simplest and easiest way to proceed. Although this method do not show the read/unread messages but messages created before/after the lastlogin date.

And if member doesn't log out after he/she has read a message, the message will still be marked as unread.

Can't you use the unload() javascript event handler to update the last-login when user close the window.

My2cents.

Gero_Master

12:48 pm on Feb 2, 2006 (gmt 0)

10+ Year Member



It's possbile, but your array gave me a nice idea...

I thought that if I would add a field of persons who have read the masseage. In that DB field, there would be the member ID's seperated with comma.

But if I do that, i would have to figure out a way to save the string in database and do that comma seperation.

Sure will be glad if it works out :)

tomda

1:05 pm on Feb 2, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I think you better add a field to the user database (e.g. called read_post) than adding a field to your post_database.

Give it a try, comma-list and array are not so difficult.
Look for implode() and explode() php functions

Gero_Master

1:31 pm on Feb 2, 2006 (gmt 0)

10+ Year Member



How would I go with the checking of the read posts then? I mean it could take lots of server resources to check all individual posts in the database and match them with the read_post data.

BlackDex

1:47 pm on Feb 2, 2006 (gmt 0)

10+ Year Member



Don't know if this will be usefull to you, but you could check how phpBB does this.

I tryed to figure this out as well, but i never realy started to figure it out myself.

Moosetick

2:47 pm on Feb 2, 2006 (gmt 0)

10+ Year Member



Rather than labeling posts as read/unread it would be a lot easier to just label them as "new since last logged in".

As others have said, you would have to somehow keep a list of every post each person has read.

The most efficient way would be to create a table listing your user and listing all the posts they have read. You may want to number each post. The table could have two colums listing each category and post#. When the user goes to a category you can pull in the list and use that to mark read/unread. Until the user reads 10000+ posts in a category it likely won't strain the server. If you get to that point you could then have it only pull posts that are less than x days old. If you have a lot of users and a lot of posts this is how I would go.

tomda

6:17 am on Feb 3, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yeah, just create a simple "link table".

USER_ID / POST_ID
10 / 2500
10 / 550
5 / 550

This will definitely use less resources than an array of read/unread messages and it will falicitate the all task...