News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

??___Just answer this, please___??

Started by gbsothere, August 14, 2009, 06:11:03 PM

Previous topic - Next topic

gbsothere

I don't expect you guys to stop and make this mod, but, after a fruitless search, can anyone here tell me if there's a mod that tells the poster how many new posts have been made on a thread since the last time he or she clicked on it?   This is a feature we all enjoyed on our last forum and we miss it.


Thanks.


My apologies, but I am taking a break from accepting PM requests for support.  If I am not currently assisting you, please do not ask as long as this notice is posted.  Thank you.

I Don't Want To Grow Old Alone


It has been proven that Steely Dan reduces the occurrence of road rage, according to an independent study.



A reminder about admin / ftp passwords etc.

Arantor

No, there isn't a mod for it.

Where would you expect to see it displayed? (Note that doing it is likely to be a fair performance hit)

gbsothere

#2
Quote from: Arantor on August 14, 2009, 09:13:21 PM
No, there isn't a mod for it.

Where would you expect to see it displayed? (Note that doing it is likely to be a fair performance hit)


Thanks for replying, Arantor!   :)

I wonder if in between the Replies and Views columns, a new heading could be added:  "New"?  (Or "Replies" could be made to read "Total Replies" and the new column "New Replies" if that's less confusing.)




It's a mystery to me how the forum "remembers" this sort of thing on behalf of the individual poster, but we always enjoyed seeing how many posts a particular thread received when we next visited it.

I have SMF 1.1.10/Default. 
My apologies, but I am taking a break from accepting PM requests for support.  If I am not currently assisting you, please do not ask as long as this notice is posted.  Thank you.

I Don't Want To Grow Old Alone


It has been proven that Steely Dan reduces the occurrence of road rage, according to an independent study.



A reminder about admin / ftp passwords etc.

Arantor

Sure, you could. It's a modification of MessageIndex.template.php for your theme.

As for how it does it, it remembers the last post id you saw for each thread, so that yes you could in theory work out how many new posts, but the query is likely to be expensive.

gbsothere

Quote from: Arantor on August 14, 2009, 09:33:02 PM
Sure, you could. It's a modification of MessageIndex.template.php for your theme.

As for how it does it, it remembers the last post id you saw for each thread, so that yes you could in theory work out how many new posts, but the query is likely to be expensive.



I see.  I'm not sure how queries work, I'm afraid. 

I have a dedicated server and I suppose the mega-forum we were all part of, at one time, did, as well, but I didn't realize that it was so complicated.  Of course, everything's complicated to me.   :)

Thanks for looking into it, though. 
My apologies, but I am taking a break from accepting PM requests for support.  If I am not currently assisting you, please do not ask as long as this notice is posted.  Thank you.

I Don't Want To Grow Old Alone


It has been proven that Steely Dan reduces the occurrence of road rage, according to an independent study.



A reminder about admin / ftp passwords etc.

gbsothere

If I can just ask, Arantor... are files relating to ones profile involved in this, or just the MessageIndex.template.php?  And must a new table be created on the database?  Is that what you mean by the query?

My apologies, but I am taking a break from accepting PM requests for support.  If I am not currently assisting you, please do not ask as long as this notice is posted.  Thank you.

I Don't Want To Grow Old Alone


It has been proven that Steely Dan reduces the occurrence of road rage, according to an independent study.



A reminder about admin / ftp passwords etc.

Arantor

If you're just changing layout, editing MessageIndex.template.php is all you need to do for that change.

If you're looking to modify SMF to add the functionality you've described, that's going to be edits to MessageIndex.php in Sources/ too, plus database queries to get the information you don't already have. But the additional query needs to do lookups between the messages DB table and the topics DB table. You know the ID of the last post you saw in a given thread. You then have to look up how many messages were created after that.

It's not a new DB table, just a new query against existing tables.

gbsothere

