View Full Version : User Forum Activeness Hack v1.0
g-force2k2
09-02-2002, 10:00 PM
Yet another hack by g-force2k2 (yeah i know aren't we all gettign sick of it by now :p)
Edit: Download the latest attachment [ Here ] (https://vborg.vbsupport.ru/attachment.php?s=&postid=294988)
Thanks bunches to Neo for the fix :)
well this one wasn't requested but i myself was trying to plain around with mysql and all and i came up with a new hack ;)
What does this hack do?
// +++++++++++++++++++++
Simply shows what forum the user is most active in and the percentage of his posts in that forum compared to overall
What to do?
// +++++++++++++++++++++
File Modifications (2)
Template Modifications (1)
Templates to Add (1)
It's a fairly easy hack to install maybe 1-2 minutes max ;) but i like how it looks :) shows on the getinfo template when viewing another member's profile... simple yet wicked :)
Instructions in the .php file attached below just open in a text editor :)
Notice i didn't include this on the postbit template because it would up the query count by a fair amount so i figured the getinfo would be suffice... If you like this hack i'd be greatful if you clicked install... regards and enjoy :)
g-force2k2
g-force2k2
09-03-2002, 01:47 AM
And here's the screenshot of the getinfo template :) regards... Enjoy ;)
g-force2k2
Erwin
09-03-2002, 01:59 AM
That's a cool hack. Does it exclude private forums?
g-force2k2
09-03-2002, 02:01 AM
No Erwin it doesn't but i can look into such... because i doubt most users won't be most active in their respecitve private forums unless they're spamming... just my thoughts... but i could be wrong... regards...
g-force2k2
Erwin
09-03-2002, 02:17 AM
Well, staff would be - people like me who are Senior Admins post almost exclusively in staff forums, that's why. :) It's a good idea... I may install it and make it exclude staff profiles.
g-force2k2
09-03-2002, 02:19 AM
yeah exlcuding the staff profiles would be considerably easier then tryin go exclude forums because it would require yet more queries... regards...
g-force2k2
LOD-squa
09-03-2002, 02:29 AM
Installed ;).
[D]Vincent
09-03-2002, 03:21 AM
Nice hack g-force2k2, you seem to be making alot of great ones recently. I'll install it when my site is back up.
:E
JohnWoo
09-03-2002, 05:40 AM
2g-force2k2 :
can you try create a little addon to this huck... You can see it in a attach! Sorry fo russian ... but it will by great!
Velocd
09-03-2002, 06:06 AM
Nice hack G-force, I will probably install this one.
Originally posted by JohnWoo
2g-force2k2 :
can you try create a little addon to this huck... You can see it in a attach! Sorry fo russian ... but it will by great!
I'm guessing by your screenshot (since I can't read Russian) you want it to display the top 5 most active spots that user visits, plus the percents? That it looks like. This could probably be done seperate in a pop-up window, or you could just implement it somewhere in getinfo.
How about that G-force, it wouldn't be too hard, right? Just while loop- fetch_array it and the results should come out similar to that ;)
Mathieu
09-03-2002, 06:18 AM
thx for this i'll install him when i've got a little time
Boofo
09-03-2002, 07:27 AM
Ok, g-force2k2, here I go. :) Can it be made to be able to only be viewed by Admins and Supermods and maybe mods in the profile view? And from a template again? (I don't have anything show up in the profile if it has a zero value or no value associated with it).
assassingod
09-03-2002, 07:35 AM
Very nice:) I'll defintely install this when I get back home;)
Like Boofo's question, Can it only be viewed by Admins/Super mods?? Thanks;)
Boofo
09-03-2002, 08:35 AM
g-force2k2, is the 12% supposed to be for that forum only or for total posts on the site? And I'm still trying to get to to only show to Admins, Supermods and mods. :)
Also, I have a private forum for coding hacks that only Me and one other person are allowed in and I know that I have more than 26 posts in there and it does not show that here. And ideas on this one? :)
Posts: 206 (1.71 posts per day | 39.62% of total posts)
Member Forum Activeness: Boofo is most active in General Forum
Accounting for a total of 26 Posts which is 12 % of Boofo's total posts!
The guy below has posted 90+% of his total posts in the Staff forum and it says only 1 at 0%? What is wrong with this picture? ;)
Posts: 111 (1.83 posts per day | 21.35% of total posts)
Forum Activeness: XXXXXX is most active in Staff Lounge accounting for a total of 1 Post which is 0 % of Madman's total posts!
g-force2k2
09-03-2002, 01:57 PM
Velocd... Johnwoo i'll work on such a hack shortly... Boofo for the staff restriction just find:
if(empty($t_post[ppforum])) {
replace it with:
if((empty($t_post[ppforum])) OR ($bbuserinfo[usergroupid] != 5 OR $bbuserinfo[usergroup] != 6 OR $bbuserinfo[usergroupid] != 7)) {
Also about the private forums i guess it does take into account the restrictions... :p As for the 0% Boofo its because its floor which means its rounded to the nearest whole number...
regards...
g-force2k2
Boofo
09-03-2002, 02:06 PM
Is there any way to get it to include all forums, private or not? And maybe have it do like a 1.32 % instead of just rounding it to the nearest whole number?
Originally posted by g-force2k2
Also about the private forums i guess it does take into account the restrictions... :p As for the 0% Boofo its because its floor which means its rounded to the nearest whole number...
regards...
g-force2k2
g-force2k2
09-03-2002, 02:09 PM
Originally posted by Boofo
Is there any way to get it to include all forums, private or not?
i'll have a look just have to wait til i get out of college ;) then i'll do some checks and stuff... i didn't really intend for the hack to bypass private forums but it did so know i'll have to backtrack ;) regards...
g-force2k2
Boofo
09-03-2002, 02:23 PM
I just checked and the code you gave me makes it so no one can see it now, not even the Admin of Supermods or mods. Also, it does show private forums, because the staff forum is private but the other private forum it doesn't show and that is where the user has most of his messages.
BTW: Are you talking about "until you get out of college" for the year or just for today? :)
Fixed code error. This will now work.
find
SELECT COUNT(postid) AS ppforum, thread.forumid AS forumid
FROM post
LEFT JOIN thread ON thread.threadid = post.threadid
WHERE userid = '$userinfo[userid]'
GROUP BY (forumid)
DESC LIMIT 1");
replace with
SELECT COUNT(postid) AS ppforum, thread.forumid AS forumid
FROM post
LEFT JOIN thread ON thread.threadid = post.threadid
WHERE userid = '$userinfo[userid]'
GROUP BY (forumid)
ORDER BY ppforum
DESC LIMIT 1");
I added by ORDER BY so that it will give you the higest post number instead of the forumid T_T
g-force2k2
09-03-2002, 04:59 PM
Actually Neo all you did was do an order by... the actually query itself already selected both the posts in that forum that they replied in most as well as the forumid... so i fail to see what your code change did? regards...
g-force2k2
Webmasta XT
09-03-2002, 06:21 PM
awesome hack..
Originally posted by g-force2k2
Actually Neo all you did was do an order by... the actually query itself already selected both the posts in that forum that they replied in most as well as the forumid... so i fail to see what your code change did? regards...
g-force2k2
well try the queries in in your MySQL of choise and you will see what I mean... I can give you a example...
using it without the ORDER BY I get for user number 81
ppforum | forumid
------------------------
9 2
adding the ORDER BY I get for user number 81
ppforum | forumid
------------------------
756 7
now what do you think would be more correct?
g-force2k2
09-03-2002, 08:14 PM
yes thank you neo for visual i see what you mean now :) regards and thanks a bunch... file updated :)
g-force2k2
Boofo
09-03-2002, 08:48 PM
I also changed this line:
$f_posts = floor(($t_post[ppforum] / $userinfo[posts]) * 100);
To this:
$f_posts = round(($t_post[ppforum] / $userinfo[posts]) * 100,2);
for a more accurate count.
I am still having problems with the code for the Admins and Mods being the only ones able to see it.
g-force2k2
09-03-2002, 09:00 PM
Boofo try this then... open member.php
find:
eval("\$forumactive = \"".gettemplate('getinfo_forumactive')."\";");
replace with:
if($bbuserinfo[usergroupid] == 5 OR $bbuserinfo[usergroupid] == 6 OR $bbuserinfo[usergroupid] == 7) {
eval("\$forumactive = \"".gettemplate('getinfo_forumactive')."\";");
} else {
$forumactive = "";
}
that should do the trick :) regards...
g-force2k2
Boofo
09-03-2002, 09:07 PM
It worked, thanks. Just to verify, this is what the code should look like for me now, right?
// +++++++ User Most Active Forum Hack [ g-force2k2 ] +++++++
// thanks to neo for the query fix :)
$t_post = $DB_site->query_first("
SELECT COUNT(postid) AS ppforum, thread.forumid AS forumid
FROM post
LEFT JOIN thread ON thread.threadid = post.threadid
WHERE userid = '$userinfo[userid]'
GROUP BY(forumid)
ORDER BY ppforum
DESC LIMIT 1");
if(empty($t_post[ppforum])) {
$forumactive = "";
} else {
$f_name = $DB_site->query_first("
SELECT title
FROM forum
WHERE forumid = '$t_post[forumid]'");
$f_posts = round(($t_post[ppforum] / $userinfo[posts]) * 100,2);
$p_type = iif($t_post[ppforum] == 1,'Post','Posts');
if($bbuserinfo[usergroupid] == 5 OR $bbuserinfo[usergroupid] == 6 OR $bbuserinfo[usergroupid] == 7) {
eval("\$forumactive = \"".gettemplate('getinfo_forumactive')."\";");
} else {
$forumactive = "";
}
}
// +++++++ User Most Active Forum Hack [ g-force2k2 ] +++++++
And what did you think of the change for the percentage?
g-force2k2
09-03-2002, 09:09 PM
yes... and the percentage is nice too :) regards...
question is does it work correctly though how you wanted it to?
g-force2k2
Boofo
09-03-2002, 09:13 PM
Yes, now the private forum shows up like it is supposed to and the percentage will be more noticeable on boards with more messages.
Boofo
09-03-2002, 09:15 PM
I do have one more question, though, is there a way to exclude certain forums (like with forumid)?
No its impossiable.
--------------------------------------------------------
under this
WHERE userid = '$userinfo[userid]'
place this
AND forumid!=XX
--------------------------------------------------------
Untill Neo came around :bandit:
Boofo
09-03-2002, 09:33 PM
Thats' what makes you "Da Man"! Thanks. :)
Boofo
09-03-2002, 09:44 PM
Neo, if I wanted to exclude more than one forum, would I do it like this?
AND forumid!=XX AND forumid!=XX AND forumid!=XX
g-force2k2
09-03-2002, 10:02 PM
yeah Boofo thats how you go about it :p regards... thanks again neo :)
g-force2k2
JohnWoo
09-04-2002, 10:45 AM
g-force2k2:
thanks a lot ...
wolfe
09-04-2002, 11:07 AM
getting this
Parse error: parse error in /usr/local/psa/home/vhosts/mysite/httpdocs/forums/member.php on line 1501
g-force2k2
09-04-2002, 11:09 AM
wolfe can you show me what you have on that line? regards...
g-force2k2
wolfe
09-04-2002, 11:29 AM
d00d sorted that now i deleted this
eval("dooutput(\"".gettemplate("getinfo")."\");");
}
by accident but now in the member.php getinfo template nothing is showing :(
i am using VBB 2.2.4
g-force2k2
09-04-2002, 01:18 PM
wolfe send me your member.php and i will repair it if you like ;) but if not then just re add the...
eval("dooutput(\"".gettemplate("getinfo")."\");");
}
regards...
g-force2k2
Originally posted by g-force2k2
... thanks again neo :)
g-force2k2
wolfe
09-04-2002, 10:02 PM
not working properly not showing in Getinfo template :(
wolfe
09-04-2002, 10:03 PM
i mean it is now showing anything to do with activity in the getinfo template below Posts :(
i found an error according to your hack
if a member has 0 Posts, but he or she posts in a forum which doesn't count any posts you get a division by zero
Warning: Division by zero in /is/htdocs/62144/www.yourdomain.com/board/vb/member.php on line 1620
on that line i got this:
$f_posts = floor(($t_post[ppforum] / $userinfo[posts]) * 100);
but i think it has to do with the full code in there
hope you'll find a clue for this
g-force2k2
09-18-2002, 01:12 PM
wolfe make sure you have the $forumactive variable in the getinfo template...
PsYc open the getinfo template find:
$f_posts = floor(($t_post[ppforum] / $userinfo[posts]) * 100);
replace it with:
if($t_posts[ppforum] > 0) {
$f_posts = floor(($t_post[ppforum] / $userinfo[posts]) * 100);
} else {
$f_posts = 0;
}
that should do the trick... regards...
g-force2k2
nice hack :)
maybe it would be nice if it would also calculate most active forum of thread starts of a user
g-force2k2
09-18-2002, 01:27 PM
dong haven't tested it yet... but give it a shot :p regards...
g-force2k2
nice :)
but some typo ORDER BY ppforum should be ORDER BY tforum
and the procentage stays on 0
cos (($t_thread[tforum] / $userinfo[posts]) * 100) is not right i think
maybe (($t_thread[tforum] / $userinfo[threads]) * 100) is better
g-force2k2
09-18-2002, 01:53 PM
oh yea whoops :p
the first change is correct.. but you have to add in this query too ;)
$threads = $DB_site->query_first("
SELECT COUNT(threadid) AS total
FROM thread
WHERE postuserid='$bbuserinfo[userid]'");
$userinfo[threads] = $threads[total];
regards ;) just add this query above the others...
g-force2k2
jup
and this line: if(!$t_post[tforum]) {
should be: if(!$t_thread[tforum]) {
nice addon :D
thx
Originally posted by g-force2k2
$threads = $DB_site->query_first("
SELECT COUNT(threadid) AS total
FROM thread
WHERE postuserid='$bbuserinfo[userid]'");
$userinfo[threads] = $threads[total];
it should be:
$threads = $DB_site->query_first("
SELECT COUNT(threadid) AS total
FROM thread
WHERE postuserid='$userinfo[userid]'");
$userinfo[threads] = $threads[total];
otherwise it uses the total threads of the user that is checking the profile ;)
g-force2k2
09-18-2002, 03:48 PM
yeah thanks dong ;) just shows im not a perfect coder :p im just coding off the top of my head... sorry for any of the errors ;) regards...
g-force2k2
Originally posted by g-force2k2
wolfe make sure you have the $forumactive variable in the getinfo template...
PsYc open the getinfo template find:
$f_posts = floor(($t_post[ppforum] / $userinfo[posts]) * 100);
replace it with:
if($t_posts[ppforum] > 0) {
$f_posts = floor(($t_post[ppforum] / $userinfo[posts]) * 100);
} else {
$f_posts = 0;
}
that should do the trick... regards...
g-force2k2
thank you :) works great
Units
09-25-2002, 12:48 AM
Excellent hack.
Installed.
Cyberhouse
09-28-2002, 09:23 AM
Installed :)
looks great
testing b4 decide wether to install or not.
Kriek
07-08-2003, 02:31 AM
Flawless via 2.3.0, first-rate work.
/me clicks install
legendarysk8er
09-03-2003, 01:47 AM
Maybe I am just blind, but for some reason I cannot see the attachment to download it..
FastAttack
09-13-2003, 03:46 PM
ever since they upgraded some of the threads have gone invalid :|
g-force2k2 - Any chance you can release this again as I'd really like it for my forum. ;)
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.