MyBB Community Forums

Full Version: [1.4.x/1.6.x] Thank You/Like System v1.5 (Updated: 10/26/2011)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Is there a way to see which POSTS have the most likes? It would be nice to see a list with the 10 most liked/thanked posts or something similar. Maybe a jquery check to start?
I threw together a quick script a while back to show the top 100 most liked posts. It isn't pretty but it should provide you with a starting point for something better.

<?php
define("IN_MYBB", 1);
define("NO_ONLINE", 1);

require_once "./global.php";

$query = $db->query("SELECT l.pid, count( * ) AS likes, p.subject, p.username, p.uid
							FROM `mybb_g33k_thankyoulike_thankyoulike` l
							LEFT JOIN `mybb_posts` p ON l.pid = p.pid
							GROUP BY l.pid
							ORDER BY likes DESC, l.pid ASC
							LIMIT 100");

while($data = $db->fetch_array($query))
{
	echo '<br />Post #<a href="/showthread.php?pid='.$data['pid'].'#post_'.$data['pid'].'">'.$data['pid'].': '.$data['subject'].'</a>
	by <a href="/member.php?action=profile&uid='.$data['uid'].'">'.$data['username'].'</a> with '.$data['likes'].' likes.';
}
(2014-08-10, 12:37 PM)Cameron:D Wrote: [ -> ]I threw together a quick script a while back to show the top 100 most liked posts. It isn't pretty but it should provide you with a starting point for something better.

<?php
define("IN_MYBB", 1);
define("NO_ONLINE", 1);

require_once "./global.php";

$query = $db->query("SELECT l.pid, count( * ) AS likes, p.subject, p.username, p.uid
							FROM `mybb_g33k_thankyoulike_thankyoulike` l
							LEFT JOIN `mybb_posts` p ON l.pid = p.pid
							GROUP BY l.pid
							ORDER BY likes DESC, l.pid ASC
							LIMIT 100");

while($data = $db->fetch_array($query))
{
	echo '<br />Post #<a href="/showthread.php?pid='.$data['pid'].'#post_'.$data['pid'].'">'.$data['pid'].': '.$data['subject'].'</a>
	by <a href="/member.php?action=profile&uid='.$data['uid'].'">'.$data['username'].'</a> with '.$data['likes'].' likes.';
}

Thanks for the effort, but how exactly would I use this? ^.^ I'm not really familiar with adding scripts or new php pages. I mean I get the idea behind the function you wrote, but how exactly would I get the output/ where would I see it? Sorry.
^ well, you can add that content in a new file, save it as toplikes.php & upload it to the main folder of your forum.
if you visit yourforumurl/toplikes.php with web browser then the file should show the result.
(2014-08-10, 04:55 PM).m. Wrote: [ -> ]^ well, you can add that content in a new file, save it as toplikes.php & upload it to the main folder of your forum.
if you visit yourforumurl/toplikes.php with web browser then the file should show the result.

I saved this file

<?php
define("IN_MYBB", 1);
define("NO_ONLINE", 1);

require_once "./global.php";

$query = $db->query("SELECT l.pid, count( * ) AS likes, p.subject, p.username, p.uid
                            FROM `mybb_g33k_thankyoulike_thankyoulike` l
                            LEFT JOIN `mybb_posts` p ON l.pid = p.pid
                            GROUP BY l.pid
                            ORDER BY likes DESC, l.pid ASC
                            LIMIT 100");

while($data = $db->fetch_array($query))
{
    echo '<br />Post #<a href="/showthread.php?pid='.$data['pid'].'#post_'.$data['pid'].'">'.$data['pid'].': '.$data['subject'].'</a>
    by <a href="/member.php?action=profile&uid='.$data['uid'].'">'.$data['username'].'</a> with '.$data['likes'].' likes.';
} 
output_page($html);
?>

But I get nothing but white screen.
Any help with making that php file work? Smile
I use a lot this plugin on 1.6 version..I'll can use it also on 1.8 version?
Or there is another plugin similar?
I would like to have an alert with: likes and thanks in the posts, @ mention
Euan T created one that I personally prefer better, and it has already been updated for 1.8.

http://community.mybb.com/mods.php?action=view&pid=24
Waiting for this plugin to be updated for 1.8.
(2014-09-02, 08:08 PM)HolyPhoenix Wrote: [ -> ]Euan T created one that I personally prefer better, and it has already been updated for 1.8.

http://community.mybb.com/mods.php?action=view&pid=24

If I start to use this: http://community.mybb.com/mods.php?action=view&pid=24 all old thanks, likes etc will be eliminated? Undecided