News:

Wondering if this will always be free?  See why free is better.

Main Menu

Popular Topics

Started by Diego Andrés, July 15, 2015, 07:49:45 PM

Previous topic - Next topic

Diego Andrés

Link to Mod




Popular Topics

Developed by Diego Andrés




Introduction
Popular Topics mod will add a rating bar of "popularity" for each topic based on views/replies. Each of them will have a weighing of percentage for a total of 100%. Replies/Views of each topic will be compared with the most replied/viewed topic from your forum stats to get the popularity of each topic.




Features

  • Enable/disable bar
  • Set the weighing (percentage) that will have the views
  • Set the weighing (percentage) that will have the replies

*This mod requires at least PHP 5.3




Special thanks to Suki.




Changelog




License
This Source Code Form is subject to the terms of the Mozilla Public License, v. 1.1.
If a copy of the MPL was not distributed with this file,
You can obtain one at http://mozilla.org/MPL/

The contents of this package are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this package except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
*
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.

SMF Tricks - Free & Premium Responsive Themes for SMF.

OCJ

It installed ok, and on my custom theme (no errors shown) but I couldn't see the rating bar on the custom theme. It does work when I switch to default curve but not on the  'Redsey' theme (popular new theme).
Uninstalling and reinstalling didn't help.

I know you might consider it  as not being a problem of the mod but its worth testing  maybe on some custom themes - especially popular new ones and the top rated older ones.

Andy

PS
I thought as much... just checked, Redsey is your theme! Or at least, on your website link  :P

Diego Andrés

You would need to do the manual changes on Redsy (MessageIndex.template.php)
And when you create a mod, you just make sure it works with the default theme, so I can't really do too much there.

Anyway, if you have problems while making the manual changes to Redsy, just attach the file and I'll do it for you.

SMF Tricks - Free & Premium Responsive Themes for SMF.

OCJ

Thanks for the quick reply. I can manage the edits if  the code in the file is similar to curve and easy to locate and edit.

The package manager does alter some custom them files so people will assume it will work. Maybe its a good idea to say on the mod download page that extra manual edits are needed.
Andy

Diego Andrés

There's no need of that. On installing there's another title saying "Install in other Themes", there you can check other themes to install the mod.

SMF Tricks - Free & Premium Responsive Themes for SMF.

OCJ

Yes I did that (checkbox for Redsy theme), but it failed to work.

onepiece

Don't you think 2 additional heavy queries (the number is 4 for forums with more than 100000 posts) querying mostly unused data for each topic on message index is too much? For instance, if the mod was installed on this forum, we would have 100 additional queries on every message index here.

You should probably use a single query using topics table (only to join the boards table maybe, if you care about popularity values to be relative to what users can see) and only fetch the highest values using MAX() on num_views and num_replies columns. Doing this once per page should be enough, as the highest values would be the same for all the topics listed. Some kind of caching would help a lot too.

Diego Andrés

Quote from: onepiece on July 26, 2015, 05:46:55 PM
Don't you think 2 additional heavy queries (the number is 4 for forums with more than 100000 posts) querying mostly unused data for each topic on message index is too much? For instance, if the mod was installed on this forum, we would have 100 additional queries on every message index here.

You should probably use a single query using topics table (only to join the boards table maybe, if you care about popularity values to be relative to what users can see) and only fetch the highest values using MAX() on num_views and num_replies columns. Doing this once per page should be enough, as the highest values would be the same for all the topics listed. Some kind of caching would help a lot too.

Thank you, I'm already aware of this and I'm working on a new version.

SMF Tricks - Free & Premium Responsive Themes for SMF.

Diego Andrés

New version 1.1, please update ASAP
Quote1.1 - 27 July 2015
Big performance improvements.

Thanks to @onepiece for the suggestions




Please report any issues.

SMF Tricks - Free & Premium Responsive Themes for SMF.

iain sherriff

