ElkArte Community

Elk Development => Feature Discussion => Exterminated Features => Topic started by: Jorin on September 18, 2014, 09:43:27 am

Title: recent posts in info center
Post by: Jorin on September 18, 2014, 09:43:27 am
Is it possbile to modify ElkArte so there are not recent posts in the info center but recent topics?
Title: Re: recent posts in info center
Post by: Spuds on September 18, 2014, 06:31:02 pm
Sure its possible ...

I believe the reason it shows only teh posts is that is easy to generate.   Recent topics is bit more of a complex task,  taking more db queries and CPU to generate the list.  Thats fine for occasional views, but on your main page it may eat up resources depending on how busy your site is and what server resources you have available. 

Maybe @emanuele has some thoughts on this, we could add it or perhaps a quick addon.
Title: Re: recent posts in info center
Post by: Jorin on September 19, 2014, 03:24:20 am
An addon would be great!
Title: Re: recent posts in info center
Post by: emanuele on September 19, 2014, 04:25:04 am
I frequently feel that the "recent posts" is a bit useless, especially when several replies to the same topic are listed.
Title: Re: recent posts in info center
Post by: Jorin on September 19, 2014, 04:26:50 am
Exactly. Plus: You have a link in info center to the latest posts which makes the recent posts list a bit more useless.  ;)
Title: Re: recent posts in info center
Post by: Lars on September 21, 2014, 02:38:54 pm

I agree with him. I would also prefer the recent topics listing. :)
Title: Re: recent posts in info center
Post by: emanuele on September 22, 2014, 08:36:10 am
Not tested much, it should mostly work.
I know it says "recent posts" and not "recent topics", but I didn't care to add a language file to tweak the string for the moment, maybe later.

In terms of performance it may even be slightly faster if I didn't mess up with EXPLAIN.
screen_289 is the topics query, while screen_290 is the posts query.
At least the filesort in this case is done on 100 rows and not thousands. Am I wrong?

ETA: package removed, latest version is here (http://www.elkarte.net/community/index.php?topic=2033.msg16510#msg16510)
Title: Re: recent posts in info center
Post by: Spuds on September 22, 2014, 09:14:56 am
Makes me think there is something wrong with the current query, but maybe it is also a pig!
Title: Re: recent posts in info center
Post by: emanuele on September 22, 2014, 09:24:24 am
I think it sort of make sense: in the current one it has to check every single message, in the other one it gets only the topics on which I LEFT JOIN'ed the messages table on id_last_msg.

I uploaded the code and the query is here:
https://github.com/emanuele45/RecentTopics/blob/master/RecentTopics.class.php#L62 (basically a copy of getLastPosts LOL)
Title: Re: recent posts in info center
Post by: Spuds on September 22, 2014, 04:16:27 pm
Well more useful and less overhead, seems like that should be the 1.01 default and the current the addon (or just have both in the core)
Title: Re: recent posts in info center
Post by: emanuele on September 25, 2014, 05:21:58 am
I guess adding it to the core is not that difficult, a bit of testing before would be nice, though.

We can save that for 1.0.2 around December. O:-)
Title: Re: recent posts in info center
Post by: emanuele on December 11, 2014, 04:39:44 am
xref: http://www.elkarte.net/community/index.php?topic=1818.0
Title: Re: recent posts in info center
Post by: Spuds on December 11, 2014, 09:32:51 pm
I think we forgot to add this to 1.0.2 ... I don't think it was in github tracker  :'(
Title: Re: recent posts in info center
Post by: Jorin on December 14, 2014, 09:16:55 am
Oh no! My users love to see the recent topics on top of the board not the recent posts at the bottom.  :(
Title: Re: recent posts in info center
Post by: emanuele on December 14, 2014, 11:54:53 am
Well, there is a package over there. :P

Actually the package places the list at the bottom, not at the top...
Title: Re: recent posts in info center
Post by: Jorin on February 03, 2015, 04:48:30 am
Any news on this? Maybe switch to top of index (not bottom) and show the correct header ("recent topics" instead of "recent posts")?  O:-)
Title: Re: recent posts in info center
Post by: inter on February 03, 2015, 08:23:13 am
smf - Recent Topics On Board Index (http://custom.simplemachines.org/mods/index.php?mod=1314)
Title: Re: recent posts in info center
Post by: emanuele on February 03, 2015, 09:39:20 am
No need to go at sm.org, it's here:
http://www.elkarte.net/community/index.php?topic=2033.msg12940#msg12940
and it has been there for quite a few months. ;)
For including it in the default I'm still not sure is fine in a micro release, it requires changes to theme and strings, the fact it would require a new function is not a big problem, but to make it work with any currently existing theme would be a bit tricky.
Title: Re: recent posts in info center
Post by: Spuds on February 07, 2015, 04:31:05 pm
Could always add the functionality such that a custom theme could make use of it for 1.0.3 and save the rest for 1.1?  Just a thought.
Title: Re: recent posts in info center
Post by: Jorin on February 11, 2015, 05:19:49 am
Quote from: emanuele – No need to go at sm.org, it's here:
http://www.elkarte.net/community/index.php?topic=2033.msg12940#msg12940
and it has been there for quite a few months. ;)

