Changelog
v0.12a - puNumUnread() was not set if the user had never visited the site before, not sure if it even should as that number could be potentially huge … but it works for now
v0.1a - First version … most likely broken, please report bugs.
Usage
This plugin includes 2 functions, puRead() and puNumUnread(). Neither take any arguments. puNumUnread() echo’s the number of posts that have been written since the last time each user visited your site. The puRead() function returns true if the post is unread and false if the post is read. I chose thise route so you could use it do literally anything you want. For example …
Will make each each title of an unread post bold, assuming they aren’t normally bold, but you get the idea. You can also display an image, or pretty much do anything you want. If you find any bugs or have any feature requests please feel free to contact me or you can post a comment here.
It only seems to work the first time, after it return false. Is there a minimum time between last read and unread post to be able to work?
thx a lot
The only way I thought of to do that was to store a cookie for each post, but that doesn’t seem like a very elegant solution. I am currently working on a decent way to do this. If you have any idea’s please let me know and I will see if I can make it happen :-)
You could keep the post id that has been read and store this in a cookie. Shouldn’t take much space and could be easily updatable. Sorry for the late answer i didn’t receive the mail when i subscribe to this post.
And i have another problem, maybe the time the cookie stay on computer but i didn’t add new post since friday and when i came back at work, all post was written as new but it was all there last time i go to my website at work.
thx a lot for your plugin
That is most likely because your cookies were cleared. The cookies are set to expire after a year.
The only problem with the ID approach is that you don’t have the ID until you have already sent the headers and can no longer send cookies, this is normally where a database comes in but that would be rediculously large. I think what I am going to do is have the plugin run a seperate loop in the header before headers are sent so I can store the cookie. Just had to do some work with additional loops on my asides write-up and its not difficult at all. I start a new job soon but hopefully I will get it done before then :-)
Nice, cause it’s the only plugin like this, and it’s a pretty nice feature. Sorry for the poo suggestion, i didn’t make website for a long time (fully loaded withsome Java and stuffs like that)…
by the way, my mail was set into my problem and i didn’t receive any mail even if i check the box “Subscribe to comments”, am i crazy? :)
The subscribe feature should be working now, although I think you will need to re-subscribe.
ok thx, by the way, good luck for your new job