News:

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

Main Menu

Topic Solved Mod

Started by Grudge, March 07, 2004, 07:51:18 AM

Previous topic - Next topic

Grudge

Link to Mod

This is the first version of my topic solved MOD for SMF. This MOD allows you to select boards as "topic solved" boards. These boards will allow the topic started to ask questions and accept/reject answers to them. This is most useful on support boards. There are many settings that can be set up. Including message icons to indicate acceptance/rejection, and changing the background colour of the message to reflect topic starter as well as accepted and rejected messages. All "solved" topics will be marked in the message index with the "solved" topic icon.
I'm only a half geek really...

DoW Kid Rock

I have installed this, but can't figure out where to change the options

FaSan

On "Manage Board" --> "Add Board"  ;)

DoW Kid Rock

tried that and there is nothing there in the options.....really weird

FaSan

What language you use ? If is not english, you require add language lines in your language file  :)

DoW Kid Rock


Grudge

Are you 100% sure the install actually took place? Look in Modifications.english.php and verify that some "topic Solved" strings have been added...
I'm only a half geek really...

DoW Kid Rock

I can't seem to find the file you have mentioned.  I have looked in each directory, but it doesn't seem to be there. ???

DoW Kid Rock

ok I re installed the board fresh and the mod now works.  not sure why it didn't install before, but it is working.

is changing the background colour the only way you can see that the topic is solved or is there something I missed?

Grudge

the message icon should change to a tick too...
I'm only a half geek really...

SVT242

When the topic is deemed solved, is the thumbs up and locked topic (if that option is selected of course) the only indication that a topic is "SOLVED"?

Or... is there an actual icon that says "SOLVED" or is the topic automatically re-written to include [SOLVED] ?



-Thanks,

Chris
-Chris

Grudge

No, just the icon is changed. You can mod this yourself if you wish though, by changing the mod slightly. The subject could probably be done by doing something like
, subject = CONCAT('[SOLVED] ', subject)

In the icon update bit.
I'm only a half geek really...

Pause

But which file would that be in  ???
"You and me, inside that box, now." - The Doctor

Bite Fusion
Fusion Web Network
VG Fusion
Wrestling Fusion + Wrestling Fusion Forums

Grudge

In Post.php, replace this:

// Check user has permission to do this
$request = db_query("
SELECT m.ID_MSG, m.ID_MEMBER, m.topicSolved, m.subject
FROM {$db_prefix}topics AS t
LEFT JOIN {$db_prefix}messages AS m ON (m.ID_MSG = t.ID_FIRST_MSG)
WHERE t.ID_TOPIC = $topic
LIMIT 1", __FILE__, __LINE__);
list ($FIRST_MSG, $ID_MEMBER_POSTER, $firstSolved, $firstSubject) = mysql_fetch_row($request);
mysql_free_result($request);

if (strstr($firstSubject, '[SOLVED]') === false)
$firstSubject = '[SOLVED] ' . $firstSubject;

if ($ID_MEMBER != $ID_MEMBER_POSTER && !isset($user_info['is_admin']))
fatal_error("Hacker... ");

// If we are accepting
if ($accept == 1)
{
// Reset any previous accepts
db_query("
UPDATE {$db_prefix}messages
SET topicSolved = 0, icon = '$modSettings[topicsolvedIconOther]'
WHERE ID_TOPIC = $topic AND topicSolved = 1 AND ID_MEMBER != $ID_MEMBER_POSTER", __FILE__, __LINE__);
db_query("
UPDATE {$db_prefix}messages
SET topicSolved = 0, icon = '$modSettings[topicsolvedIconStarter]'
WHERE ID_TOPIC = $topic AND topicSolved = 1 AND ID_MEMBER = $ID_MEMBER_POSTER", __FILE__, __LINE__);
// Update top message
db_query("
UPDATE {$db_prefix}messages
SET topicSolved = 2, icon = '$modSettings[topicsolvedIconAccept]', subject = '$firstSubject'
WHERE ID_MSG = $FIRST_MSG", __FILE__, __LINE__);
}

With this:

// Check user has permission to do this
$request = db_query("
SELECT m.ID_MSG, m.ID_MEMBER, m.topicSolved
FROM {$db_prefix}topics AS t
LEFT JOIN {$db_prefix}messages AS m ON (m.ID_MSG = t.ID_FIRST_MSG)
WHERE t.ID_TOPIC = $topic
LIMIT 1", __FILE__, __LINE__);
list ($FIRST_MSG, $ID_MEMBER_POSTER, $firstSolved) = mysql_fetch_row($request);
mysql_free_result($request);

if ($ID_MEMBER != $ID_MEMBER_POSTER && !isset($user_info['is_admin']))
fatal_error("Hacker... ");

// If we are accepting
if ($accept == 1)
{
// Reset any previous accepts
db_query("
UPDATE {$db_prefix}messages
SET topicSolved = 0, icon = '$modSettings[topicsolvedIconOther]'
WHERE ID_TOPIC = $topic AND topicSolved = 1 AND ID_MEMBER != $ID_MEMBER_POSTER", __FILE__, __LINE__);
db_query("
UPDATE {$db_prefix}messages
SET topicSolved = 0, icon = '$modSettings[topicsolvedIconStarter]'
WHERE ID_TOPIC = $topic AND topicSolved = 1 AND ID_MEMBER = $ID_MEMBER_POSTER", __FILE__, __LINE__);
// Update top message
db_query("
UPDATE {$db_prefix}messages
SET topicSolved = 2, icon = '$modSettings[topicsolvedIconAccept]'
WHERE ID_MSG = $FIRST_MSG", __FILE__, __LINE__);
}


It won't unmark the subject if they mark the top as "unsolved" aftrwards, but I'm sure you can figure out how to do that if you need that (a strpos would do it), I'm too tired for that too :P
I'm only a half geek really...

eFishie

--Jon

Abstraction Point Electronic Music Community - We don't bite! Really! I promise!

Check out my newest song: Alive

Sixpack

I couldn't find anything on this, but I have a couple quick questions.

1. Is the Approve and reject function only enabled for Admin and the tpoic starter?

2. Is there a way to change to allow Global Moderators to use this function on enabled boards if they are by default not permitted to do so?
hxxp:www.theoscarspot.com [nonactive]

Grudge

I *think* I wrote it for admin permissions yes. To change this in Post.php (after install)
find:

if ($ID_MEMBER != $ID_MEMBER_POSTER && !isset($user_info['is_admin']))


To:

if ($ID_MEMBER != $ID_MEMBER_POSTER && !isset($user_info['is_admin']) && !isset($user_info['is_gmod']))


Then in display.template.php find:

if (($context['user']['started'] || $context['user']['is_admin']) && isset($context['topicSolved']))


and make:

if (($context['user']['started'] || $context['user']['is_gmod'] || $context['user']['is_admin']) && isset($context['topicSolved']))
I'm only a half geek really...

oscar2001

Ive tried modifying the files as above but to no avail :(
Something Im overlooking maybe in admin,permissions perhaps?

My global moderators are called Senior Members if that has any possible bearing on the situation.. I did change the name back to Global Moderator just to see on the off chance but it was a no go..

Any help would be great :)

Grudge

instead of $user_info['is_mod'] what about putting:
allowedTo('moderate_forum')
I'm only a half geek really...

oscar2001

Quote from: Grudge on November 26, 2004, 09:36:53 AM
instead of $user_info['is_mod'] what about putting:
allowedTo('moderate_forum')

Sorry doesant do anything.

Advertisement: