View Full Version : User post count from current forum
calorie
01-15-2006, 10:00 PM
This mod makes it so you can display the number of posts a user has from the current forum. Said another way, when you view a thread, that thread is in a forum, so this mod shows the number of posts a user has in that forum. See screenshot.
1 product
3 plugins
1 phrase
2 queries in showthread
1 query in showpost
1 postbit(_legacy) edit
It has been reported that one of the queries used in showthread takes too much time on a big board, so if you have a big board, you've been warned. :ermm:
18 Jan 2006: updated to use two queries in showthread
20 Jan 2006: instance of $postids var replaced with $ids
evenmonkeys
01-16-2006, 04:27 PM
I like this. =D
works fine on 3.5.3
any way to link to search / posts from current forum ?
pipin
01-16-2006, 05:47 PM
Nice. Maybe selectable subforums in which this is shown in a next version?
GamerJunk.net
01-16-2006, 06:22 PM
Awesome install!
Snake
01-16-2006, 07:26 PM
Nice addition! Thanks...
sinaluna
01-17-2006, 12:50 AM
Can this somehow be tied into the group/rank system?
On my site, each user group has a separate forum. When they post in the Books forum, I would like the book rank to display based on JUST the posts made in the book forum.
Likewise, in the TV forum, I would like the rank for that particular forum to show based on posts made just in the TV forum.
Hope that made sense.
Nice hack. :)
FleaBag
01-17-2006, 10:55 AM
This is a really nice addition! Something I've wanted since vB2. Thanks a whole lot. :D
lazytown
01-17-2006, 11:23 AM
Thanks!! - Nice mod. How many queries does it add? Any appreciable load?
Adding commas after 1,000 would be nice (like total posts).
-vissa
Developer
01-17-2006, 11:25 AM
nice hack installed
lazytown
01-17-2006, 11:52 AM
WARNING: Although I really love the idea of this mod, I cannot recommend anyone installing it unless you have TONS of server load to spare or a very small forum.
It adds 1 query PER post on a thread.. So if you have 10 posts per thread, it will add 10 queries per thread. And these are not small queries. It basically DOUBLED the load time per thread. This can really kill a server.
The only way I think this type of mod could be efficiently implemented would be to create a separate table that tracks posts per forum for each user. That would be really nice, but it would be a lot more work than this mod.
(clicks uninstall)
-vissa
calorie
01-17-2006, 07:53 PM
Thanks for the warning, but on my board this mod does not substantially increase server load or page display time (see attached screenshots) and that is probably true for some others also. While it wouldn't be hard for me to utilize a separate table and add a left join in the post query, the total overhead on my board is negligible either way, so the mod was created using separate count queries.
Something to remember is that my mods get tested on my board. It's rather off-putting to be spanked when it's not possible for me to test on your board, his board, her board. If you would have said something like, "Neat mod but would it be possible to do X instead of Y because Z happens?" I'd have been more inclined to redo the mod to help out, even though I don't need such a redo on my board.
lazytown
01-17-2006, 10:02 PM
Sorry, I didn't mean to be rude in any way at all. Didn't mean to "spank you" at all. Your efforts are greatly appreciated and I was really looking for something like this. In fact I really love this mod. I just wanted to be honest to the rest of the users. I think it's very important that we examine that aspect of each mod on large forums. This one just happened to place the largest load I've ever seen out of over 50 mods I've tried/installed. I thought the warning was warranted. I don't make a habit out of it.
I wouldn't be presumptuous to tell you how you need to modify it in order to make it work "properly." Right now it does seem to work properly -- and on small forums with load to spare, I think it's fine.
I actually didn't think it would be that easy to change the mod to create a separate table. It would be a much larger hack. I'm not sure we are talking about the same thing. In order to make it truly efficient, a permanent table would have to be added to the database that gets updated with every post a user makes (very slight load increase for posting). This table would then be used by the mod and create almost no load upon viewing threads. There would have to be an initial post scan upon install to create the counts for each user (and possibly something that could be run separately in the future). That would be a very long query (scanning all posts for all users), but only run one time at install. As a bonus, something like that could make it easy to show how many posts a user has in each forum anywhere on the site (like in member profile, etc). If you did that, I would definitely use it and give you huge props.
How many total posts do you have in your forum? That will make an enormous difference on the server load this plugin adds. The load placed by the mod will grow as the posts grow.
My forum has about 1M posts and 11K members. On that size of a forum, this did double the time per page and I tested it several times when there was almost no one on the board. Since it scans the entire posts table for each and every post (10X per page) , it's easy to see how that load is placed.
Sincerely
-vissa
Thanks for the warning, but on my board this mod does not substantially increase server load or page display time (see attached screenshots) and that is probably true for some others also. While it wouldn't be hard for me to utilize a separate table and add a left join in the post query, the total overhead on my board is negligible either way, so the mod was created using separate count queries.
Something to remember is that my mods get tested on my board. It's rather off-putting to be spanked when it's not possible for me to test on your board, his board, her board. If you would have said something like, "Neat mod but would it be possible to do X instead of Y because Z happens?" I'd have been more inclined to redo the mod to help out, even though I don't need such a redo on my board.
lazytown
01-17-2006, 10:20 PM
Another reason creating a separate table would not be so easy (though worth it in terms of server load) is that it would have to have hooks/be updated each time a post or thread is moved, deleted, etc. That would have to work through the ajax system, mod panel and admin panel. It would also have to be updated to include new forums if they are added/etc.
-vissa
calorie
01-18-2006, 06:15 AM
I'm all for honesty, but that post, maybe I just took it wrong, so I apologize too. Personally I think the utilization of a separate table wouldn't be hard, for me or anyone really, though I do agree that it'd be tedious to find all the spots for updates. That tedium, and the part about inserting the initial counts on a board of your size, got me to thinking. What I came up with is two queries in showthread, one should be negligible on any board, and for the other, I simply don't know how it'd be on a board with a 1M posts and 11K members. I believed you when you initially said that your load time doubled; I just don't have a board of that size for tests. If you saw a ten percent load time increase per post, maybe now you'll see a ten percent load time increase overall, but I really can't say for sure. Maybe you'll let me know?
silurius
01-18-2006, 04:48 PM
Minor request for input: Since I have many forums, if I were to use "Forum posts" my users might interpret that to mean total board posts. Anyone have ideas how to clarify that succinctly, in about as many words? ("Total posts in this forum" would just be too long). Sorry for the non-technical question, I guess I'm suffering from writer's block.
The Chief
01-18-2006, 05:43 PM
works great, thank you :)
* The Chief clicks install
this is great for posting competitions ;)
sellbuydomain
01-18-2006, 06:28 PM
i found a problem that, the post is not correct, same user name, has different number of forum post in different thread, it should be all the same post court , right? how to fix this bug
calorie
01-18-2006, 07:24 PM
Are the threads in the same forum? Did the user make another post in between viewing threads?
sellbuydomain
01-19-2006, 06:29 AM
i am confused, entire forum ? or jsut a section of forum?
i found that the forum post is different number in each forum section,
is this only court the section forum instead of entire forum?
if so, how can i make it court as entire forum post total .make them same number court in any section
calorie
01-19-2006, 05:41 PM
It counts posts in forum X where /forum/forumdisplay.php?f=X and forum X contains threads.
lazytown
01-20-2006, 02:12 AM
Sounds like a good attempt at reducing the queries. I'll give it a whirl, though I am still very weary of having the entire post table scanned in each thread (this time only once instead of 10 times, but it's still a very big query). I'll let you know how the load changes with the mods you've done. Thanks!
-vissa
I'm all for honesty, but that post, maybe I just took it wrong, so I apologize too. Personally I think the utilization of a separate table wouldn't be hard, for me or anyone really, though I do agree that it'd be tedious to find all the spots for updates. That tedium, and the part about inserting the initial counts on a board of your size, got me to thinking. What I came up with is two queries in showthread, one should be negligible on any board, and for the other, I simply don't know how it'd be on a board with a 1M posts and 11K members. I believed you when you initially said that your load time doubled; I just don't have a board of that size for tests. If you saw a ten percent load time increase per post, maybe now you'll see a ten percent load time increase overall, but I really can't say for sure. Maybe you'll let me know?
lazytown
01-20-2006, 02:15 AM
By the way, It might be a good idea to have some type of version number associated with your mod changes so we can be sure what we are downloading (like this could be v1.1, etc).. This last change was a pretty big one.
-vissa
lazytown
01-20-2006, 10:04 AM
OK I tested the new version.
While it does reduce the number of queries, it still appears to at least double (or in some cases triple) the load created per thread page view. Now if the page is cached, the load increase is much smaller. However, if the page is not cached, the load increase is 2-3X. (mine went from about .35 sec per uncached page to about 1.0 sec per uncached page.) This was while almost no one was on the forum.
When testing, you have to try loading up old threads that are likely not in the cache. You also have to try a different thread each time, because once you load an old thread, it goes right into the cache. That is why testing load time increases can be difficult/confusing.
Thanks for the effort, but I had to remove it due to the load. As I mentioned earlier, I think the only way this could work for large forums is to create a table which would be a lot of work. It's a shame becase I think this is sorely needed (would also be nice to see posts per forum in the member profile, etc).
Thanks again.
-vissa
calorie
01-20-2006, 01:44 PM
Okay, thanks for the update. Not sure if you know, but the forum posts count isn't a piece of information that gets cached. If page text is cached, the load can be smaller because the page text wouldn't have to be HTMLized. For uncached page text, the text gets HTMLized and that can increase load, but the forum posts query happens regardless, page text cached or not. Not sure if you are using debug mode, but if not, maybe try sticking the following in the config.php file, load a page, and follow the explain link. It'll show you stats on how the forum posts query performs, but it's subject to response variability. If you're up for it, try comparing several cached and uncached pages with explain, picking pages with about the same number of BB codes and images. It'd be interesting to see how the forum posts query performs on a board of your size.
// change xxx.xxx.xxx.xxx to your IP address
if ($_SERVER['REMOTE_ADDR'] == 'xxx.xxx.xxx.xxx')
{
$config['Misc']['debug'] = true;
}
lazytown
01-21-2006, 07:32 AM
Although VB is not caching the per forum post counts, the MYSQL database engine surely is during my testing (I have 4GB ram and set up mysql to cache quite a bit). It caches recently executed queries and when you reload the page, it will come up much quicker because of that. That is why I try to isolate it by going to old pages that likely haven't been viewed for a while. I did that both with and without the plugin turned on. I just don't think there is any way of getting around a large load placed by a query that scans the entire post table, though small improvements may be possible. It really makes perfect sense. I'm not sure if I'll be able to try out what you wrote above, but I'll let you know if I do. If you ever decide to try the storing of post counts in a separate table, let me know and I will definitely try that.
Thanks Again
-vissa
calorie
01-21-2006, 07:39 PM
Oh, didn't know you were referring to query cache and not vB cache. Not sure what you mean by 'scans the entire post table' though, as the query shouldn't be examining all the rows, but on a board of your size, it seems it's too many rows anyway. I think a separate table could have userid, forumid, and count, perhaps with forumid and count serialized, so at a minimum that'd be one row per user, which then could be a column in the user table instead, but there's still the updating to do. Not clear it's really worth it.
lazytown
01-22-2006, 09:42 AM
The big difference in a separate table would be you would only be doing a single quick lookup based on user ID and forum (the adding would be done at post time) -- no scans or counting. With the current method, it has to scan each table entry and add them up (in my case, 1,000,000). So 1 vs 1,000,000 is quite a difference. :) Another way of looking at is with a separate table, in my case, there would be at most 11K entries (one for each user) with one row as a result. Currently there are 1M posts with possibly thousands of results needing to be counted on the fly.
Of course the current method is available now, and a separate table is more like an addon to the software than just a quick mod.
Thanks for your help in any case and I'm sure some users will find it useful!
-vissa
roleplaycity
01-27-2006, 11:43 AM
Hiya, this is a great mod and I really love it, only I got a weird problem with it on my board and was forced to disable it.
(Doing nothing other than disabling this mod fixed my problem, so I know it relates back to this particular plugin).
If I wanted to use the Moderator options to move a thread from one forum to the other, in the drop-down list for Destination Forum, I was unable to see (and therefore unable to select) the forums beyond the main forum. Every other Mod Option worked correctly, only the 'Move' option was affected.
I don't know if it was just my board, but maybe you can see if it does the same thing on yours? Thought I'd make you aware of it.
Cheers ^^
Dee.
calorie
01-27-2006, 03:07 PM
Using inline moderation or thread tools, I see all my forums listed under Destination Forum when going to move a thread. Maybe this mod conflicts with some other mod?
roleplaycity
01-31-2006, 06:22 AM
No, it was the only mod I had installed at the time.
Using the moderator panel, the destination drop down list would only show the forums that did not belong to any parent forum. (4 of them). My other forums that belonged to another category would not show (about 60 of them).
calorie
01-31-2006, 07:34 AM
This mod uses the following hooks:
hook showpost_post
appears in showpost.php
hook showthread_query
appears in showthread.php
hook showthread_postbit_create
appears in editpost.php
and newreply.php
and showthread.php
The new variables get a "$fp_" prefix.
Don't see anything to modify forum lists.
Sorry, just not sure what to suggest. :(
lazytown
02-24-2006, 01:16 AM
I'd be willing to donate/pay for this mod to use the alternate method we discussed.
-vissa
Oh, didn't know you were referring to query cache and not vB cache. Not sure what you mean by 'scans the entire post table' though, as the query shouldn't be examining all the rows, but on a board of your size, it seems it's too many rows anyway. I think a separate table could have userid, forumid, and count, perhaps with forumid and count serialized, so at a minimum that'd be one row per user, which then could be a column in the user table instead, but there's still the updating to do. Not clear it's really worth it.
chikkoo
10-03-2006, 07:18 PM
Nice Mod. But I am looking for Threads Per forum.
Any Idea, how to modify this, or any mod already existing!
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.