here is my solution to this problem. I read the TopUsers.php, topusers_center.tpl, and users.php code and I looked up how "total_votes" and "published_votes" were made and I made the same for "total_received_votes"
Please, read this, use it, and tell me if it works for you and if is possible to add this to the next release
1. first go to /libs/user.php
1.1. on line 37 add a new "for stats" var for the User class
PHP Code:
var $total_received_votes = 0;
1.2 go to all_stats function on line 159 and add the new var after "total_comments" on line 179:
PHP Code:
$this->total_received_votes = $db->get_var("SELECT sum(link_votes) FROM " . table_links . " WHERE link_author = $this->id and link_status != 'discard' $link_date");
1.3 add a new line after line 203:
PHP Code:
$main_smarty->assign('user_received_votes', $this->total_received_votes);
1.4 now your users have a variable where you keep the total received votes
2. now the idea is to show this variable on the topusers.php page
2.1 let's add a new config var on /libs/lang.conf: go to line 618 where section "top users" vars are and add before "karma":
PHP Code:
//<SECTION>TOP USERS</SECTION><ADDED></ADDED>
PLIGG_Visual_TopUsers_TH_ReceivedVotes = "Received Votes"
2.2 go to /topusers.php and on line 32 replace:
PHP Code:
$items = array($main_smarty->get_config_vars('PLIGG_Visual_TopUsers_TH_User'), $main_smarty->get_config_vars('PLIGG_Visual_TopUsers_TH_News'), $main_smarty->get_config_vars('PLIGG_Visual_TopUsers_TH_PublishedNews'), $main_smarty->get_config_vars('PLIGG_Visual_TopUsers_TH_Comments'), $main_smarty->get_config_vars('PLIGG_Visual_TopUsers_TH_TotalVotes'), $main_smarty->get_config_vars('PLIGG_Visual_TopUsers_TH_PublishedVotes'));
with
PHP Code:
$items = array($main_smarty->get_config_vars('PLIGG_Visual_TopUsers_TH_User'), $main_smarty->get_config_vars('PLIGG_Visual_TopUsers_TH_News'), $main_smarty->get_config_vars('PLIGG_Visual_TopUsers_TH_PublishedNews'), $main_smarty->get_config_vars('PLIGG_Visual_TopUsers_TH_Comments'), $main_smarty->get_config_vars('PLIGG_Visual_TopUsers_TH_TotalVotes'), $main_smarty->get_config_vars('PLIGG_Visual_TopUsers_TH_PublishedVotes'), $main_smarty->get_config_vars('PLIGG_Visual_TopUsers_TH_ReceivedVotes'));
2.3 go to line 41 and replace:
PHP Code:
if(intval($sortby) < 0 || intval($sortby) > 5)
with
PHP Code:
if(intval($sortby) < 0 || intval($sortby) > 6)
2.4 go to line 75 and add a new "case" for sortby
PHP Code:
case 6: // sort users by number of received votes
$select = "SELECT user_id, sum(link_votes) as count ";
$from_where = " FROM " . table_users . ", " . table_links . " WHERE link_author=user_id AND user_level<>'god' GROUP BY user_id";
$order_by = " ORDER BY count DESC ";
break;
2.5 with this you have your topusers table and a new column "Received Votes" but you must modify your template to show it
3. add the new column to topusers table in topusers themplate .tpl
3.1 go to /templates/yget/topusers_center.tpl, go to line 32 after "user_published_links" and add this line:
PHP Code:
$main_smarty->assign('user_received_votes', $user->total_received_votes);
3.2 go to /templates/yget/topusers_data.tpl, go to line 18 before "<td>{$user_karma}</td>" add this line:
PHP Code:
<td>{$user_received_votes}</td>
4. to show it on user profile:
4.1 go to /libs/lang.conf: and go to line 797 where section "profile" vars are and add berofe "modify profile":
PHP Code:
//<SECTION>PROFILE</SECTION><ADDED>0.5</ADDED>
PLIGG_Visual_Profile_Total_Received_Votes = "Received Votes"
4.2 go to /templates/yget/user_center.tpl and find line 375, and after "$user_published_votes" add this lines:
PHP Code:
<tr>
<td><strong>{#PLIGG_Visual_Profile_Total_Received_Votes#}:</strong></td>
<td>{$user_received_votes}</td>
</tr>
thats all...