News:

Join the Facebook Fan Page.

Main Menu

Best Answer

Started by Avalanche91, December 05, 2013, 09:09:24 AM

Previous topic - Next topic

margarett

#100
In order to do that you must create such a permission (not terribly difficult) and use allowedTo('your_new_permission_here'). But you should do that in Sources, not in template (if you do it in Sources, you can easily pass it to template via $context)

edit: fixed typo
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

diegolyanky

Avalancha:

Gracias por responder ( THANKS FOR YOUR REPLY )

Yes, but the question is:

What sintax must I use ?....

I tried with:  $context ['group_id'] == '5' ... BUT DON'T WORK...

if (($context['topic_starter_id'] == $context['user']['id'] || $context['user']['is_mod'] || $context ['group_id'] == '5' || $context['user']['is_admin']) && $message['id'] !=


I need the sintax for using that strings.

Some idea ?

Margarett:

Thanks for your reply...

But, I don't know where and what code is... lol
SMF ... SimpleMachines ... Simple, but complete if you want it ;)

Avalanche91

Margarett's solution seems legit and is probably how it should be done. But unfortunately I still haven't read and don't know how to do it like that.

This is how the membergroups usually look like:

mysql> SELECT id_group,group_name FROM smf_membergroups;
+----------+------------------+
| id_group | group_name       |
+----------+------------------+
|        1 | Administrator    |
|        2 | Global Moderator |
|        3 | Moderator        |
|        4 | Newbie           |
|        5 | Jr. Member       |
|        6 | Full Member      |
|        7 | Sr. Member       |
|        8 | Hero Member      |
+----------+------------------+

So what you can do is to hardcode the ID of the group. Something that I do not really recommend. I will be glad if someone helps you do the thing that margarett suggested.

Arantor


diegolyanky

Quote from: Sir Cumber-Patcher on January 10, 2014, 03:01:25 PM
*whistle* http://www.simplemachines.org/community/index.php?topic=345127.0

I have 1.1.19 --- That's for 2.0

Thanks !!

Avalanche91:

I don't know how...

If I find the solution, I'll post it here.

Thanks !!!

SMF ... SimpleMachines ... Simple, but complete if you want it ;)

telles0808

Any chance of get the best answer post and show it on the first position?

Also, would be nice to make a BIG "Best Answer" button on the topic description, like IPB did.

BTW, thank you, this is an amazing mod!

ScrumpyJack

I was using this mod but it seems to have recently broken.

I've uninstalled it via package manager but it is still leaving the 'Best Answer' button on each topic.

Is there anyway to remove this so that people don't click on it?

I've uninstalling and reinstalling the mod a couple of times but it causes a error in one of the sources files.

The mod itself reports everything as successful when it is installing.

I managed to get rid of that error but now the button takes people through to the Fatal Error screen.

Thanks

Lee
:)

Avalanche91

Hello Lee,

I am very sorry to hear that you have some problems with my mod. By the looks of it, there is most probably some sort of conflict between my mod and another one that is already installed. So what has happened is that you have partially removed the mod; the presentation files still contain unnecessary code.

I assume that you are using version 2.X; please note if I am mistaken. In other to fix that you will have to manually modify some of the files. You can find all the changes the mod is performing to your forum in YourSmfFolder/Packages/BestAnswer-v1.4/modification-2.0.xml. The file responsible for displaying the posts is located in YourSmfFolder/Themes/YourCurrentTheme/Display.template.php, so open up both this file and modification-2.0.xml. In the second named file, scroll down to line number 92, and copy the code between the CDATA tags (<![CDATA[COPYME]]>). Then head back to the other file, start searching in the file (CTRL + F in most text redactors) and paste the code. Then look back to the modification file, and check if the code on the next line (that one in the add tags) can still be found in your Display.template.php file. If so, please remove it. Continue the same procedure until the code is all clear.

Should you have any other problems and/or questions, please make sure you tell me. And also, I would like to know what other mod packages you are using, thank you.

ScrumpyJack

Hi Avalanche,

Thanks...I'll give this a go later this afternoon.

There was an issue with my forum which meant I had to copy over all of the source files from my back-up location.

This is what I think broke the mode.

When I tried to re-install it, I think the error was on line 413, when clicking into a post...so you couldn't actually get to the post if that makes sense.