And sadly, way over my head.   :(


Could I just ask, then, that this be considered as a future mod, if you or someone else is willing to take it on?


My apologies, but I am taking a break from accepting PM requests for support.  If I am not currently assisting you, please do not ask as long as this notice is posted.  Thank you.

I Don't Want To Grow Old Alone


It has been proven that Steely Dan reduces the occurrence of road rage, according to an independent study.



A reminder about admin / ftp passwords etc.

Arantor

Sure - though I don't know if/when anyone will get to it.

I will say that right now that off the top of my head, I suspect the additional DB work required to fathom out how many new posts in a thread is going to be expensive and slow the forum down.

gbsothere

Oh, I see what you mean.   

Thanks, though.  :)
My apologies, but I am taking a break from accepting PM requests for support.  If I am not currently assisting you, please do not ask as long as this notice is posted.  Thank you.

I Don't Want To Grow Old Alone


It has been proven that Steely Dan reduces the occurrence of road rage, according to an independent study.



A reminder about admin / ftp passwords etc.

gbsothere

Is this similar to what would be needed on the MessageIndex.template.php or does this only yield results for the entire forum, rather than for a specific thread?


// GET NUMBER OF NEW POSTS
$newposts = $DB_site->query_first("SELECT count(*) AS count FROM " . TABLE_PREFIX . "post WHERE dateline > '$bbuserinfo[lastvisit]'");

// DETERMINE IF "POSTS" IS SINGULAR OR PLURAL
if ($newposts[count] == 1)
{
    $newposts[plural] = "";
}
else
{
    $newposts[plural] = "s";




Also, is this something needed for the message to show up?

<a href="search.php?$session[sessionurl]do=getnew">$newposts[count] new post$newposts[plural]</a>



(And, lastly, should I delete all this and post on the Coding board?)   :-[
My apologies, but I am taking a break from accepting PM requests for support.  If I am not currently assisting you, please do not ask as long as this notice is posted.  Thank you.

I Don't Want To Grow Old Alone


It has been proven that Steely Dan reduces the occurrence of road rage, according to an independent study.



A reminder about admin / ftp passwords etc.

Arantor

Unfortunately the code is nothing like that, and unfortunately not that simple either.

It would be a mod request, because it's not a simple tweak - but unfortunately it's one that is unlikely to get done either here or there :(

gbsothere

Ah.....    back to the book, then.    :)

Or to "RentACoder".   :D


Thanks!
My apologies, but I am taking a break from accepting PM requests for support.  If I am not currently assisting you, please do not ask as long as this notice is posted.  Thank you.

I Don't Want To Grow Old Alone


It has been proven that Steely Dan reduces the occurrence of road rage, according to an independent study.



A reminder about admin / ftp passwords etc.

Arantor

Either, unfortunately.

I still think the DB hit would be prohibitive too, meaning that it'll really hit the site as it grows.

gbsothere

I really should try to learn more about the ins and outs of the database, rather than just being content to glance at it for errors, when I have to.   :(

My head hurts, just thinking about it.  *grin*

Thanks, Arantor! 
My apologies, but I am taking a break from accepting PM requests for support.  If I am not currently assisting you, please do not ask as long as this notice is posted.  Thank you.

I Don't Want To Grow Old Alone


It has been proven that Steely Dan reduces the occurrence of road rage, according to an independent study.



A reminder about admin / ftp passwords etc.

gbsothere

Just wondered if "Help Wanted" is the proper place for this thread, if I wanted to get a quote for someone developing this as a mod (or not even as a mod but to help me achieve it for my forum) or if I should just post the question there and refer back to this thread?

My apologies, but I am taking a break from accepting PM requests for support.  If I am not currently assisting you, please do not ask as long as this notice is posted.  Thank you.

I Don't Want To Grow Old Alone


It has been proven that Steely Dan reduces the occurrence of road rage, according to an independent study.



A reminder about admin / ftp passwords etc.

Arantor

If you want to pay someone to develop it, I can move it to Help Wanted for you, and then you can change the name of the first topic to add '[PAID]' to it.

Long story short, I doubt you'll get this, knowing how SMF's tables are designed it would likely be slightly prohibitive for performance to do (not that that stops shoutbox development...?) but if you want to pay for it I expect someone would be interested in doing it.

gbsothere

I know that I haven't understood before when you've mentioned this being prohibitive for performance, so this is a good time for me to ask... do you mean this site's performance?  Or my site?   (Freshman question, but not being a coder in any sense of the word, it's probably best that I finally understand this.)

:)

My apologies, but I am taking a break from accepting PM requests for support.  If I am not currently assisting you, please do not ask as long as this notice is posted.  Thank you.

I Don't Want To Grow Old Alone


It has been proven that Steely Dan reduces the occurrence of road rage, according to an independent study.



A reminder about admin / ftp passwords etc.

Arantor

No, I mean your site's performance.

Let me explain briefly how the tables are set up.

There is a topics table, and a messages table. The topics table is hit when you browse the topic index, to get the list of topics.  It also gets a list of the number of messages in each of those topics, subject to post approval. It's moderately expensive to do that but not overwhelmingly prohibitive to do so.

This works because you have the topics table containing a unique reference for each topic, and each post refers back to it. In table terms it's a one-to-many relationship; a topic has many messages, a message has one topic.

But you can do that in a single query. You can say: "get me the topics in board 1, and how many messages in each topic". So far so good.

The problem hits when you're looking at how many unread. You introduce the log of what's been read. Now, in order to not track every single post having been read or not, it's tracked at a per-topic level; it stores the id of last post you read in that topic.

Now you'd have to say: "get me the topics in board 1, and how many messages in each topic since I last looked."

Looks simple. But it's not. The reason is the query will end up being something akin to:
Get me all the topics in board 1, and how many posts per topic...
...starting from post 123 in topic 1
...starting from post 456 in topic 2
...starting from post 789 in topic 3
...starting from post 1478 in topic 4
...starting from post 1590 in topic 5
... etc etc

At minimum you'd have to run 2 queries instead of 1, because you have to get the last-read times for each thread you're browsing on a page. Having got the last read data, you would then craft an expression thus in SQL:
SELECT t.id_topic, subject, ...other stuff... COUNT(id_msg)
FROM topics t INNER JOIN messages m USING (id_topic)
WHERE
  (t.id_topic = 1 AND m.id_msg > 123) OR
  (t.id_topic = 2 AND m.id_msg > 456) OR
  ...
GROUP BY t.id_topic

This is never going to be particular efficient because it has to evaluate a monster expression which is computationally expensive.

If you'd like me to explain in more detail please do ask.

gbsothere

No, I see what you're saying and it does sound a bit intensive.  I surf around and check out different boards just to look at their features and I see that the American Idol forum does use this feature but I would imagine that Miles and the rest of the team there developed their own "mod" for achieving this. 

No worries, then.  I'll let it go.  Thanks.

:)
My apologies, but I am taking a break from accepting PM requests for support.  If I am not currently assisting you, please do not ask as long as this notice is posted.  Thank you.

I Don't Want To Grow Old Alone


It has been proven that Steely Dan reduces the occurrence of road rage, according to an independent study.



A reminder about admin / ftp passwords etc.

Arantor

Well, if you mean this forum, that isn't using SMF. Other forums may well store the data differently, meaning that it is possible to track that more efficiently.

gbsothere

It's a different forum, but point taken; I see what you mean. 

Thanks, Arantor.

My apologies, but I am taking a break from accepting PM requests for support.  If I am not currently assisting you, please do not ask as long as this notice is posted.  Thank you.

I Don't Want To Grow Old Alone


It has been proven that Steely Dan reduces the occurrence of road rage, according to an independent study.



A reminder about admin / ftp passwords etc.

Advertisement: