View Full Version : Display most active users
ravel123
07-12-2011, 05:16 PM
Hi,
i am using vBulletin 4.1.4. I am looking for a solution how to reward users that are posting threads and answering to threads in my forum.
Basically I need to publicly display who posted created the most threads/answered to the most threads per week - so i can reward that user somehow.
I have tested vbExperience but its not working with vBulletin 4.1.4. The post counter is incorrect.
Badshah93
07-12-2011, 06:22 PM
Create New Plugin:
Hook: forumhome_complete
Title: Most Actived Member Of The Week
Execution Order : 5
Code
$cutofftime = TIMENOW - 7*86400;
$mostactive = $db->query_first("select count(postid) as count, post.userid, user.username from ".TABLE_PREFIX."post INNER JOIN ".TABLE_PREFIX."user on user.userid = post.userid where post.dateline > $cutofftime GROUP BY post.userid ORDER BY count DESC LIMIT 1");
vB_Template::preRegister('FORUMHOME',array('mostac tive' => $mostactive));
Now To Display Username of the Most Active Member
Use:
{vb:raw mostactive.username}
anywhere in the FORUMHOME TEMPLATE
ProFifaLeagues
07-12-2011, 06:53 PM
Is there a way to do this to show in the Sidebar/Forum Blocks ??
ravel123
07-12-2011, 07:11 PM
Thanks it works!
It would be cool to display the username as a link which opens the context menu. exactly like clicking a username in the forum.
you have an idea how to manage this?
Badshah93
07-12-2011, 07:24 PM
Is there a way to do this to show in the Sidebar/Forum Blocks ??
Open Forum Block Manager
Create a new block -> type -> Custom Html (if you already have some block which is Custom HTML type and you want to add in that, then edit that block else create new block)
type: PHP
Content:
global $db;
$cutofftime = TIMENOW - 7*86400;
$mostactive = $db->query_first("select count(postid) as count, post.userid, user.username from ".TABLE_PREFIX."post INNER JOIN ".TABLE_PREFIX."user on user.userid = post.userid where post.dateline > $cutofftime GROUP BY post.userid ORDER BY count DESC LIMIT 1");
$templater = vB_Template::create('mostactivemember');
$templater->register('mostactive',$mostactive);
$mostactives = $templater->render();
return $mostactives;
Now You need to create a template
Title: mostactivemember
1. You can Use {vb:raw mostactive.username} to display the username
2. You can Use {vb:raw mostactive.count} to display the post count in a week
Thanks it works!
It would be cool to display the username as a link which opens the context menu. exactly like clicking a username in the forum.
you have an idea how to manage this?
Replace The Plugin Content With This
$cutofftime = TIMENOW - 7*86400;
$mostactive = $db->query_first("select count(postid) as count, post.userid, user.username from ".TABLE_PREFIX."post INNER JOIN ".TABLE_PREFIX."user on user.userid = post.userid where post.dateline > $cutofftime GROUP BY post.userid ORDER BY count DESC LIMIT 1");
$memberaction_dropdown = construct_memberaction_dropdown(fetch_userinfo($mo stactive[userid]));
vB_Template::preRegister('FORUMHOME',array('mostac tive' => $mostactive));
vB_Template::preRegister('FORUMHOME',array('member action_dropdown' => $memberaction_dropdown));
and use
{vb:raw memberaction_dropdown}
where you want in FORUMHOME TEMPLATE
ravel123
07-12-2011, 08:06 PM
Thank you very much. It works great :)
ProFifaLeagues
07-13-2011, 03:20 AM
Thanks Sherif Worked a treat!
ravel123
07-13-2011, 09:24 AM
I have another question related to this topic.
If no threads have been created this week. I dont want to show the message.
So i tried the following condition with no success:
<vb:if condition="{vb:raw mostactive.count} > 0">
my message
</vb:if>
Badshah93
07-13-2011, 09:29 AM
I have another question related to this topic.
If no threads have been created this week. I dont want to show the message.
So i tried the following condition with no success:
<vb:if condition="{vb:raw mostactive.count} > 0">
my message
</vb:if>
script counts post not the thread..
u can use this condition
<vb:if condition="$mostactive[count] > 0">
my message
</vb:if>
mikeinjersey
08-04-2011, 04:35 PM
there isn't a plugin for this anywhere ?
I think it's also a good idea to reward back users and moderators..to keep them active on the forum.
I guess the Moderator part, I can pick from the Admin CP and seeing how much moderating they've done for the month...
would be nice if there was a plugin to put everything together though.
I'd make an announcement once a month in our announcement section...showing the most active users and moderators.
--------------- Added 1312495499 at 1312495499 ---------------
anybody ?
tryin to get a quick reply...otherwise i'll just make the changes specified in this thread.
qpurser
08-05-2011, 02:25 PM
I tried to add this but got an error.
Any help why this is happening?
Thanks
Database error in vBulletin 4.1.5:
Invalid SQL:
select count(postid) as count, post.userid, user.username from V4post INNER JOIN V4user on user.userid = post.userid where post.dateline > 1311952983 GROUP BY post.userid ORDER BY count DESC LIMIT 1;
MySQL Error : Unknown column 'post.userid' in 'field list'
Error Number : 1054
Request Date : Friday, August 5th 2011 @ 11:23:03 AM
Error Date : Friday, August 5th 2011 @ 11:23:04 AM
Script : http://xxx.com/V4/forum.php
Referrer : http://xxx.com/V4/forum.php
IP Address :
Username :
Classname :
MySQL Version : 5.0.91-log
mchll9898
01-20-2020, 06:29 PM
Create New Plugin:
Hook: forumhome_complete
Title: Most Actived Member Of The Week
Execution Order : 5
Code
$cutofftime = TIMENOW - 7*86400;
$mostactive = $db->query_first("select count(postid) as count, post.userid, user.username from ".TABLE_PREFIX."post INNER JOIN ".TABLE_PREFIX."user on user.userid = post.userid where post.dateline > $cutofftime GROUP BY post.userid ORDER BY count DESC LIMIT 1");
vB_Template::preRegister('FORUMHOME',array('mostac tive' => $mostactive));
Now To Display Username of the Most Active Member
Use:
{vb:raw mostactive.username}
anywhere in the FORUMHOME TEMPLATE
I know this is old, but maybe someone can help. This works great - I have vb 4.2.5.
I was wondering what I would need to add to the code to exclude my user id, so I'm not showing up as the most active member of my site.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.