Due to the copying over of files...I think some of my mods are installed...but the package manager doesn't actually show them as being installed if that makes sense, so it's hard to be sure which ones are all definately installed ok.

The mod mentioned something about a database error...so perhaps it isn't creating the table in MyPHPAdmin correctly?

Is there a way to recreate that?

Thanks

Lee
:)

Kindred

Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Paffman

#110
Hi all,

First off great mod :D

I have just installed it, but when you use it and list the topic, the icon/picture (go_to_best_answer.gif) on the RHS is broken. Have I overlooked something? Where can I find the .gif to put where it should be?

[Edit] I have found where the go_to_best_answer.gif should go and have copied it there, all OK now. Wonder why it didn't install there?

Thanks again.

littlenicki

Hello, I installed this fine looking mod on my SMF 1.1.19 but it gives me a blank screen when going to messageindex.template.php

Any hints? Thank you!
Fomer SMF user. Switched to Invision Power Board and VBulletin

margarett

Check your PHP error log (not SMF log) for the cause of this white screen
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Impsat-1

Ufff!!!... great MOD Avalanche91, Thanks.... I have a SMF 2.0.7 and work fine on default template, thanks again.... :)

Thanks & Regards
Have a Great Time 8).-
Vive Cáda Momento De Tu Vida Como Si Fueras a Irte Mañana, Más Planificala Cómo Si Jamás Fueras a Irte ;).-

Biology Forums

Is there any way of connecting this mod to the topic solved mod, so that when a post is picked as the best answer, it automatically converts the topic as solved?

Alex_Ita

I report a little bug:

Every account can be in one group (primary) or two/more groups (secondary)
mod works well on primary group , but the mod doesn't work on the secondary group.

Any suggest?

Best regards

Skaty

it can be great to show members in simple portal block. best anwerers :)

user86

Hello,

thank you for this very good mod! I'm using it on SMF 1.1.19 but expirience a database error. When restoring deleted post from the recycle bin I get this error message:

Quote
Unknown column 'Array' in 'where clause'
File: /var/www/clients/client0/web1/web/smf/Sources/SplitTopics.php
Line: 991

Here is my code from splittopics.php. I have marked the line causing the error in bold.

// We're off to insert the new topic!  Use 0 for now to avoid UNIQUE errors.
db_query("
INSERT INTO {$db_prefix}topics
(ID_BOARD, ID_MEMBER_STARTED, ID_MEMBER_UPDATED, ID_FIRST_MSG, ID_LAST_MSG, numReplies, isSticky)
VALUES ($ID_BOARD, $split2_firstMem, $split2_lastMem, 0, 0, $split2_replies, $isSticky)", __FILE__, __LINE__);
$split2_ID_TOPIC = db_insert_id();
if ($split2_ID_TOPIC <= 0)
fatal_lang_error('smf273');


// If the best answer was amongst these posts that were moved, we have to move the best best answer as well
$query = db_query("SELECT id, id_msg FROM {$db_prefix}best_answer WHERE id_msg IN ($splitMessages)",
__FILE__, __LINE__);
if (mysql_num_rows($query) == 1) {
$data = mysql_fetch_row($query);
if ($data[1] == $splitMessages[0]) {
// The question cannot be an answer!
db_query(
"DELETE FROM {$db_prefix}best_answer WHERE `id`=$data[0]",
__FILE__, __LINE__
);
} else {
// Now that we are moving stuff, it's time for the best answer to be moved
db_query(
"UPDATE {$db_prefix}best_answer SET ID_TOPIC = $split2_ID_TOPIC WHERE id = $data[0]",
__FILE__, __LINE__
);
}
}
mysql_free_result($query);
$data = null;

// Move the messages over to the other topic.
$new_subject = $func['htmlspecialchars']($new_subject);
db_query("
UPDATE {$db_prefix}messages
SET
ID_TOPIC = $split2_ID_TOPIC,
subject = '$new_subject'
WHERE ID_MSG IN ($postList)
LIMIT " . ($split2_replies + 1), __FILE__, __LINE__);



It's this line of code:

$query = db_query("SELECT id, id_msg FROM {$db_prefix}best_answer WHERE id_msg IN ($splitMessages)",
      __FILE__, __LINE__);


The message get restored. But the error pops up.

Can you please suggest what I should change in order to make it work again? Thank you!

user86


user86

Also Split Topics is now no longer working ... please kindly help. Thank you!

Advertisement: