MyBB Community Forums
Show number of threads on specific forum in post bit? - Printable Version

+- MyBB Community Forums (https://community.mybb.com)
+-- Forum: Extensions (https://community.mybb.com/forum-201.html)
+--- Forum: Plugins (https://community.mybb.com/forum-73.html)
+---- Forum: Plugin Requests (https://community.mybb.com/forum-65.html)
+---- Thread: Show number of threads on specific forum in post bit? (/thread-226373.html)

Pages: 1 2


Show number of threads on specific forum in post bit? - LouisRep - 2020-02-06

I want to show the number of threads a user has in a specific subforum in the user's postbit. How would I do this?

Edit: Made a simple version: https://community.mybb.com/mods.php?action=view&pid=1342


RE: Show number of threads on specific forum in post bit? - .m. - 2020-02-07

it requires a custom plugin [not readily available. if comfortable, you may hire a coder for making it]

--- moved to plugin requests ---


RE: Show number of threads on specific forum in post bit? - Xalysis - 2020-02-07

Hey!

Maybe this can help: https://community.mybb.com/mods.php?action=view&pid=1322


RE: Show number of threads on specific forum in post bit? - LouisRep - 2020-02-08

(2020-02-07, 02:29 AM)Xalysis Wrote: Hey!

Maybe this can help: https://community.mybb.com/mods.php?action=view&pid=1322

Thank you. I'll see if I can rewe some code to fit my purposes


RE: Show number of threads on specific forum in post bit? - LouisRep - 2020-02-15

For anyone reading this thread: I made my own plugin for this. Will refine it and upload it in a few days.


RE: Show number of threads on specific forum in post bit? - .m. - 2020-02-16

^ good to know that Smile


RE: Show number of threads on specific forum in post bit? - Omar G. - 2020-02-16

Note that fetching this in a per page load could be resource consuming. I would recommend caching such value.


RE: Show number of threads on specific forum in post bit? - WallBB - 2020-02-17

(2020-02-15, 11:10 PM)LouisRep Wrote: For anyone reading this thread: I made my own plugin for this. Will refine it and upload it in a few days.

This is good to hear Smile
+rep


RE: Show number of threads on specific forum in post bit? - LouisRep - 2020-02-23

Thanks guys, uploaded it here: https://community.mybb.com/mods.php?action=view&pid=1342

This is my first php project, so feedback is welcome.


RE: Show number of threads on specific forum in post bit? - Crazycat - 2020-02-23

(2020-02-23, 01:10 PM)LouisRep Wrote: Thanks guys, uploaded it here: https://community.mybb.com/mods.php?action=view&pid=1342

This is my first php project, so feedback is welcome.

I had a look to your plugin, I think you can optimize a little bit.
In count_threads, your query retrieve everything from threads table... Could be heavy. You can just get "tid" field, or better directly get the count.:
$query = $db->write_query("SELECT COUNT(DISTINCT(tid)) AS nbtid FROM ".TABLE_PREFIX."threads WHERE uid=$uid AND fid=$fid AND visible=1");
$threadCount = $db->fetch_field($query, 'nbtid');