PDA

View Full Version : vBulletin CMS Widgets - Widget: Top 5 Posters this Week


MaryTheG(r)eek
12-21-2009, 10:00 PM
......................................

Garamond
12-22-2009, 02:16 PM
Excellent add-on :) I like it!

kendo
12-24-2009, 11:34 PM
Nice work!

Is it possible to include multiple usergroups in this, or just one?

MaryTheG(r)eek
12-25-2009, 05:01 AM
Nice work!

Is it possible to include multiple usergroups in this, or just one?

Yes, sure. You can do it on 2 ways:

1.- Changing the "where" argument from WHERE usergroupid=2, to WHERE usergroupid=2 OR usergroupid=3 OR usergrooupid=7 . In this example we assume that you want to include members who belong to usergroups 2,3,7

2.- By using an array. At the top of the file add:

$grouparray = "2,3,7";
$groupids = explode(',',$grouparray);

Then change the "where" argument from WHERE usergroupid=2, to WHERE usergroupid IN ($groupids)

Maria

kf4eok
12-26-2009, 02:15 AM
Thanks, installed

Clizon
01-03-2010, 01:36 AM
Any way to EXCLUDE certain users? I have some newsbot users that will always win the post wars.

Bergler
01-03-2010, 05:06 AM
Yes, sure. You can do it on 2 ways:

1.- Changing the "where" argument from WHERE usergroupid=2, to WHERE usergroupid=2 OR usergroupid=3 OR usergrooupid=7 . In this example we assume that you want to include members who belong to usergroups 2,3,7

2.- By using an array. At the top of the file add:

$grouparray = "2,3,7";
$groupids = explode(',',$grouparray);
Then change the "where" argument from WHERE usergroupid=2, to WHERE usergroupid IN ($groupids)

Maria


Ah ha! That worked!! Was that always here, my bad :o Thanks for the great widget!! Happy new year!

microlight
01-06-2010, 05:03 PM
Didn't work.

