Simple Machines Community Forum

Customizing SMF => Modifications and Packages => Topic started by: SychO on November 02, 2020, 03:03:16 PM

Title: Best Answer
Post by: SychO on November 02, 2020, 03:03:16 PM
Link to the mod (https://custom.simplemachines.org/index.php?mod=4274)

✓ Best Answer
(https://img.shields.io/github/release/SychO9/smf-best-answer.svg?style=flat-square) (https://img.shields.io/badge/SMF-2.1-blue.svg?style=flat-square&color=ed6033) (https://img.shields.io/badge/license-MIT-green.svg?style=flat-square&color=green) (https://img.shields.io/badge/donate-buy%20me%20a%20coffee-%23ffde39?style=flat-square) (https://www.buymeacoffee.com/sycho)

SMF2.1 mod to mark a reply as best answer.

Requires PHP7.3+

(https://user-images.githubusercontent.com/20267363/96333331-2004f500-1061-11eb-8018-7e07af4427a3.png)

Installation
Download the latest release package and upload in the package manager of your forum.

Updating
Delete the mod and install a new release package.

License
The MIT License.
Title: Re: Best Answer
Post by: Arantor on November 02, 2020, 03:06:26 PM
Suggestion: put a PHP version test inside database.php and don't allow it to install if PHP 7.2 or lower is present.
Title: Re: Best Answer
Post by: SychO on November 02, 2020, 04:08:58 PM
Good call
Title: Re: Best Answer
Post by: Bigguy on November 02, 2020, 08:51:04 PM
Very nice lookin mod. Would be good on SMFH.
Title: Re: Best Answer
Post by: pocttopus on November 03, 2020, 04:06:02 AM
Very nice mod but I have issues. I don't have the button to mark best answer and also I have these errors in admin panel which suddenly have raised for 2000 in a couple of minutes on 2.1RC3:

FIRST ERROR:
Type of error: Undefined
8: Undefined index: id_best_msg

/home/XXXX/public_html/Sources/BestAnswer/Actions.php (Line 43)

SECOND ERROR:
Type of error: Undefined
8: Undefined index: id_board

/home/XXXX/public_html/Sources/BestAnswer/Policy.php (Line 36)
Title: Re: Best Answer
Post by: SychO on November 03, 2020, 04:49:10 AM
Have you made any custom modifications to the source code ?
What mods do you have installed ?
What's your php version ?
Title: Re: Best Answer
Post by: pocttopus on November 03, 2020, 05:02:16 AM
No, I have only changed the css, using the main theme but with different colors changed by myself.
This is the php ver.

(https://i.postimg.cc/PxJZbC8n/Screenshot-194.jpg)
Title: Re: Best Answer
Post by: SychO on November 03, 2020, 05:03:59 AM
so no other mods ?
Title: Re: Best Answer
Post by: pocttopus on November 03, 2020, 06:09:49 AM
Sorry, here is the list:

Optimus    2.9 [04.06.20]
Scrolling Buttons    0.6
Login Menu Button    1.0
BBC Message Boxes    1.0
Light Portal    1.2
Social Login    4.0.0
Login Security    1.0.4
SMF Post Prefix    3.2.1
FA Board Icons    1.3
Avatars Display Integration    1.2
Quick Spoiler    1.2.6
Welcome Topic Mod
Simple Audio Video Embedder    5.1.4
Forum Width Setting    1.2
Personalized BBC    1.94.1
Auto Twitter Embed    2.0
Title: Re: Best Answer
Post by: SychO on November 03, 2020, 06:25:14 AM
Thank you, I am assuming one of those mods is perhaps overwriting a certain array given to a hook instead of mutating it, resulting in the errors mentioned. I will have to take a look in each and everyone of them, so for now just uninstall this mod.

Or maybe it has nothing to do with other mods and it's just a specific scenario where this mod fails. Either way I'll have to investigate it.
Title: Re: Best Answer
Post by: SychO on November 03, 2020, 10:44:25 AM
@pocttopus please try the 0.1.3 package, I think the issue was with the mod not properly appending to the array, conflicting with other mods.
Title: Re: Best Answer
Post by: pocttopus on November 03, 2020, 10:56:38 AM
It Works!
Thanks @Sycho.
This is awesome.  ;)
Title: Re: Best Answer
Post by: pocttopus on November 04, 2020, 08:31:18 AM
Now it's updated to 0.1.5?
What's new @SychO?  O:)
Title: Re: Best Answer
Post by: SychO on November 04, 2020, 09:14:10 AM
You can always checkout the changelog here: https://github.com/SychO9/smf-best-answer/releases
Title: Re: Best Answer
Post by: Bigguy on November 04, 2020, 09:33:16 AM
I guess I will re-install it, lol. I just finished doing that like 5 minutes ago. :)
Title: Re: Best Answer
Post by: vbgamer45 on November 04, 2020, 09:35:11 AM
Great idea for a mod!
Title: Re: Best Answer
Post by: Bigguy on November 04, 2020, 09:36:47 AM
Getting an error:

Trying to access array offset on value of type null
Title: Re: Best Answer
Post by: SychO on November 04, 2020, 09:50:56 AM
what line of what file ?
Title: Re: Best Answer
Post by: Bigguy on November 04, 2020, 10:53:21 AM
Line 28 of BestAnswer.template.php
Title: Re: Best Answer
Post by: SychO on November 04, 2020, 11:39:35 AM
Should be fixed in the new 0.1.6 package, please test :)
Title: Re: Best Answer
Post by: Bigguy on November 04, 2020, 11:59:38 AM
I will do that now, thank you sir.
Title: Re: Best Answer
Post by: Bigguy on November 04, 2020, 12:03:01 PM
That's got it. Thanks for the quick response. :)
Title: Re: Best Answer
Post by: SychO on November 04, 2020, 12:06:37 PM
Awesome, thank you :)
Title: Re: Best Answer
Post by: Bigguy on November 14, 2020, 08:55:43 PM
I have an issue with this mod again. I tried to mark a post as best answer, but when I do it gives me a white page....no errors at all in the logs. If I uninstall the mod the white page goes away and the topic behaves normal. I have edited the css on the site but I do not think that would effect it.
Title: Re: Best Answer
Post by: SychO on November 15, 2020, 02:44:22 AM
Is there nothing on your server error log ? What php version are you using ? Can you post a link to the topic ?
Title: Re: Best Answer
Post by: Aleksi "Lex" Kilpinen on November 15, 2020, 03:27:55 AM
Cool mod, if I may suggest, the mod description could be a bit more descriptive though. For a while there, I was wondering how this actually functions, permissions and all -
Simple to set up, if you know how, but takes a minute to figure out if you just randomly happened across this package like me :P
The board settings are easy, as the install redirects to them - but after that, there's no indication that there's a permission setting added too ;)
Title: Re: Best Answer
Post by: Bigguy on November 15, 2020, 09:13:59 AM
Quote from: SychO on November 15, 2020, 02:44:22 AM
Is there nothing on your server error log ? What php version are you using ? Can you post a link to the topic ?