HI
This installed OK showing no errors (including on the Redsy theme) but straight away went to an error page
Parse error: syntax error, unexpected T_STATIC in /home3/f1162343/public_html/dsdglobalsupport.com/Sources/Ohara.php on line 67

/**
* Installs the hooks to be used by this module.
*/
public function installHooks()
{
foreach ($this->hooks as $hook => $method)
add_integration_function($hook, static::$className . '::handleHook', $this->persistHooks);  ****Line 67***
}

public function getHooks()
{
return isset(self::$instance->hooks) ? self::$instance->hooks : false;
}


I have addedd this ****Line 67*** to indicate line 67 for you. Can you see what is wrong ?

Thanks
SMF 2.0.12

margarett

What is your PHP version? I guess you should require 5.3+ for this MOD as it uses Suki's Ohara class...
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

iain sherriff

Thanks for the quick response :)

5.4.25

and I have checked that the installer did mod the Redsy theme code?
SMF 2.0.12

margarett

If you chose it to install in Redsy too then yes, it will modify the theme.

Since you're on 5.4+ I don't have any more ideas so you need to wait for Diego ;)
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

iain sherriff

#13
oh shoot.......................just remembered that that forum is not on my server so it may not be 5.3+  ::)


EDIT :  You were correct. Wrong PHP..........all ok now I have removed mod  :(
SMF 2.0.12

keyboard

Sorry for the question but I am struggling with the concept.  The default settings are 70 and 30.....  what do these actually mean ?

Thanks
Ron
Слaва
Украинi

Diego Andrés

It means the percentage for each one.
E.g if you set 45% to views, the most viewed topic of your forum will have that percentage (45%), and the other 55% would be on replies, which means the same, the most replied topic will have the entire 55% of replies.

Basically you are deciding which one (replies or views) will have more weighing in the 100% bar. Hope it makes sense.

Regards.

SMF Tricks - Free & Premium Responsive Themes for SMF.

aegersz

Hi, i am getting many errors with this mod as it is not working.

i have heaps of mods on - can you think of any that would conflict ?

Apply Filter: Only show the error messages of this URLhttp://192.168.0.180/index.php?action=admin;area=packages;sa=install2;package=PopularTopics_1.1.zip;pid=0Apply Filter: Only show the errors with the same message2: gzclose() expects parameter 1 to be resource, boolean givenApply Filter: Only show the errors from this file File: /var/www/html/Sources/Subs-Package.php
Line: 2839

Apply Filter: Only show the error messages of this URLhttp://192.168.0.180/index.php?action=admin;area=packages;sa=install2;package=PopularTopics_1.1.zip;pid=0Apply Filter: Only show the errors with the same message2: gzwrite() expects parameter 1 to be resource, boolean givenApply Filter: Only show the errors from this file File: /var/www/html/Sources/Subs-Package.php
Line: 2838

etc. etc.
The configuration of my Linux VPS (SMF 2.0 with 160+ mods & some assorted manual tweaks) can be found here and notes on my mods can be found here (warning: those links will take you to a drug related forum). My (House) music DJ dedication page is here

aegersz

i fixed that by chmod 777 /var/www/html/Packages/backups but this mod is just not doing anything despite me enabling it.

thoughts, please ?
The configuration of my Linux VPS (SMF 2.0 with 160+ mods & some assorted manual tweaks) can be found here and notes on my mods can be found here (warning: those links will take you to a drug related forum). My (House) music DJ dedication page is here

Shambles

Does it work in your default theme, and is your php version at least 5.3 ?

aegersz

yes, i only run the default theme.

php is 5.3.3-46.el6_7.1

let me try again. nope. the topics on any board don't show any such graphics.
The configuration of my Linux VPS (SMF 2.0 with 160+ mods & some assorted manual tweaks) can be found here and notes on my mods can be found here (warning: those links will take you to a drug related forum). My (House) music DJ dedication page is here

Advertisement: