inherit
249732
0
Feb 26, 2022 5:48:02 GMT -8
Sam
Typing...
135
October 2017
samzi
|
Post by Sam on May 15, 2018 11:01:08 GMT -8
Hi, Does anyone know of a way to make the Hot Topics plugin by Brian only make it make a topic 'Hot' only when it's managed to make it's post requirement within a certain timeframe?
|
|
#eb7100
33409
0
1
Mar 27, 2024 18:49:16 GMT -8
Brian
48,128
November 2004
smashmaster3
|
Post by Brian on May 15, 2018 11:36:06 GMT -8
Assuming I'm interpreting this correctly the only way I could see this working is if you added a plugin key to the Hot Topics plugin. Then make it record the current timestamp upon submission of the Xth post and compare that to the timestamp of the first post when viewing the thread list.
There are some reliability issues with this, though. There's nothing outside of the thread list that says "this thread has X amount of replies" so it has to rely on whatever value it last saw in the thread or post list. In a (admittedly unlikely) scenario where a user navigates directly to the reply page of a thread without ever going to the thread or post list the reply count will never be seen, so there would be nothing for it to reference and the plugin's code wouldn't be able to properly assess whether or not the next reply would be meeting the reply count.
Setting key data automatically upon page load without user interaction is against the developer guidelines, so it's unfortunately not possible to simply write the timestamp to the plugin key automatically when the required information is next visible.
This is all based entirely on the premise that a thread will only able to achieve "hot" status within X amount of time of being posted and will never lose that status. If you want it to work exactly like it does now and just want to add a time limit for the hot status to expire that's much less complicated and just requires the addition of a single if statement (basically stating if serverTime minus firstPostTime > timeLimit do not change this thread's icon).
|
|
inherit
249732
0
Feb 26, 2022 5:48:02 GMT -8
Sam
Typing...
135
October 2017
samzi
|
Post by Sam on May 15, 2018 11:38:34 GMT -8
Assuming I'm interpreting this correctly the only way I could see this working is if you added a plugin key to the Hot Topics plugin. Then make it record the current timestamp upon submission of the Xth post and compare that to the timestamp of the first post when viewing the thread list. There are some reliability issues with this, though. There's nothing outside of the thread list that says "this thread has X amount of replies" so it has to rely on whatever value it last saw in the thread or post list. In a (admittedly unlikely) scenario where a user navigates directly to the reply page of a thread without ever going to the thread or post list the reply count will never be seen, so there would be nothing for it to reference and the plugin's code wouldn't be able to properly assess whether or not the next reply would be meeting the reply count. Setting key data automatically upon page load without user interaction is against the developer guidelines, so it's unfortunately not possible to simply write the timestamp to the plugin key automatically when the required information is next visible. This is all based entirely on the premise that a thread will only able to achieve "hot" status within X amount of time of being posted and will never lose that status. If you want it to work exactly like it does now and just want to add a time limit for the hot status to expire that's much less complicated and just requires the addition of a single if statement (basically stating if serverTime minus firstPostTime > timeLimit do not change this thread's icon). Well I mean a time limit such as, only being a hot topic if 50 posts have been made in the past 2 days and if no, the it's not a hot topic. Is that how you interpreted it?
|
|
#eb7100
33409
0
1
Mar 27, 2024 18:49:16 GMT -8
Brian
48,128
November 2004
smashmaster3
|
Post by Brian on May 15, 2018 11:40:17 GMT -8
Does it remain a hot topic forever or does it lose that status after 2 days have passed regardless of whether or not it's still active?
|
|
inherit
249732
0
Feb 26, 2022 5:48:02 GMT -8
Sam
Typing...
135
October 2017
samzi
|
Post by Sam on May 15, 2018 11:41:00 GMT -8
Does it remain a hot topic forever or does it lose that status after 2 days have passed regardless of whether or not it's still active? It looses it.
|
|
#eb7100
33409
0
1
Mar 27, 2024 18:49:16 GMT -8
Brian
48,128
November 2004
smashmaster3
|
Post by Brian on May 15, 2018 11:53:01 GMT -8
Then using the if statement method in the Components tab of Plugins > Build > Hot Topics should work.
Find this line:
Add this on a new line after it:
Find these two lines:
And add a closing brace on a new line after them:
|
|
inherit
249732
0
Feb 26, 2022 5:48:02 GMT -8
Sam
Typing...
135
October 2017
samzi
|
Post by Sam on May 15, 2018 11:59:37 GMT -8
Then using the if statement method in the Components tab of Plugins > Build > Hot Topics should work. Find this line: Add this on a new line after it: Find these two lines: And add a closing brace on a new line after them: Wow thank you! How do I change the amount of time?
|
|
#eb7100
33409
0
1
Mar 27, 2024 18:49:16 GMT -8
Brian
48,128
November 2004
smashmaster3
|
Post by Brian on May 15, 2018 12:07:25 GMT -8
The 172800 bit is the time limit. Timestamps are measured in milliseconds, and we've cut off the last three digits from the timestamp produced by pb.data('serverDate') (which are always 000) to match the amount of digits in the timestamp produced by pb.item('thread',id).created_on (which is lacking the last 3 digits).
172800000 milliseconds is 2 days so we cut the last 3 digits off of that, resulting in 172800.
|
|
inherit
249732
0
Feb 26, 2022 5:48:02 GMT -8
Sam
Typing...
135
October 2017
samzi
|
Post by Sam on May 15, 2018 12:10:52 GMT -8
The 172800 bit is the time limit. Timestamps are measured in milliseconds, and we've cut off the last three digits from the timestamp produced by pb.data('serverDate') (which are always 000) to match the amount of digits in the timestamp produced by pb.item('thread',id).created_on (which is lacking the last 3 digits). 172800000 milliseconds is 2 days so we cut the last 3 digits off of that, resulting in 172800. Cool. How would I make this part of the editable interface? And it hasn't made a difference to the hot topics I did try to lower the milliseconds but it didn't make any difference
|
|
#eb7100
33409
0
1
Mar 27, 2024 18:49:16 GMT -8
Brian
48,128
November 2004
smashmaster3
|
Post by Brian on May 15, 2018 12:24:02 GMT -8
By going into the User Interface tab of the plugin's Build page and creating a new field, then creating the appropriate reference within the Javascript and substituting 172800 with it.
You'll notice in one of the earlier lines I quoted that it's comparing against pbp['hot_topics'].count to get the reply count you entered into the plugin. pbp['hot_topics'].count is produced by this line: This is telling it to make the value of pbp['hot_topics'].count match whatever we've specified in the User Interface field with the variable ID reply_count.
So if I wanted to make a new one called pbp['hot_topics'].limit and make it obtain the value of a field with the variable ID time_limit I would add another line after the one that defined the reply count:
Then substitute 172800 with it:
|
|
inherit
249732
0
Feb 26, 2022 5:48:02 GMT -8
Sam
Typing...
135
October 2017
samzi
|
Post by Sam on May 15, 2018 12:29:09 GMT -8
By going into the User Interface tab of the plugin's Build page and creating a new field, then creating the appropriate reference within the Javascript and substituting 172800 with it. You'll notice in one of the earlier lines I quoted that it's comparing against pbp['hot_topics'].count to get the reply count you entered into the plugin. pbp['hot_topics'].count is produced by this line: This is telling it to make the value of pbp['hot_topics'].count match whatever we've specified in the User Interface field with the variable ID reply_count. So if I wanted to make a new one called pbp['hot_topics'].limit and make it obtain the value of a field with the variable ID time_limit I would add another line after the one that defined the reply count: Then substitute 172800 with it: I'm so sorry, I don't understand what you need me to do. Will it fix the problem of it not doing anything? if(pbp == undefined) var pbp = new Object(); if(pbp != null && typeof(pbp) == "object") { pbp.hot_topics = { count: pb.plugin.get('hot_topics').settings.reply_count, image: pb.plugin.get('hot_topics').settings, init: function(){ if($('.item.thread').length){ $('.item.thread').each(function(){ if($(this).find('.thread-participants').length){ if(parseInt($(this).find('.thread-participants').html().replace(/,/g,'')) >= pbp['hot_topics'].count){ var id = $(this).attr('id').split('-')[1]; if(pb.data('serverDate').toString().slice(0,-3) - pb.item('thread',id).created_on > 172800){ var c = { a: $(this).hasClass('announcement'), l: $(this).hasClass('locked'), s: $(this).hasClass('sticky') }; if(!c.a && !c.l && !c.s) $(this).find('.icon').find('img').attr('src',pbp['hot_topics'].image.hot); else if(!c.a && c.l && !c.s) $(this).find('.icon').find('img').attr('src',pbp['hot_topics'].image.locked); else if(!c.a && !c.l && c.s) $(this).find('.icon').find('img').attr('src',pbp['hot_topics'].image.sticky); else if(c.a && !c.l) $(this).find('.icon').find('img').attr('src',pbp['hot_topics'].image.announce); else if(!c.a && c.l && c.s) $(this).find('.icon').find('img').attr('src',pbp['hot_topics'].image.locked_sticky); else if(c.a && c.l) $(this).find('.icon').find('img').attr('src',pbp['hot_topics'].image.locked_announce); } } } }); } } } } if(pbp['hot_topics_s']) pbp['hot_topics'].image = pbp['hot_topics_s'].image; $(document).ready(function(){ pbp['hot_topics'].init(); }); proboards.on('afterSearch',function(){ pbp['hot_topics'].init(); }); $(document).ajaxComplete(function(event,xhr,settings){ if(settings.url.indexOf('/threads/mark/') != -1) pbp['hot_topics'].init(); });
This is what I have
|
|
inherit
249732
0
Feb 26, 2022 5:48:02 GMT -8
Sam
Typing...
135
October 2017
samzi
|
Post by Sam on May 15, 2018 12:44:39 GMT -8
Will talk to you tomorrow
|
|
#eb7100
33409
0
1
Mar 27, 2024 18:49:16 GMT -8
Brian
48,128
November 2004
smashmaster3
|
Post by Brian on May 15, 2018 13:18:09 GMT -8
I think the problem was more that I accidentally typed a greater than symbol instead of a less than symbol.
It should be working now.
|
|
inherit
249732
0
Feb 26, 2022 5:48:02 GMT -8
Sam
Typing...
135
October 2017
samzi
|
Post by Sam on May 15, 2018 23:21:33 GMT -8
I think the problem was more that I accidentally typed a greater than symbol instead of a less than symbol. It should be working now. Now none of the topics are hot even though I set the time for 10 mins and the post level to 1
|
|
#eb7100
33409
0
1
Mar 27, 2024 18:49:16 GMT -8
Brian
48,128
November 2004
smashmaster3
|
Post by Brian on May 16, 2018 7:55:34 GMT -8
The time is still set to 2 days. Setting the time to 10 minutes would mean that once 10 minutes have passed since the thread's creation it would no longer be eligible to become a hot topic.
I'm seeing a couple recently created threads on your forum marked as hot topics. Any threads older than 2 days lose that status. There's one in the Lord of the Rings board and another one in General Discussion, both created on May 14th.
The one in General Discussion is going to lose its hot status about 5 hours after this post, while the one in Lord of the Rings will lose it in 10 hours and 25 minutes.
|
|