Seems to have some problems. It's not actual. I have a new post from today 11.03 o'clock but the recent topic list in info center shows a message from february 9th. Two days ago.

I can remember you discussed the possibility that the recent topics are not the newest topics, but the important ones, right?

Edit: Ah! It shows a link to the newest post in the topic, but topic author and date is from the first post (which started the topic). Hm, can this be changed?

Edit 2: Sorry, I was wrong. It still shows not all last changed topics (because of new posts).  :-X
Title: Re: recent posts in info center
Post by: Jorin on February 19, 2015, 01:16:48 am
Any news on this? The list of recent posts and threads in the header of the board seems to be showing topic starter infos too (instead of last post poster info).  :(
Title: Re: recent posts in info center
Post by: emanuele on February 19, 2015, 08:02:11 am
I've been sick last week, and I'm catching up on what I left around here and there.

Do you have cache enabled?
If it is so, the list of recent topics is cached for about 60 seconds, so it will not change immediately.

ETA: okay, try the one attached.

ETA2: package removed, new one is here (http://www.elkarte.net/community/index.php?topic=2033.msg16510#msg16510)
Title: Re: recent posts in info center
Post by: Jorin on February 22, 2015, 12:05:37 pm
I tried. Interesting...

Now I have the addon installed two times (screenshot "package1"), and I have to integration hooks (screenshot "package2"). But I can't delete the red marked one. Nothing happens if I click on "deinstall". On the board index nothing changed, there are still not the names and dates of the latest posts listed.  :(
Title: Re: recent posts in info center
Post by: emanuele on February 22, 2015, 05:07:14 pm
You are pretty unlucky with addons. :P

A suggestion: do not try to delete anything from that page.

Unfortunately I have to ask you to do a couple of checks in order to understand what the issue is... :(


ETA: I can answer to 2 myself I think:
http://support.elkarte-hilfe.de/sources/subs/RecentTopics.class.php <= 404 not found.
If I'd have to guess, your server has some particular setting that prevents the package manager to copy the files where they should. It would be interesting to understand what the peculiarity is... @Spuds do you have any suggestion on what to check? (Since you know these server oddities much, much better than me... O:-))
Title: Re: recent posts in info center
Post by: Jorin on February 24, 2015, 12:59:57 am
1. I did not uninstall because the package manager didn't show the first addon.  >:(
2. The file is there. It hat 644. I changed all files and folders to 777 now (I have to to avoid problems during updates and addon installations). I uploaded the file from the 1.0.2 package now directly. Is this okay?

Nothing changed with the new class file.

So I uploaded the template file into the default theme folder. Or do I have to install the addon again? If he doesn't copy the files onto the server, maybe the addon is not installed anyway?  :-X

Why do you have a language file with strings for "users online today" in the recent topics package?  :o
Title: Re: recent posts in info center
Post by: Jorin on February 24, 2015, 01:03:37 am
Oh, I can give you full ftp access to play with my webspace, if you want to. Or admin access to my board to investigate further...  8)
Title: Re: recent posts in info center
Post by: emanuele on February 24, 2015, 04:29:03 am
Quote from: Jorin – 1. I did not uninstall because the package manager didn't show the first addon.  >:(
oh... okay, that's odd.
Did you check if the zip file of the old version is there as I suggested in 3.?

Quote from: Jorin – 2. The file is there. It hat 644. I changed all files and folders to 777 now (I have to to avoid problems during updates and addon installations). I uploaded the file from the 1.0.2 package now directly. Is this okay?
If I go to:
http://support.elkarte-hilfe.de/sources/subs/RecentTopics.class.php
I see "Not Found", while if I try with a file I know it shall be there, for example:
http://support.elkarte-hilfe.de/sources/subs/Messages.subs.php
I get "No access...".
So, the "RecentTopics.class.php" doesn't seem to be in the place it should be.
Sorry if the question sounds irritating and maybe disrespecting, but there is something "wrong" with it. ;)

Quote from: Jorin – Or do I have to install the addon again?
In that case yes, uninstall and install is "the way to go", because I added a function to another hook, and that have to be installed.
In 99% of the cases if I give a new zip file then "uninstall and install", if I give just a php file then you can just replace the file.

Quote from: Jorin – If he doesn't copy the files onto the server, maybe the addon is not installed anyway?  :-X
That's something to understand. ;)

Quote from: Jorin – Why do you have a language file with strings for "users online today" in the recent topics package?  :o
Because I'm dumb... :-X
I left the file by mistake when I copied the "users online today" files in order to have a starting point for the new addon. ::)
Just ignore it. ;)

