ElkArte Community

Elk Development => Theme development => Topic started by: Jorin on July 02, 2015, 02:49:52 am

Title: Numbers of new posts inside a board
Post by: Jorin on July 02, 2015, 02:49:52 am
You use these fascinating numbers for likes, new messages and new mentions (see screenshot 1). I really love them!  :)

Question is: Is it possible to use such a system in the forum or board indexes, when new posts inside boards are published?

I think it would look awesome. It would be very easy to catch too. I made a second screenshot what it could look like.  O:-)

Plus I could use fontawesome icons from here (http://www.elkarte.net/community/index.php?topic=966.0) (to show which boards are for what topics: announcements with an "!"-icon, FAQs with an "?"-icon, etc.) without worrying about how they must change their color when new posts are made inside the boards. The icons could show the number of the new posts, that would be all. Easy!

Is there any chance to get this to work?  O:-)
Title: Re: Numbers of new posts inside a board
Post by: emanuele on July 02, 2015, 05:39:52 pm
That would be an interesting option. Unfortunately (you guessed it was coming, right? :P), I'm quite sure the number of unread topics for each member in each board is not tracked anywhere, so in order to display it it would require... at the moment I don't know, I should try. lol
Title: Re: Numbers of new posts inside a board
Post by: Flavio93Zena on July 02, 2015, 07:47:29 pm
More db changes, mainly.
Title: Re: Numbers of new posts inside a board
Post by: Burke Knight on July 02, 2015, 07:50:43 pm
Would need to make sure it would not be too much of a load on server resources, too.
Title: Re: Numbers of new posts inside a board
Post by: Jorin on July 03, 2015, 01:07:04 am
Hm, does this need much more ressources than we use for counting the new posts when a user is looking at the list of new posts or new answers? We do count new mentions and messages, is this much less work for the server? Have no idea about these things.  :-[

It would be so great to show a number of new posts per board in the index. Think about the possibilities: A user knows which board is used more frequently then the other boards. He knows where to find a lot of new threads or posts and can visit this board first, because it seems the most interesting one. A lot of improvements in my opinion.

I would give it a try if it is not too much work to get a test board live.
Title: Re: Numbers of new posts inside a board
Post by: scripple on July 03, 2015, 01:12:16 am
At least this would hopefully fix the current state of not even correctly listing which boards have new posts.
Title: Re: Numbers of new posts inside a board
Post by: Flavio93Zena on July 03, 2015, 02:31:07 am
I had posted a mod link about the issue mentioned by scripple... Besides I think it'd be quite a nasty load for the server to implement such a thing, but of course emanuele knows better ;)
Title: Re: Numbers of new posts inside a board
Post by: Spuds on July 03, 2015, 09:05:10 am
Nice idea ! 

Be interesting to see how much of an impact the query(s) would have, 
Title: Re: Numbers of new posts inside a board
Post by: Burke Knight on July 03, 2015, 09:25:56 am
Quote from: Flavio93Zena – I had posted a mod link about the issue mentioned by scripple...


Um, where???
Title: Re: Numbers of new posts inside a board
Post by: Flavio93Zena on July 03, 2015, 09:50:25 am
Quote from: Burke Knight –
Quote from: Flavio93Zena – I had posted a mod link about the issue mentioned by scripple...
Um, where???
http://www.elkarte.net/community/index.php?topic=2653.msg18204#msg18204 I might have been wrong though, since nobody replied, lol.
Title: Re: Numbers of new posts inside a board
Post by: Burke Knight on July 03, 2015, 10:03:25 am
@Flavio93Zena

That of course, is for SMF...
This is ElkArte, so it would need to be ported over, if the license allows it. ;)

By the looks of it, porting should be okay: http://creativecommons.org/licenses/by/3.0/
Title: Re: Numbers of new posts inside a board
Post by: Flavio93Zena on July 03, 2015, 12:09:55 pm
Yeah but the coding shouldn't be much different :)
Title: Re: Numbers of new posts inside a board
Post by: Joshua Dickerson on July 04, 2015, 12:55:29 am
I see it as needing a modified version of https://github.com/elkarte/Elkarte/blob/development/sources/subs/Unread.class.php#L258 with COUNT(*) instead of all of the other stuff and a GROUP BY id_board. That is a lot of query for the boardindex.

It would be cool though.

One question: is that posts or topics?

Pretty much something along these lines:
Code: [Select]
		$request = $this->_db->query('substring', '
SELECT
COUNT(*)
FROM {db_prefix}messages AS ms
INNER JOIN {db_prefix}topics AS t ON (t.id_topic = ms.id_topic AND t.id_first_msg = ms.id_msg)
INNER JOIN {db_prefix}messages AS ml ON (ml.id_msg = t.id_last_msg)' . ($join == 'topics' ? '
LEFT JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board)' : '
LEFT JOIN {db_prefix}boards AS b ON (b.id_board = ms.id_board)') . '
LEFT JOIN {db_prefix}members AS mems ON (mems.id_member = ms.id_member)
LEFT JOIN {db_prefix}members AS meml ON (meml.id_member = ml.id_member)' . ($this->_have_temp_table ? '
LEFT JOIN {db_prefix}log_topics_unread AS lt ON (lt.id_topic = t.id_topic)' : '
LEFT JOIN {db_prefix}log_topics AS lt ON (lt.id_topic = t.id_topic AND lt.id_member = {int:current_member})') . (!empty($custom_joins) ? implode("\n\t\t\t\t", $custom_joins) : '') . '
LEFT JOIN {db_prefix}log_mark_read AS lmr ON (lmr.id_board = t.id_board AND lmr.id_member = {int:current_member})
WHERE t.id_board IN ({array_int:boards})
AND t.id_last_msg >= {int:min_message}
AND IFNULL(lt.id_msg, IFNULL(lmr.id_msg, 0)) < ml.id_msg' .
($this->_post_mod ? ' AND ms.approved = {int:is_approved}' : '') .
($this->_unwatch ? ' AND IFNULL(lt.unwatched, 0) != 1' : '') . '
GROUP BY t.id_board
array_merge($this->_query_parameters, array(
'current_member' => $this->_user_id,
'min_message' => $this->_min_message,
'is_approved' => 1,
))
);