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.
Thanks a lot carliv.

this very useful for me.

Thanks. Wink
I'm glad for you! Smile
Some users on my forum accidentally discovered a race condition which allows someone to like a post multiple times - there is a millisecond (or so) long window between checking for an existing like and inserting the like. Under the right conditions (The first few times it happened it was accidental) or with a flood of requests a post can end up with two likes from one user.

The solution was to change the index on (pid, uid) to a unique key as opposed to just a plain ol' index.

I've attached a patch for inc/plugins/thankyoulike.php so it will create the unique key on install.
[attachment=31553]

If you've already got it installed the following queries (changing table names where needed) will replace the index with a unique one:

ALTER TABLE `mybb_g33k_thankyoulike_thankyoulike` DROP INDEX `pid`;
ALTER TABLE `mybb_g33k_thankyoulike_thankyoulike` ADD UNIQUE INDEX `pid` (`pid`, `uid`);

Note that I've not yet worked on adding a graceful way of handling an error on the insert (It just throws an error and the user never gets a message saying the post was already liked).
(2014-02-11, 03:32 PM)Tallon Wrote: [ -> ]Also, the thanks are not appearing below the post to show that it has been thanked

I'm using a custom theme
I had this same issue with the Thanks system not appearing in the 2.0_Inspired theme at all.

In the Admin CP > Configuration > Thanks - I kept the last setting "Separate table" set to On.

Then in Templates & Styles > Templates > 2.0_Inspired (or your custom theme name) > Postbit Templates > postbit_classic - I added the following piece of code at the very end of the file after the closing table tag:

{$post['thxdsp_outline']}

This might not be the best way to accomplish this but it worked for me.
How to use this mod with hide until thanks? Or is there any way? Thank you

http://community.mybb.com/thread-69096-page-3.html
(2013-10-28, 09:19 AM)Dannymh Wrote: [ -> ]I am having the issue with "loading" when clicking thank you on the mobile theme of my site the javascript seems to be correct. Works fine on the normal version of my site.

This was working fine until I upgraded to 1.6.11 and had to reinstall the script.

Any thoughts on this?

Cheers
Dan

####FIXED###

Had to add the postbit part. The script was looking for "</tbody>" but because the mobile theme uses div it was never placed.

Added it manually as divs instead of tr's/td's and it now works

This worked perfectly. Thanks
@Eldenroot

There is a mod like this maded by me.

Thank You MyBB System + Re + MyAlerts

That mod includes hide tag and use AJAX and have more ots like this.
Any easy way to change "like" to something else like "Downloaded"?
i have installed this but it now showing in plugin area in mybb admin panel .
^ check (again) the installing instructions available at the plugin page

@HeyyYouu : this plugin's main purpose is to encourage the poster for the post content.
if like / thanks is changed to something else then the main purpose doesn't fulfill