Mind blowing SEO improving and Google rank increasing Signature Rotator SEO Tool.

Thread: 

change like plugin field in Prostat

Ads
banner
banner
banner
lion Offline referral

Posts: 122
Joined: May 2014
Reputation: 0

#1
Member
Hello
How can I change the default like plugin stat in Prostats
I'm using this plugin :
https://github.com/euantorano/SimpleLikes

Now I want to match it with Prostats to show the like received by each person
would you help me ?

Heart
marcus_avrelius Offline referral

Posts: 2,424
Joined: May 2013
Reputation: 102

#2
Support Team
Hi sorry but I just don't get it. You have "Simple Likes" and "Pro stats" plugin installed and you want to marge them or what?

I will have to install both plugins and take a look will take time has stuff to do be patient. No guaranty I will be able to do it.

P.S. It seems as Pro Stats is designed to work with Thanks plugin "Please install the Thanks plugin." http://mods.mybb.com/view/thanks
marcus_avrelius Offline referral

Posts: 2,424
Joined: May 2013
Reputation: 102

#3
Support Team
Here are queries to fetch user given and received likes:

PHP Code:
//received likes
$query2 $db->query("
           SELECT u.username, u.uid, p.uid post_id, COUNT(u.uid) AS likes
           FROM "
.TABLE_PREFIX."post_likes 
           LEFT JOIN "
.TABLE_PREFIX."posts p ON (post_id=p.pid)
           LEFT JOIN "
.TABLE_PREFIX."users u ON (p.uid=u.uid)
           group by u.uid ORDER BY likes DESC
        "
);
        
       while(
$user $db->fetch_array($query2))
{
$name =  $user['username'];       
$count $user['likes'];
echo 
"<div>Top received likes: <span>$name, likes($count)</span></div><br/>";
        }
        
//given likes WORKS
     
$query1 $db->query("
           SELECT u.uid, u.username, user_id, COUNT(user_id) AS likes
           FROM "
.TABLE_PREFIX."post_likes 
           LEFT JOIN "
.TABLE_PREFIX."users u ON (user_id=u.uid)
           group by user_id ORDER BY likes DESC
        "
);
       while(
$user $db->fetch_array($query1))
{
$name =  $user['username'];       
$count $user['likes'];
echo 
"<div>Top Given likes: <span>$name, likes($count)</span></div><br/>";
        } 

I am not sure what do you want to do?
lion Offline referral

Posts: 122
Joined: May 2014
Reputation: 0

#4
Member
Thanks
I want to combine both Simple Like & Pro stats
where should I put this query and how to change Pro stats to be match with Simple Like ?
marcus_avrelius Offline referral

Posts: 2,424
Joined: May 2013
Reputation: 102

#5
Support Team
Do you want to show a new column with users that receive and given more likes?
marcus_avrelius Offline referral

Posts: 2,424
Joined: May 2013
Reputation: 102

#6
Support Team
P.S. Just updated the code:

The code above will fetch top:

Users that given most likes.
Users that received most likes.

Now you just need to integrate it onto Pro Stats. Spend lots of time on this Smile
marcus_avrelius Offline referral

Posts: 2,424
Joined: May 2013
Reputation: 102

#7
Support Team
Here is a guide on how to integrate likes into pro stats plugin.

First we need to create 2 templates in Global Templates:

#1.
Name: thanks_given
Code:
<tr class="smalltext">
        <td><a href="{$profilelinkgiven}">{$namegiven}</a></td>
        <td align="{$ps_align}">{$countgiven}</td>
        </tr>

#2
Name: thanks_received
Code:
<tr class="smalltext">
        <td><a href="{$profilelinkreceived}">{$namereceived}</a></td>
        <td align="{$ps_align}">{$countreceived}</td>
        </tr>

Find this template: prostats_mostthanks and replace it's code with this:
Code:
<td><table width="100%" border="0" cellspacing="0" cellpadding="{$theme[tablespace]}">
        <tr class="tcat smalltext">
        <td colspan="2">{$lang->prostats_most_thanks}</td>
        </tr>
        <tr>
<td colspan="2"><table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
<td class="smalltext">Top Most Received</td>
{$mostthanks_row_received}
</tr>
<tr>
<td class="smalltext">Top Most Given</td>
{$mostthanks_row_given}
</tr>

</table></td></tr>
        </table></td>

Now lets do a bit of PHP coding.

Open prostats.php and find:
PHP Code:
function ps_GetMostThanks($NumOfRows

Replace the entire function with this code:
PHP Code:
function ps_GetMostThanks($NumOfRows)
{
    global 
$mybb$db$templates$theme$lang$ps_align;
    
    
//received likes
$query2 $db->query("
           SELECT u.usergroup, u.displaygroup, u.username, u.uid, p.uid post_id, COUNT(u.uid) AS likes
           FROM "
.TABLE_PREFIX."post_likes 
           LEFT JOIN "
.TABLE_PREFIX."posts p ON (post_id=p.pid)
           LEFT JOIN "
.TABLE_PREFIX."users u ON (p.uid=u.uid)
           group by u.uid ORDER BY likes DESC
           LIMIT 10
        "
);
        
       while(
$user $db->fetch_array($query2))
{      
$countreceived $user['likes'];
$uid $user['uid'];
$profilelinkreceived get_profile_link($uid);
$namereceived format_name(htmlspecialchars_uni($user['username']), $user['usergroup'], $user['displaygroup']);

eval(
"&#092;$mostthanks_row_received .= &#092;"".$templates->get("thanks_received")."&#092;";");
        }
            
//given likes WORKS
     
$query1 $db->query("
           SELECT u.usergroup, u.displaygroup, u.uid, u.username, user_id, COUNT(user_id) AS likes
           FROM "
.TABLE_PREFIX."post_likes 
           LEFT JOIN "
.TABLE_PREFIX."users u ON (user_id=u.uid)
           group by user_id ORDER BY likes DESC
           LIMIT 10
        "
);
       while(
$user $db->fetch_array($query1))
{      
$countgiven $user['likes'];
$uid $user['uid'];
$profilelinkgiven get_profile_link($uid);
$namegiven format_name(htmlspecialchars_uni($user['username']), $user['usergroup'], $user['displaygroup']);
eval(
"&#092;$mostthanks_row_given .= &#092;"".$templates->get("thanks_given")."&#092;";");
        } 
    eval(
"&#092;$column_mostthanks = &#092;"".$templates->get("prostats_mostthanks")."&#092;";");

    return 
$column_mostthanks;


This is it now you should have a column Most thanks showing:
Users that most received and given likes Smile
lion Offline referral

Posts: 122
Joined: May 2014
Reputation: 0

#8
Member
Thanks a lot Dear Victor

Best Regards
Heart





User(s) browsing this thread: 1 Guest(s)