1.6 Compatible: Simple Like System
Ok Thanks if you say so it would be fine Happy
Give me the details here please for other users who want do it too. Happy
Reply
Sure thing Happy

The following will get a total count of the number of likes posts within a thread of tid 14 have received:

PHP Code:
SELECT COUNT(*) AS total FROM mybb_post_likes pl INNER JOIN mybb_posts p ON (pl.post_id p.pidWHERE p.tid 14
Reply
I want to make a top 10 of posts based on number of likes, I left this mysql call, What I need to do for that?

ORDER BY number likes

that´s the big deal

Code:
$wkpf = $db->query("
SELECT t.tid, t.subject, "likes_pid"
FROM ". TABLE_PREFIX ."threads t
LEFT JOIN ". TABLE_PREFIX ."likes lk ON (lk.post_id = p.pid)
WHERE t.fid IN ($wpidf)
ORDER BY "number of likes" DESC
LIMIT $limitwkpf ");

I don´t really know how to do this, my idea was that simple_likes had a system that added +1 or -1 in mybb_threads at same time that when user push like or dislike with jQuery or another function, I´m not so good with php so What do you think?
Reply
Ah, you would definitely need to make a few alterations to the plugin then. You'd have to add a new column to the mybb_threads table and update the table within the current hook. I'll consider adding it as functionality to the next release.
Reply
something like this?

Code:
<?php



if ($mybb->input['action'] == "like") {
    

$tid= $_GET['tid'];

$likequery = $db->query("
SELECT t.likes
FROM ". TABLE_PREFIX ."threads t
WHERE t.tid=$tid ");
while ($liket = $db->fetch_array($likequery)) {
$num_likes = $liket['likes'];
}

$suma = $num_likes + 1;

$uplikes = $db->query("
UPDATE t.threads
SET likes=$suma
FROM ". TABLE_PREFIX ."threads t
WHERE t.tid=$tid ");


}

jQuery("#t").click(function(){        

jQuery.post( "http://(url)/like.php?action=like&tid={$tid}" );

});

?>
Reply
Yeah, something like that though you could probably just run an update on the threads table and increment the count by 1 rather than querying for it Happy
Reply
Great Euan, I hope that you make an update of your plugin because the plugin is great Happy
That update is important, don´t you think? Happy

I´ll glad if you send me a PM with your Facebook or another social network for chat I have another ideas with your plugins like FollowMe I have an Activity feed running on my site (that I´m developing) it works with the buddy system of mybb, but I want implement your plugin Simple Like system on this, We need to chat please Happy
Reply
does this work with myalerts?
Reply
(08-01-2014, 10:51 PM)sn4g Wrote: does this work with myalerts?

Sure does. It exclusively works with myAlerts - there's no other notification system when you receive a like.
Reply
I'm trying to change the like and unlike to an image. I've found out how to change the like to an image, but I cannot seem to figure out how to change the unlike to an image.


Home » Template Sets » Templates Edit Template: simplelikes_likebutton

Code:
<a href="xmlhttp.php?action=like_post&amp;post_id={$post['pid']}&amp;my_post_key={$mybb->post_code}" class="btn_like" id="likeButton_post_{$post['pid']}"><img src="http://www.facerig.us/images/accord-autumn/like.png"/></a>


Can you help me change the unlike image now? I already have an unlike icon made http://www.facerig.us/images/accord-autumn/unlike.png
Reply