News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Say Thanks

Started by kelvincool, August 30, 2014, 05:16:29 PM

Previous topic - Next topic

Romanj

I've tested and compared several similar mods. This one appeared best for my needs. Good, simple and stable (at least seems stable).
I'm going to use it on a working project. So I keep in mind there is a chance some day in future I'll move to SMF 2.1 hopefully.
Thanks (or likes) it is a kind of user data. It is a good idea to keep them while moving to a new engine version.

I dont know will this mod be available for 2.1 or not. So I want to make sure I will able to convert this "thanks" to inbuilt "likes" of 2.1.
I've checked and compared database tables for thanks of this mod and inbuilt 2.1 likes system. I found they are pretty much similar.

Say Thanks main table "smf_messages_thanks" columns:
id_msg   |   id_member

SMF 2.1 likes main table "smf_user_likes" columns:
content_type   |   content_id   |   id_member   |   like_time

id_msg = content_id. "content_id" - contains "msg" for all messages.
The only difference - in 2.1 there is additional column - time_like. The time when like was given.
So I'd like to save this data while using Say Thanks mod. With this I would have full data needed for 2.1 convertation in some future.

How to record "like_time" to DB:
Please tell me if this code is correct. I've checked and it works fine. Though I'm not a php-mysql pro, so I don't know if this 100% correct.

in SayThanks.php find:
$smcFunc['db_insert']('ignore' ,
'{db_prefix}messages_thanks',
array(
'id_msg' => 'int', 'id_member' => 'int'
),
array(
$msg, $user_info['id']
),
array('id_msg','id_member')
);


replace with:
$smcFunc['db_insert']('ignore' ,
'{db_prefix}messages_thanks',
array(
'id_msg' => 'int', 'id_member' => 'int', 'like_time' => 'int'
),
array(
$msg, $user_info['id'], time()
),
array('id_msg','id_member','like_time')
);


Column "like_time" at "smf_messages_thanks" table could be created manually with phpMyAdmin. Or by changing code at add_settings.php before first installation.


Ideas for author of this beautiful mod, how to make it even better:

- If you also add time of thanks column, it would be possible to add "most thanked post of the day" or "most thanked post of the week" functions.
- Ability to choose the groups of users who can and can't give thanks. Just to prevent manipulations when "fake" users with no posts give a lot of thanks.

pocttopus

Hello folks,

I have an issue with this mod and I want to fix it. Forum version: 2.0.13 Mod version: 1.3.6
The mod is working actual, but in the administration panel it says that I can only delete the files from the server and there is red notification.
I went to delete it and again to install from beginning, but after that I need to replace some code in the "Profile.template.php" file.

The issue is that the code is not there to be replaced. Here is what I need to do:



How can I solve this because I am making a migration of the forum to other host. When I run the forum locally the posts are missing. For now, I want to fix the issues when I am going to contact the support of the new host.
« Reply #1460 on: March 08, 2017, 09:13:24 am »

Fatal error: Class 'SayThanks' not found in D:\xampp\htdocs\smf\Sources\Load.php(2266) : eval()'d code on line 460

aetherdan

Hi,

Would like to report a bug, can grant myself unlimited likes.

index.php?action=thank;msg=3580;member=273;topic=88

change the "msg=3580" to any number and continuously get thanks.

Tested it out and it will even work for post that haven't even been created yet.

aetherdan

I assume this mod is no longer supported.

pocttopus

Quote from: aetherdan on March 30, 2017, 03:21:26 AM
I assume this mod is no longer supported.
I think you're right!  :(

GL700Wing

Quote from: aetherdan on March 22, 2017, 06:06:39 AM
Would like to report a bug, can grant myself unlimited likes.

index.php?action=thank;msg=3580;member=273;topic=88

change the "msg=3580" to any number and continuously get thanks.

Tested it out and it will even work for post that haven't even been created yet.
I must admit I would consider it highly unusual for a member to continually edit a URL string to boost the 'Thanks' count of another user.

That said the following code change should prevent this happening (it works on a test forum I've created - the member's 'Thanks' count doesn't increase and the message ID of the non-existent post isn't added to the database).

In the file ./Sources/SayThanks.php

Find:
if (empty($msg) || empty($topic) || empty($member) || (!empty($msg) && SayThanks::isPostOwner($msg))) {

Replace with:

// Make sure the post being thanked actually exists
$request = $smcFunc['db_query']('', '
SELECT id_member, id_topic
FROM {db_prefix}messages
WHERE id_msg = {int:id_msg}',
array(
'id_msg' => $msg,
'id_topic' => $topic,
'id_member' => $member,
)
);
$info = $smcFunc['db_fetch_row']($request);
$smcFunc['db_free_result']($request);

if (empty($info) || empty($msg) || empty($topic) || empty($member) || (!empty($msg) && SayThanks::isPostOwner($msg))) {
Life doesn't have to be perfect to be wonderful ...

dansal

Hi, great mod!!

I dont see here how list the last thanks of all users, ¿its possible?

kim_c

The thanks string under posts is showing up twice, any idea why? Thanks

kim_c

Is this mod no longer supported?  :-\

Novice

I'd like to know the answer to that one myself. I just need it to function correctly in 2.0.15 as it did in versions previous to 2.014.

jack001

just installed it on my forum and works nice. Would like to have highest 3 thank you receiver on info center. How can i do that?
https://www.edufor.xyz Edutainment forum - Education with Entertainment!

kim_c

Quote from: jack001 on January 19, 2018, 05:39:56 AM
just installed it on my forum and works nice. Would like to have highest 3 thank you receiver on info center. How can i do that?

Mod is no longer supported so you probably won't receive an answer  :(

dekatria

I have migrated my forum to new folder and new domain.
The stats are there and the option to thank, but when I press the "say thanks" link, it doesn't work - it goes on "loading mode" indefinitely.

Would uninstalling and reinstalling the mod be a good idea?

-Rock Lee-

Quote from: dekatria on July 24, 2018, 08:14:06 AM
I have migrated my forum to new folder and new domain.
The stats are there and the option to thank, but when I press the "say thanks" link, it doesn't work - it goes on "loading mode" indefinitely.

Would uninstalling and reinstalling the mod be a good idea?

What I can think of is that the route is wrong to move it, it would be good to uninstall it and reinstall to correct this, otherwise it would be to look for the wrong route.

Regards!
¡Regresando como cual Fenix! ~ Bomber Code
Ayudas - Aportes - Tutoriales - Y mucho mas!!!

dekatria

I tried to uninstall and all hell broke lose.

I got the  theme_template_error

Hopefully the automatic backup saved me.

Then I tried to manually uninstall, error again.
Tried to reinstall, error again (class SayThanka ALREADY DEFINED IN SOURCES/SAYTHANKS.PHP etc.)

Now I'm stuck with a neither removed nor installed mod that doesn't work and when I try to either install or remove I get an error.

For example I have manually reversed all modifications to the files. But when I try to delete the additional files added by the mod I get an error, although the mod was not installed according to admin panel.

I believe it must be a modification in the db that causes the error and that while the theme is not installed the db asks for some file. I attack the add_settings.php which installs the mod and the remove_settings.php in case anyone would like to take a look and help me.

dekatria

I have manually reversed all the changes and the package appears as not installed. But when I try to manually delete the SayThanksTemplate.php files I get an theme_template_error.

I believe something is requesting these files though the package appears as not installed.

-Rock Lee-

At the moment of removing it, you have to extract the information from the database and it seems that there is some restro, try using the fix_packages to erase everything else. Also try to make a backup before touching any file ... I will try to do a local tests to see if I can reproduce the error and tell you more safe to do, sorry not to help more at this time.


Regards!
¡Regresando como cual Fenix! ~ Bomber Code
Ayudas - Aportes - Tutoriales - Y mucho mas!!!

dekatria

Thanks.

I would like someone who knows php to tell me what the install/uninstall files do, so I can do it manually.
Because when I delete the additional files manually I get an error.

-Rock Lee-

By doing so it automatically removes it from several places without problems to the contrary manually does not remove all the code at one time generating an error ... Since there is a variable you are making this call to what you got, you would have to remove everything completely and if the error still persists, something must be removed or it was not removed correctly!


Regards!
¡Regresando como cual Fenix! ~ Bomber Code
Ayudas - Aportes - Tutoriales - Y mucho mas!!!

dekatria

When I try to re-install the package I get the error:

Fatal error: Cannot declare class SayThanks, because the name is already in use in /home/xxx/public_html/domain.com/Sources/SayThanks.php on line 17

Advertisement: