PDA

View Full Version : How many posts did a user make in which forum


the_sisko
20 Oct 2002, 18:02
What does it do?
OK, this is one off my many hack I made a long time ago, it was very bad as my sql was very bad. Today I improved it a little bit as I learned some more sql :D
Some time ago I needed to get some new mods and wanted a fast way to find out where a specific user posted most. So I created this little stats script which shows up the number of posts in very forum. I took the function from forum.php and modified it a little bit.
For better understanding see screenshot in next post.
http://www.vbulletin.org/forum/attachment.php?postid=311900

Installation

Edit /admin/user.php
Find:
<li>".makelinkcode("View the profile for $user[username]","../member.php?s=$session[sessionhash]&action=getinfo&userid=$userid",1)."</li>
under it put:
<li>".makelinkcode("Show in which forum $user[username] posted","countpost.php?s=$session[sessionhash]&userid=$userid&username=$user[username]")."</li>

Upload countposts.php
Put countposts.php in your admin folder.


You will find a new link on the CP under edit user called:
[Show in which forum USERNAME posted]

When you click on it, you will see a page which shows a statistic in which forum the user posts how many posts.



EDIT
Protection
I limited this function to the admins added under the config.php file. If you want this hack to be used be any admin just do this:
Find:
if (($action=="modify") && checklogperms($canviewadminlog,1,"<p>Page viewing restricted.</p>")) {and replace it withif ($action=="modify") {

the_sisko
20 Oct 2002, 18:03
Screenshot

JohnWoo
20 Oct 2002, 18:04
Some screenshots plz ?!

Matt87
20 Oct 2002, 18:04
Very Nice job!

JohnWoo
20 Oct 2002, 18:05
Ohh.. sorry... I`ll post before you attach it .. :) :lol:

the_sisko
20 Oct 2002, 18:11
Tested on 2.2.5 only but should work on any version above and below.

Floris
20 Oct 2002, 18:24
My members might have an interest in this being a public page. Is that possible? Or does that include some security issue? like showing forums they shouldn't see?

I'd love such an overview (public)

Matt87
20 Oct 2002, 18:26
Yes I agree... :D

Schorsch
20 Oct 2002, 18:58
public would be great !!!! :p

N9ne
20 Oct 2002, 19:34
Yeah public would be great :)

the_sisko
20 Oct 2002, 20:13
Public shouldn't be a prob, as we can use the forum permission function. My only thought about this is, on my forum which have ~55 active forums, I have ~100 queries for this page. OK its half the query size as when I go to edit forums in CP but its the CP and I don'T do this often.

So I could make this a public one as well, but remember this could make a lot load on you db.

Erwin
20 Oct 2002, 20:26
Originally posted by the_sisko
Public shouldn't be a prob, as we can use the forum permission function. My only thought about this is, on my forum which have ~55 active forums, I have ~100 queries for this page.

That is a big problem. If you make that public, anyone can bring your server to its knees by setting that page to auto-refresh using a cron job. :) So better optimize it first.

Floris
20 Oct 2002, 23:44
Originally posted by the_sisko
Public shouldn't be a prob, as we can use the forum permission function. My only thought about this is, on my forum which have ~55 active forums, I have ~100 queries for this page. OK its half the query size as when I go to edit forums in CP but its the CP and I don'T do this often.

So I could make this a public one as well, but remember this could make a lot load on you db. Since I am just a little people person with little people members and little forums .. i think it wont be a problem, not many will use it, not even on a daily base!

In my personal case i would like to have it:
admins - through back-end {everything} and public like the (super)mods.
(super)mods - can view everybody (like the admin, but only public (my (super)mods don't have back-end access
registered - can only view their own information - not others. (maybe through userCP option?)
everybody else - no access to this feature at all

And ofcourse, if a registered member can't view the moderators forum - then they shouldn't - like normal protection. but thaz all.

Just to give an impression of what I have in my head about this.

Floris
20 Oct 2002, 23:45
Originally posted by Erwin


That is a big problem. If you make that public, anyone can bring your server to its knees by setting that page to auto-refresh using a cron job. :) So better optimize it first.
A little extra code can prevent that with ease.

Erwin
20 Oct 2002, 23:49
Originally posted by xiphoid

A little extra code can prevent that with ease.

That's true. :) But having 2 queries for each forum is still too server-intensive.

Vile
21 Oct 2002, 00:44
Cool hack. Thanks :)

Velocd
21 Oct 2002, 14:15
Nice idea, I'll surely install it whether or not you plan a public release.

/me installs

the_sisko
21 Oct 2002, 16:40
Originally posted by Erwin


That's true. :) But having 2 queries for each forum is still too server-intensive.

IF you will look at the code its one query for the numbers and one for every forum. I used the function from /admin/forum.php to show a sortet list of all forums.
Don't know if there is a better and fast way to create a list of all forums and its subforums? IF so, I would like to know, to make this code better.

Sc0rp
21 Oct 2002, 18:29
thanx mate.. awesome hack :)

just one thing.. u named it countposts.php but the link goes to countpost.php... just thought I'd tell ya :p

the_sisko
22 Oct 2002, 15:37
Originally posted by Sc0rp
thanx mate.. awesome hack :)

just one thing.. u named it countposts.php but the link goes to countpost.php... just thought I'd tell ya :p

Thx m8, didn't realised that, cause my server looks for same file names and took the closest result he gets ;)

Will fix this in next update.

Me2Be
07 Nov 2002, 16:52
Great idea :)

Is there anyway to that you can put a time frame in there? Like XYZ's posts in the past 30 days?

-=dm=-
07 Nov 2002, 22:45
Hi nice hack:)
Im getting page NOT found :(
what Im doing wrong? I have vB2.2.4

thanx

EDIT:


<li>".makelinkcode("Show in which forum $user[username] posted","countpost.php?s=$session[sessionhash]&userid=$userid&username=$user[username]")."</li>


fixed :)
countpost.php =countposts.php (missing "s")

Odysseus
10 Nov 2002, 21:29
Thx Christian for this hack ... I use it now as well.
cu on scifi-forum.de ;)

Jethro
26 Nov 2002, 22:42
Cool hack sisko, we are going to install it.

Thanks for sharing.

rjlohan
29 Nov 2002, 22:32
'We' Jethro... :lol:

;)

Will have to check it out first, see what we can do about the SQL - if alot of queries are involved, could be a problem.

over
19 Dec 2002, 13:09
nice hack. might install.

ladyfyre
22 Dec 2002, 20:26
great hack :)

One question though....

Does anyone know how i could change this so that the script would only return forums in which a user has posted?? My site is set up by geographical area, with over 300 forums all told...and scrolling down trying to see where they have posted is a BIG TIME pain when many are blank.

subu1
08 Feb 2003, 22:18
Originally posted by -=dm=-
Hi nice hack:)
Im getting page NOT found :(
what Im doing wrong? I have vB2.2.4

thanx

EDIT:


<li>".makelinkcode("Show in which forum $user[username] posted","countpost.php?s=$session[sessionhash]&userid=$userid&username=$user[username]")."</li>


fixed :)
countpost.php =countposts.php (missing "s")

good morning *g*

i have the same problem, but i don't no what you tell me, oh my english *g*

*.php can not find

whats going on , please help me

thxx subu1

Rynthar
17 Apr 2003, 05:59
This is ++++ing me off, every hack I have installed wont work. I am on 2.3.0 and when I upload countposts.php and click on the link to view the posts, I get a page cannot be found. When I go to /admin/countposts.php I get that damn mysql error 1064. Help! I cant install any hacks since I get the same damn thing

legendarysk8er
28 May 2003, 03:56
I got the same thing, and I changed the countpost to countposts.php and it still didn't work.