No errors anywhere. I will check cpanel after I re-install it. I was going through old topics and trying to pick the answer to some of them. I got a few marked as best answer but when I tried one of them it went to a white screen. I will check again here soon.
Title: Re: Best Answer
Post by: SychO on November 15, 2020, 09:22:34 AM
seems like certain topics with specific criteria fail, I can't think of why since I haven't been able to reproduce this.

Quote from: Aleksi "Lex" Kilpinen on November 15, 2020, 03:27:55 AM
Cool mod, if I may suggest, the mod description could be a bit more descriptive though. For a while there, I was wondering how this actually functions, permissions and all -
Simple to set up, if you know how, but takes a minute to figure out if you just randomly happened across this package like me :P
The board settings are easy, as the install redirects to them - but after that, there's no indication that there's a permission setting added too ;)

Yea could use improvement.
Title: Re: Best Answer
Post by: Bigguy on November 15, 2020, 10:29:19 AM
Quote from: SychO on November 15, 2020, 09:22:34 AM
seems like certain topics with specific criteria fail, I can't think of why since I haven't been able to reproduce this.

I have no idea what was in that topic. If I find it again maybe it'll shed some light on the matter. I'll see in a bit. I have to go out soon.
Title: Re: Best Answer
Post by: SilverKnight on December 31, 2020, 01:45:21 AM
Any love for a 2.0 version?
Title: Re: Best Answer
Post by: SychO on December 31, 2020, 04:28:59 AM
Quote from: SilverKnight on December 31, 2020, 01:45:21 AM
Any love for a 2.0 version?

Certainly not from me.

But you can try this one, which seems to be compatible with 2.0 (have never tested it myself though): https://custom.simplemachines.org/mods/index.php?mod=3803
Title: Re: Best Answer
Post by: jsx on December 31, 2020, 04:36:28 AM
SychO,

It's nice that you created such a mod. :)

Let 2.1 finally be released. 8)
Title: Re: Best Answer
Post by: SilverKnight on January 18, 2021, 10:33:31 PM
Any chance of a 2.0 version?
Title: Re: Best Answer
Post by: SychO on January 19, 2021, 02:09:00 AM
I already answered that question
Title: Re: Best Answer
Post by: gevv on May 17, 2022, 10:41:10 AM
Hi,

Thanks @SychO

Turkish translation.
Title: Re: Best Answer
Post by: jsx on October 23, 2022, 06:01:14 AM
@SychO

Can you tell me where I can find these two settings? I don't see them in Permissions.

$txt['permissionname_mark_best_answer_any'] = 'Own topics';
$txt['permissionname_mark_best_answer_own'] = 'Any topics';
Title: Re: Best Answer
Post by: Steve on October 23, 2022, 06:34:54 AM
Go to either membergroup permissions or board permissions. Select a membergroup and it should be the fourth  from the bottom:

Screenshot 2022-10-23 at 05-33-17 Modify Group.png
Title: Re: Best Answer
Post by: jsx on October 24, 2022, 08:04:21 AM
@Steve

I ask because I translated this mod into my language and I don't see those two words right there in the permissions.
Title: Re: Best Answer
Post by: Diego Andrés on October 24, 2022, 08:55:56 AM
I see what you mean.
I believe they were added just for good measure in case the permission ever describes just 'any', or just 'own'. But that's on SMF.
Title: Re: Best Answer
Post by: jsx on October 25, 2022, 03:00:03 PM
Thanks for the clarification.