Jump to content


Photo

Unread and Read states for forum topic


  • Please log in to reply
4 replies to this topic

#1 austar

austar
  • Members
  • Pip
  • Newbie
  • 7 posts
  • LocationMT

Posted 14 March 2006 - 02:23 PM

Hi, a friend of mine is creating a forum and asked me if I had any ideas on how to go about making topics appear read and unread... all of my suggestions were flawed, so I was wondering if anyone knows the best way to do this?
Neo-Maxi-Zoom-Dweebie.

#2 shocker-z

shocker-z
  • Members
  • PipPipPip
  • Advanced Member
  • 864 posts
  • LocationNottingham

Posted 14 March 2006 - 02:38 PM

You could simply have a column in the users table which holds the ID of the forum topic so when a user visits the topic it updates the user read column to have all that they have visited as well as the one they just clicked on seperated by a space and then to display read and unread you can explode the column by space and then check it against each topic when showing the main page...

Another way of doing this is by adding each user ID to a column in the topics table and then when listing all the topics you explode all user ID's in the topic table column called visitedby or what ever you want and check to see if the user exists in there, if so then the user has read so display the read message/image instead of unread.

second idea is better because less chance of filling the column.

If that didnt make any sence then just tell me and will do a litle code to show you :)
www: www.ukchat.ws | irc: irc.ukchat.ws chan: #blufudge

#3 austar

austar
  • Members
  • Pip
  • Newbie
  • 7 posts
  • LocationMT

Posted 14 March 2006 - 06:52 PM

That was what I originally suggested, though what happens when a topic has a new reply posted to it? and what about if the forum were heavily viewed - the database would rack up to a very considerable size... which could be a problem. Thanks for all your help.

-austen
Neo-Maxi-Zoom-Dweebie.

#4 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 14 March 2006 - 07:06 PM

[!--quoteo(post=354997:date=Mar 14 2006, 06:52 PM:name=austar)--][div class=\'quotetop\']QUOTE(austar @ Mar 14 2006, 06:52 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
That was what I originally suggested, though what happens when a topic has a new reply posted to it? and what about if the forum were heavily viewed - the database would rack up to a very considerable size... which could be a problem. Thanks for all your help.

-austen
[/quote]

You can del entrys to the database set by date so old posts are deleted or not wanted.

Use this code to auto delete all 'read' messages on the first day of the month.  

$deleteday = '01'; // day of month 
$today = date("M d, Y"); 
$deletedate = date("M $deleteday, Y"); 
if ($deletedate == $today) 
{$sql = "DELETE FROM message WHERE isread = '1'"; mysql_query($sql) or die(mysql_error());} 


Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#5 shocker-z

shocker-z
  • Members
  • PipPipPip
  • Advanced Member
  • 864 posts
  • LocationNottingham

Posted 15 March 2006 - 10:02 AM

i think he means that it will need to now show as read but if the user id is in the topic `read` field then it will still go up.. the simple solution is on reply page make it update the `read` field to just the reply users address.. therefore will show as new again..
www: www.ukchat.ws | irc: irc.ukchat.ws chan: #blufudge




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users