Quote from: Jorin – Oh, I can give you full ftp access to play with my webspace, if you want to. Or admin access to my board to investigate further...  8)
Up to you. :)
I tend to prefer if you (or anyone else with problems) take your time and try to follow the instructions, but I can "jump in" and have a look if you have time problems (not that I have a lot of time, but I can try to find some minutes to have a look).
In that case, probably I'd need ftp access.
Title: Re: recent posts in info center
Post by: Jorin on February 24, 2015, 08:06:00 am
Quote from: emanuele – Did you check if the zip file of the old version is there as I suggested in 3.?

It is there, yes. I have to check if you are using installed.lst as SMF does. Maybe I deleted this list while I "installed" the actual ElkArte version... Installed means I copied all files to the server because the package manager wasn't working.  :-[

I forgot to keep this list and if I remember right, the package manager then doesn't know which addons are installed.  O:-)

Quote from: emanuele – If I go to:
http://support.elkarte-hilfe.de/sources/subs/RecentTopics.class.php
I see "Not Found", while if I try with a file I know it shall be there, for example:
http://support.elkarte-hilfe.de/sources/subs/Messages.subs.php
I get "No access...".
So, the "RecentTopics.class.php" doesn't seem to be in the place it should be.
Sorry if the question sounds irritating and maybe disrespecting, but there is something "wrong" with it. ;)

Yeah, the URL.  :D  Try "http://forum-alternative-antriebe.de/" instead of "http://support.elkarte-hilfe.de/".  ;)

I try to get this addon to work in my car forum, not my support forum. Sorry if this wasn't clear.

Quote from: emanuele – In that case yes, uninstall and install is "the way to go", because I added a function to another hook, and that have to be installed.
In 99% of the cases if I give a new zip file then "uninstall and install", if I give just a php file then you can just replace the file.

Okay.  O:-)

Quote from: emanuele – I tend to prefer if you (or anyone else with problems) take your time and try to follow the instructions, but I can "jump in" and have a look if you have time problems (not that I have a lot of time, but I can try to find some minutes to have a look).
In that case, probably I'd need ftp access.

I will look after this prob later. Stay tuned...  ;)
Title: Re: recent posts in info center
Post by: emanuele on February 24, 2015, 09:23:59 am
You didn't say the forum I just guessed. :P

Okay, so, if I understood correctly this time:
Title: Re: recent posts in info center
Post by: Jorin on February 24, 2015, 09:40:29 am
It seems to work, yes. But the poster name and date isn't correct (it's showing always the first post of the thread, not the last). And I have the feeling it takes more than one minute till new threads are added to the list (if there are new posts in them).

I am not using cache btw. It is deactivated in the admin section.

I will try to successfully deinstall and re-install the mod later.
Title: Re: recent posts in info center
Post by: emanuele on February 24, 2015, 03:48:11 pm
Oook.
I guess I missed the part of the message where you said authors and times were wrong, I'll take a look.
Title: Re: recent posts in info center
Post by: emanuele on February 24, 2015, 05:40:12 pm
@Jorin do not waste time installing the version I posted before, try the one attached here.
That should hopefully solve all the issues you have reported... I hope.
Title: Re: recent posts in info center
Post by: Jorin on February 25, 2015, 12:58:25 am
The date is okay now, hurray!  :D  But the poster name is still the one who started the thread.  :-X
Title: Re: recent posts in info center
Post by: emanuele on February 25, 2015, 04:04:38 am
Darn!
I missed just one "mf"... >:(

Without adding an entire new package (at least for a quick fix, I'll add a new package "later"), try the attached file and sorry for the mess! :-[
Title: Re: recent posts in info center
Post by: Jorin on February 25, 2015, 04:29:09 am
Okay, that's working. Thanks a lot!  :)

Now we only have the problem with the actuality. The newest post in recent topics list is from today 5:06am. When I click on the page with the newest posts (.../index.php?action=recent) there are three more recent posts. There are from 07:23am, 08:43am and 09:46am. Now it's 10:28am.

So there's a 5 hour difference till now.  :o  That is not practical.  :(

Edit: The three posts are from boards guests can not see. Maybe that's a hint? Are the board permissions considered in your addon?

Edit2: Yeah, that seems to be the problem. A user posted a message a few minutes ago in a public board and this post is shown in the recent topics list right away!
Title: Re: recent posts in info center
Post by: emanuele on February 25, 2015, 05:38:10 am
Are you sure you are not ignoring boards?

I see:
QuoteTesla im Krisenmodus? Neu    e-motion    Tesla Model S (2014 - heute)    Heute um 11:33
Hybridbatterie extern laden Neu    R.B.    Toyota Yaris Hybrid (2012 - heute)    Heute um 11:21
that as far as I can tell is in line with the recent page:
QuoteTesla Model S (2014 - heute) / Antw.: Tesla im Krisenmodus?
Aktualität von e-motion - Heute um 11:33

I'm asking because I was tricked by that on another forum once.
Title: Re: recent posts in info center
Post by: Jorin on February 25, 2015, 05:43:11 am
Yes, I am not ignoring boards.  ;)

The posts you listed are all in boards guests can see. The missing posts are all in boards guests can not see. So for guests the two lists look the same, but for members they do not.

Do you need a temporal admin account to check (which sees all boards)? I can create one, no problem.
Title: Re: recent posts in info center
Post by: emanuele on February 25, 2015, 06:01:32 am
Try the one attached.
Title: Re: recent posts in info center
Post by: Jorin on February 25, 2015, 06:07:05 am
Great! Looks good now! Thank you very much!  :)

Now I only have to edit the template...  O:-)
Title: Re: recent posts in info center
Post by: emanuele on February 25, 2015, 07:15:52 am
hmm...okay, it somehow makes sense I guess.

Well, glad it worked, now I have to push the changes to the package. :D
Title: Re: recent posts in info center
Post by: Spuds on March 01, 2015, 08:33:21 pm
I remember the dates etc were messed up in SSI which I think I fixed in 1.03 ... does that have anything to do with this at all?
Title: Re: recent posts in info center
Post by: emanuele on March 02, 2015, 02:59:39 am
Nope, I rewrote the queries entirely with the idea in mind of making it "core" and... well, I wrote a bug! :P
Title: Re: recent posts in info center
Post by: Spuds on March 02, 2015, 02:50:31 pm
Ah good, I'm off in the weeds again :D  Is this something for 1.03 then?
Title: Re: recent posts in info center
Post by: emanuele on March 03, 2015, 05:41:07 am
Dunno...
I have to check again the "impact".
Title: Re: recent posts in info center
Post by: Spuds on June 03, 2015, 01:51:32 pm
QuoteI have to check again the "impact".
Small bump since we now have this listed for 1.0.4  O:-)
Title: Re: recent posts in info center
Post by: emanuele on June 09, 2015, 07:57:52 am
I forgot about this again.
My main concern is that it should not replace entirely the current way (because Elk started like that and there may be people using it and liking it).
So what I would do, at least for 1.1, is add it extending the core like it was an addon, maybe duplicating the current template as well.
Title: Re: recent posts in info center
Post by: Spuds on June 09, 2015, 05:13:24 pm
Fine by me ... we should update the milestone in the tracker to 1.1 then?  .. I think this one is tracked
Title: Re: recent posts in info center
Post by: Burke Knight on June 28, 2015, 04:13:38 pm
How about making it an option in Current Theme?
Check the box to show Recent Topics instead of Recent Posts?
Title: Re: recent posts in info center
Post by: ahrasis on July 11, 2015, 07:00:33 am
I just realized this is the support topic for the addon. :)
Title: Re: recent posts in info center
Post by: Flavio93Zena on July 11, 2015, 05:48:47 pm
Quote from: Burke Knight – How about making it an option in Current Theme?
Check the box to show Recent Topics instead of Recent Posts?
Or even better... Both, or none, with selectable order (Posts before, Topics after and viceversa).
Title: Re: recent posts in info center
Post by: niloc on June 18, 2016, 05:32:27 am
I've been trying very hard to "fix" a problem but I can't seem to find the solution...

Problem: Regardless if I choose Recent Topics or Recent Posts in the "Current Theme" setting, it will ONLY show Recent Posts.

I'm using Beta 1.1 btw...

And should this be a new topic or?
Title: Re: recent posts in info center
Post by: emanuele on June 18, 2016, 05:47:50 am
hmm...
Technically this topic should be moved to exterminated and a new one opened in bug reports, but let's keep it here for now.
Title: Re: recent posts in info center
Post by: niloc on June 18, 2016, 05:51:45 am
Alright.

I tried clearing my forum cache as well (thought it might be the reason why it's not working...)

But nope, still not working. It only shows "Recent Posts" regardless.