Broke my board :(

Got the following database error because I have the majority of users are imported from a previous board. The user name is REGISTERED and the user I.D. is 31. I edited the code as you said... but it didn't work. Any ideas?

Database error in vBulletin 4.0.0:

Invalid SQL:

SELECT user.userid, user.username, user.usertitle,
COUNT(post.postid) AS postcount
FROM user
LEFT JOIN post
ON post.userid=user.userid
AND dateline>'1262563200'
WHERE usergroupid=2 OR to WHERE usergroupid=31
GROUP BY user.userid
ORDER BY postcount DESC
LIMIT 5;

MySQL Error : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'to WHERE usergroupid=31
GROUP BY user.userid
ORDER BY postcount DESC
LI' at line 7
Error Number : 1064
Request Date : Wednesday, January 6th 2010 @ 07:00:10 PM
Error Date : Wednesday, January 6th 2010 @ 07:00:11 PM
Script : http://www.microlightforum.com/content.php?121
Referrer : http://www.microlightforum.com/content.php?142
IP Address : 90.194.162.111
Username : VinceG
Classname : vB_Database
MySQL Version : 5.0.87-community

Blackhat
01-06-2010, 11:29 PM
this widget crashes my whole site when using it

MaryTheG(r)eek
01-07-2010, 04:09 AM
Didn't work.

Broke my board :(

Got the following database error because I have the majority of users are imported from a previous board. The user name is REGISTERED and the user I.D. is 31. I edited the code as you said... but it didn't work. Any ideas?

Database error in vBulletin 4.0.0:

Invalid SQL:

SELECT user.userid, user.username, user.usertitle,
COUNT(post.postid) AS postcount
FROM user
LEFT JOIN post
ON post.userid=user.userid
AND dateline>'1262563200'
WHERE usergroupid=2 OR to WHERE usergroupid=31
GROUP BY user.userid
ORDER BY postcount DESC
LIMIT 5;

MySQL Error : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'to WHERE usergroupid=31
GROUP BY user.userid
ORDER BY postcount DESC
LI' at line 7
Error Number : 1064
Request Date : Wednesday, January 6th 2010 @ 07:00:10 PM
Error Date : Wednesday, January 6th 2010 @ 07:00:11 PM
Script : http://www.microlightforum.com/content.php?121
Referrer : http://www.microlightforum.com/content.php?142
IP Address : 90.194.162.111
Username : VinceG
Classname : vB_Database
MySQL Version : 5.0.87-community

Please, don't say so easy "didn't work" and "broke my site", before you're totally sure that you did everything correct.

In your case, you wrote "WHERE usergroupid=2 OR to WHERE usergroupid=31" while the correct is "WHERE usergroupid=2 OR usergroupid=31". Why you added more "to WHERE"?

Maria

MaryTheG(r)eek
01-07-2010, 04:11 AM
this widget crashes my whole site when using it

Can you be more specific please? How is possible to crash your site, while its working fine for me and for so many others? Have you modified the code? If yes, are you sure that you modified it correct, or you need to read my previous post?

Maria

Juggernaut
01-09-2010, 07:21 PM
I tried changing the where, the way you show it, but it gives me
a database error no matter which of the two methods you show, I use. :(

microlight
01-09-2010, 08:23 PM
Sorry Maria. It didn't work and I didn't put the 'to' in there.

Your other one top posters this month is now on my site. I removed completely the following line

WHERE usergroupid=2

And the other monthly mod works fine. Although I am the highest poster to my site :D

Numenorean7
01-11-2010, 03:10 AM
Works great !

The only thing to improve would be to avoid displaying old inactive members with 0 posts during the first hours of the new current week. I guess there could be a condition to allow only members who posted this week, that would work.

Thanks a lot!

MizzouHoopster
01-11-2010, 06:28 AM
I'm probably going to sound so dumb, but I am new with Vbulletin and can't even find the "VbulletinCMS" area. I know I have seen Add widget before, but I have looked for countless minutes.

InsomniacP
01-11-2010, 11:48 AM
Great Idea,

didn't work on my forum, i will wait till this has been fixed... Can't wait, GG!

InsomniacP
01-11-2010, 11:50 AM
I'm probably going to sound so dumb, but I am new with Vbulletin and can't even find the "VbulletinCMS" area. I know I have seen Add widget before, but I have looked for countless minutes.

ACP main options on the left hand side... VBulletin CMS

MaryTheG(r)eek
01-11-2010, 03:18 PM
Due to lack of free time, I must decrease the time that I'm spending here for support. By having a long thread for each of my 16 mods, most often I'm bypassing questions. That's why for urgent questions please visit my site (http://www.microhellas.com/), where it's easier to support you, by having a thread per question.

Thank you
Maria

MizzouHoopster
01-11-2010, 06:16 PM
ACP main options on the left hand side... VBulletin CMS

Yeah, I am not seeing it bro. I don't have it on the left side. Is there something I need to enable, or what?

waynem
01-17-2010, 07:20 PM
Very nice, I just have one problem - the post count column appears one row below the user name under the top poster section, so the last row has an empty user name and the post count of the user above, and the first row has just a user name with no post count.

Any ideas?

javivi0
01-27-2010, 01:52 PM
hi, thanks for mod !!!!! I installed !!!

one question??? can I add this code in vbblock for sidebar of the forum?

thanks

k1klass
01-29-2010, 04:23 PM
Changed the id to guild group, but top poster displays - Posts:%u00A066

any idea's?

CORSO
02-14-2010, 07:05 PM
Me too

rikmac
03-01-2010, 04:51 PM
Me Too.

rikmac
03-01-2010, 05:17 PM
Ok, try this code, and ad your group id: in $grouparray = "2,3,4,5,"; in the first line.



$grouparray = "2";
$groupids = explode(',',$grouparray);

$posts = "Posts";
ob_start();
require_once('./includes/functions_user.php');
require_once('./includes/functions_bigthree.php');
// Current Week Top Posters
$starttime = mktime(0, 0, 0, date('n'), date('j'), date('Y')) - ((date('N')-1)*3600*24);
// Get Top Members for current week
$mostactiveweek_get = vB::$db->query_read("
SELECT ".TABLE_PREFIX."user.userid, ".TABLE_PREFIX."user.username, ".TABLE_PREFIX."user.usertitle,
COUNT(".TABLE_PREFIX."post.postid) AS postcount
FROM ".TABLE_PREFIX."user
LEFT JOIN ".TABLE_PREFIX."post
ON ".TABLE_PREFIX."post.userid=".TABLE_PREFIX."user.userid
AND dateline>'".$starttime."'
GROUP BY ".TABLE_PREFIX."user.userid
ORDER BY postcount DESC
LIMIT 5");
$topposter = true;
$output_bits = '';
while($user = vB::$db->fetch_array($mostactiveweek_get))
{
$percentage = round(($user[postcount]/$totalposts[postcount]) * 100);
if($topposter == true)
{
$avatarurl = fetch_avatar_url($user[userid]);
if (!$avatarurl) {
$useravatar = 'images/misc/avatar.png';
} else {
$useravatar = $avatarurl[0];
}
$output_bits .='<div align="center">
<img border="0" src="'.$useravatar.'"><br />
<a target="_blank" href="member.php?u='.$user[userid].'">'.$user[username].'</a><br />
'.$user[usertitle].'<br />
'.$posts.':'.$user[postcount].'<br />
</div><hr />';
$topposter = false;
} else {
$output_bits .= '<a target="_blank" href="member.php?u='.$user[userid].'">'.$user[username].'</a><div style="float: right;">'.$user[postcount].'</div><br />';
}
}
$output = $output_bits;
ob_end_clean();

MOGmartin
03-01-2010, 05:25 PM
hi, thanks for mod !!!!! I installed !!!

one question??? can I add this code in vbblock for sidebar of the forum?

thanks

Ive tried, no luck, althought Id love this for the forum area only...

any ideas anyone?

MedellinStyle
03-03-2010, 07:13 AM
hi Maria, How to apply this code in a sidebar block?????

pcalloway
03-03-2010, 06:38 PM
Having to uninstall this - it crashed my website with mysql errors as well.

mysql_connect() [<a href='function.mysql-connect'>function.mysql-connect</a>]: Lost connection to MySQL server during query
/home/authent/public_html/forum/includes/class_core.php on line 312
MySQL Error :
Error Number :
Request Date : Wednesday, March 3rd 2010 @ 03:31:44 PM
Error Date : Wednesday, March 3rd 2010 @ 03:31:44 PM
Script : http://www.authentic-campaigner.com/forum/cron.php?rand=1267648292
Referrer : http://www.authentic-campaigner.com/forum/content.php?
IP Address : xxx.xxx.xxx.xxx
Username :
Classname : vB_Database
MySQL Version :

KHALIK
03-03-2010, 07:41 PM
I've installed this on vb 4.0.2 and is working fine.

Installed it on my home page.

neudimenxion
03-07-2010, 11:48 PM
Installed. Just the member's profile photo didn't appear though already add in the photo in the profile page. I want exactly like the screen shot. What's the matter with my installation.

TQ.

hydn
03-30-2010, 10:14 PM
this widget crashes my whole site when using it

x2.

BEWARE! As your user table grows it will kill your server! We have 700k member it took down the entire site!

I believe its scanning the user table maybe?

Nice mod for smaller forums.

furst
04-12-2010, 02:24 AM
How about slightly modifying this to show top repped members/week or month. I'm no developer but reading over the code a bit it looks like it would be doable to someone who knew what they were doing. It would be good for my forum. Please consider it.

Thanks for the hack as it is, btw.

Steve_GB
04-20-2010, 03:45 PM
This is working well on my 4.03 site.

I'd like to see what it looks like with top poster this year, anyone know what to change in the date line to so it starts counting from 00:01 on the 1st of Jan 2010?

Steve

Carnage
04-21-2010, 11:46 AM
Hydn: I created a much more efficient widget for this; it shouldn't crash your site at all.

Steve: Again, the widget I created has 8 different time settings

See here: https://vborg.vbsupport.ru/showthread.php?t=236301

ArchAngelz
08-04-2010, 02:37 PM
Does anyone know how we can use this as a forum block? I tried entering the same code as PHP in a forum block but nothing displayed.

ArchAngelz
08-05-2010, 02:34 AM
One more question, can this be modified to show Top Posters this month rather than week? Seems like it has something to do with this line but I'm not a programmer :(

$starttime = mktime(0, 0, 0, date('n'), date('j'), date('Y')) - ((date('N')-1)*3600*24);

NeXtCentury
08-07-2010, 09:30 PM
Nice addition to the website ...

thanks alot :)

grumpystumpy
08-12-2010, 11:00 AM
Does anyone know how we can use this as a forum block? I tried entering the same code as PHP in a forum block but nothing displayed.

Works fine on 4.0.5 as a forum block (php)

Xencored
08-14-2010, 10:07 AM
Thanks installed works great!

paulvev
08-15-2010, 11:59 AM
Installed and works sweet on 4.0.5
;-)

Bergler
08-19-2010, 01:44 AM
Is not working on 4.0.6, cant get mine to work since the upgrade?

Bergler
08-19-2010, 02:21 PM
Is not working on 4.0.6, cant get mine to work since the upgrade?

This is the error I get, Invalid value '' for 'widgettypeid'

NPGamers.Net
08-24-2010, 03:41 AM
One more question, can this be modified to show Top Posters this month rather than week? Seems like it has something to do with this line but I'm not a programmer :(

$starttime = mktime(0, 0, 0, date('n'), date('j'), date('Y')) - ((date('N')-1)*3600*24);



his website? http://www.microhellas.com/downloads.php?do=cat&id=3 listed here maybe?

top dogs 360
09-14-2010, 03:10 AM
One more question, can this be modified to show Top Posters this month rather than week? Seems like it has something to do with this line but I'm not a programmer :(

$starttime = mktime(0, 0, 0, date('n'), date('j'), date('Y')) - ((date('N')-1)*3600*24);


Change this from
$starttime = mktime(0, 0, 0, date('n'), date('j'), date('Y')) - ((date('N')-1)*3600*24);

To
$starttime = mktime(0, 0, 0, date('m'), 1, date('Y'));

See it live here.

www.xboxhounds.com