MyBB Community Forums

Full Version: [Version dev. 1.0.2] TopPosts Plugin
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
Hi All

[Image: topposts.jpg]

This plugin generates an attractive table with the "top" threads in different periods of time, like the top of the day, of the week, of the month, of the year and top overall. The plugin creates a thumbnail taken from the image found on the first post of the thread, and reuses it for later views. If there is no image on the first post, it uses a generic image (inc/plugins/topposts/defaultImage.png).

When someone passes the mouse over the each top thread cell, a line is shown with the number of views, replies, thanks (if thanks/like plugin is enabled) and stars.

[Image: thumbnailicones.png]
It shows a really attractive list of posts with images and with the title on the bottom with a bit transparent background.

I added the code to this GIT repository:
https://github.com/blogantinom/topposts

As it is, it takes in account the views, ratings, replies and the number of thanks (if installed) of the the thread to create the ranking. At the moment this math is hard-coded, but could be configurable in the future.

The plugin was based on the ProStats (1.7.7) (by SaeedGh), I ended up hardcoding a few things on the plugin, instead of the template. Help in refactoring this is highly welcome.

Improvements that can be done:

- Make it work on remote server Smile (done)
- clean up the code (half done)
- Make the criteria configurable
- Configure periods (columns)
- Configure size of thumbnail.
- Make it more robust.
- Make the calls as a task, to be ran once at every X minutes, instead of call for every single viewer of the index page. (done)
- Cache the html to be reused (done)


Download it here:
http://forum.antinovaordemmundial.com/im...Plugin.zip

I would really appreciate if you guys could test it, and also be free to make suggestions. I don't recommend to use it on a production server, as it made mine hang the requests of the index. It was fixed disabling the plugin on the configuration.

I would like to thank @SaeedGh for his ProStats plugin, which help me a lot in making this plugin. Also thanks to Euan T, that helped me with regular expressions to find the images in the post.

I hope this plugin is useful for all.
Eco


The one known problem is that the task that updates the thumbnails and topposts table works only when called manually. If it is left to run by the schedule it creates broken tables. When ran by the task manager everything works fine.
I've made some changes to the plugin, so now the plugins uses a separated task to create the topposts table, which is updated every hour. It also uses the cache to save the html table and include it inside the index page.
Made some changes to the plugin, and now it reads all posts from db into an array before going inside the loop that creates the html. The download is still the same file (below).

I would really appreciate if some more expert developers could have a try with the plugin.

On windows it works. On my linux server though, it doesn't.

http://forum.antinovaordemmundial.com/im...Plugin.zip
Managed to make it work on my server:
http://forum.antinovaordemmundial.com/

The only problem remaining is that when I run the task manually it works perfectly and when it is ran through task scheduling it breaks. Any ideas?
Warning [2] mysql_fetch_array() expects parameter 1 to be resource, object given - Line: 73 - File: inc/plugins/topposts.php PHP 5.3.23 (Linux)

[Image: 2n8vf9.png]
Oh damn, I forgot I am using the thankyou plugin here, I will have to change the plugin to check if it is installed or not to use it. Thanks for trying.

http://mods.mybb.com/view/thank-you-like-system
Olá..irei testar por aqui.Mas no seu fórum está funcionando sem problemas?




Testando..

Warning [2] mysql_fetch_array(): supplied argument is not a valid MySQL result resource - Line: 73 - File: inc/plugins/topposts.php PHP 5.2.17 (Linux)
File	Line	Function
[PHP]	 	errorHandler->error
/inc/plugins/topposts.php	73	mysql_fetch_array
/caralha/modules/config/plugins.php	513	topposts_is_installed
/caralha/index.php	541	require

But i can activated..so i dont want too much rows.

row = 1 is the best

And..

I can´t deactivated
yap like i said so buged full off bugs
Just updated the plugin, same link.

Introduced a new feature, when you pass the mouse over the thumbnail/title square it shows a line with the number of views, replies, thanks (if plugin installed) and stars.

[Image: thumbnailicones.png]

Also implemented the changes to check if the thanks/likes plugin (from G33K) is installed. I might add support for other plugins.
please find some advice from expirience coder your plugin its way from stable

[Image: e6bp6b.png]

[Image: 2rh63he.png]
Pages: 1 2 3