PDA

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


the_sisko
10-19-2002, 10:00 PM
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.
https://vborg.vbsupport.ru/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
10-20-2002, 05:03 PM
Screenshot

JohnWoo
10-20-2002, 05:04 PM
Some screenshots plz ?!

Matt87
10-20-2002, 05:04 PM
Very Nice job!

JohnWoo
10-20-2002, 05:05 PM
Ohh.. sorry... I`ll post before you attach it .. :) :lol:

the_sisko
10-20-2002, 05:11 PM
Tested on 2.2.5 only but should work on any version above and below.

Floris
10-20-2002, 05:24 PM
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
10-20-2002, 05:26 PM
Yes I agree... :D

Schorsch
10-20-2002, 05:58 PM
public would be great !!!! :p

N9ne
10-20-2002, 06:34 PM
Yeah public would be great :)

the_sisko
10-20-2002, 07:13 PM
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
10-20-2002, 07:26 PM
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
10-20-2002, 10:44 PM
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
10-20-2002, 10:45 PM
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
10-20-2002, 10:49 PM
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
10-20-2002, 11:44 PM
Cool hack. Thanks :)

Velocd
10-21-2002, 01:15 PM
Nice idea, I'll surely install it whether or not you plan a public release.

/me installs

the_sisko
10-21-2002, 03:40 PM
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
10-21-2002, 05:29 PM
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
10-22-2002, 02:37 PM
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
11-07-2002, 03:52 PM
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=-
11-07-2002, 09:45 PM
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
11-10-2002, 08:29 PM
Thx Christian for this hack ... I use it now as well.
cu on scifi-forum.de ;)

Jethro
11-26-2002, 09:42 PM
Cool hack sisko, we are going to install it.

Thanks for sharing.

rjlohan
11-29-2002, 09:32 PM
'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
12-19-2002, 12:09 PM
nice hack. might install.

ladyfyre
12-22-2002, 07:26 PM
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
02-08-2003, 09:18 PM
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
04-17-2003, 04:59 AM
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
05-28-2003, 02:56 AM
I got the same thing, and I changed the countpost to countposts.php and it still didn't work.