The latest "likes/thanks"?
#1 16-02-2016 
Hi Lee,

do you know how to get the latest "likes/thanks" with Thank Like system plugin? http://community.mybb.com/thread-169382.html (I have 1.9.8 version)

Like the latest threads but only about the latest likes/thanks, for example:

UserXY liked "Thread XYZ" (date)

ecc

In database, in the table mybb_g33k_thankyoulike_thankyoulike I have:

[Image: SvbY2U2.png]

but I don't understand what's tlid, pid, uid, puid.. I thought were about tid number of each thread in the forum, but I haven't likes/thanks in those threads.. Huh

Thank you Blush

#2 16-02-2016 
It looks like when the thanks is added it is per post. You can in theory make a second plugin to get back the number of likes per thread, but that would be a join on the posts table from the thank you like table. Alternatively, you could ask the plugin authors for it to be added - they need to record the thread id AND the post id in the thankyou like table.

EDIT: I looked in the github code;

Code:
if(!$db->field_exists('tyl_tnumtyls', 'threads'))
    {
        $db->query("ALTER TABLE ".TABLE_PREFIX."threads ADD `tyl_tnumtyls` int(100) NOT NULL default '0'");
    }

This implies that there is a column in your thread table called tyl_tnumtyls and that is the one you should be looking for.

#3 16-02-2016 
Hi, thanks. In `mybb_threads` I have `tyl_tnumtyls` but there is only the number of thanks Sad

For example: 48 thanks on the thread (I use Thank you Like plugin only for thanks on first post)

I tried to ask here: http://community.mybb.com/thread-164125-...pid1189859 but they answered me to add another db query.

GitHub: https://github.com/SvePu/TYL-TopList

In the TYL -TopList plugin there is:

Code:
$tul = $db->query("SELECT l.pid, count( * ) AS likes, p.subject, p.username, p.uid, p.fid, p.tid, u.usergroup, u.displaygroup
                                    FROM ".TABLE_PREFIX."g33k_thankyoulike_thankyoulike l
                                    LEFT JOIN ".TABLE_PREFIX."users u ON (l.puid=u.uid)
                                    LEFT JOIN ".TABLE_PREFIX."posts p ON (l.pid=p.pid)
                                    WHERE visible='1' {$tyltoplist_unviewwhere} {$tyltoplist_fidsoutlist}
                                    GROUP BY l.pid
                                    ORDER BY likes DESC, l.pid ASC
                                    LIMIT 0,{$settings['tyltoplist_limit']}");

Uhm, I have to before understand how to work this plugin, I try it on a test forum

EDIT: I think this plugin would be ok, need only change from "most thanked/liked posts" to the latest thanked/liked posts + add dateline (ORDER BY dateline DESC?) but:

- dateline will be still in 1346531653 etc or in normal date format?
- how to add the user who thanked/liked the post? It should be in mybb_g33k_thankyoulike_thankyoulike but it's puid or uid?

#4 16-02-2016 
Leeeeeee Leeee, works!

Code:
$query = $db->query("
        SELECT l.pid, p.subject, p.username, p.uid, p.fid, p.tid, u.usergroup, u.displaygroup, l.dateline
        FROM ".TABLE_PREFIX."g33k_thankyoulike_thankyoulike l
        LEFT JOIN ".TABLE_PREFIX."users u ON (l.puid=u.uid)
        LEFT JOIN ".TABLE_PREFIX."posts p ON (l.pid=p.pid)
        WHERE 1=1 AND p.fid IN ('143')
        ORDER BY l.dateline DESC
        LIMIT 0, 10
");

while($vinto = $db->fetch_array($query))
        {
            $vinto_title = htmlspecialchars_uni($vinto['subject']);
            $vinto_user = htmlspecialchars_uni($vinto['uid']);
            $vinto_postlink = get_thread_link(intval($vinto['tid']));
            $vinto_created = my_date($mybb->settings['dateformat'], $vinto['dateline']).", ".my_date($mybb->settings['timeformat'], $vinto['dateline']);
            eval("\$vinto_gallery_gallery .= \"".$templates->get("vinto_gallery_gallery")."\";");
        }
        
eval("\$vinto_gallery = \"".$templates->get("vinto_gallery")."\";");

And the result is:

Title of the thread
date: date with right format, when a user clicked on "Thank you"
Id of the thread starter Sad For example user number 392 created the thread, so I have: 392 Sad I would like the user who clicked on Thank you..

#5 16-02-2016 
Do you want this visible to the users?

#6 16-02-2016 
Yes, so users can see if other users have clicked on Thank you on a thread

#7 16-02-2016 
Ok, we got it to work, case closed.

#8 16-02-2016 
Thank you Lee :*



Sorry, that is a members only option