News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Topic Solved Mod

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

Previous topic - Next topic

johnm


dme

When attempting to install this mod it attempts to reference a directory that does not exist:

and I receive this error message:

fopen(/home/webmom/forums.212panos.com/smf/Themes/default/ManageBoards.template.php): failed to open stream: Permission denied
File: /home/.nodwasher/webmom/forums.212panos.com/smf/Sources/Subs-Package.php
Line: 1454' (Clear filter)

I have grepped for code that that contains "nodewasher" but have found nothing.

My server settings are correct as indicated on the Server Settings page.

Where else should I look?

Note that the .nodewasher/ is a construct used by my hosting company (dreamhost) but I have successfull installed other Mods using my fully qualified server settings as they are set in Server Settings (without any reference to /.nodewasher/)

--Dan

Lux

#42
i combined all the additions in this thread in to a quick hack:

it does change the permission to admins, allowed to moderate board and topic starter
it adds [SOLVED] at the beginning of the topic title if any of the messages of that topic gets marked as solved, and removes so any gets marked as rejected again
its just a quick hack, and there appears to be a bug but i dont know if it is in the "normal" version to, ill try to test that later on
if you click at the solve button in the first post of a topic if the topic is already solved, it appears as if all the other messages marked solved in that topic become the color of "topic_starter_post"

anyway, heres to code, subject to modification and improvements of course:

all changes done in post.php, remember to make backup before applying!!


<search for>

function topicSolved()
{
global $txt, $scripturl, $topic, $db_prefix, $modSettings, $board, $ID_MEMBER, $user_info;
global $board_info, $settings, $sourcedir;

if (!isset($topic) || !isset($_REQUEST['msg']))
fatal_error("Hacker...");
$msg = $_REQUEST['msg'];

$accept = isset($_REQUEST['accept']) ? 1 : -1;

// 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... ");

</search for>

<replace with>

function topicSolved()
{
global $txt, $scripturl, $topic, $db_prefix, $modSettings, $board, $ID_MEMBER, $user_info;
global $board_info, $settings, $sourcedir;

if (!isset($topic) || !isset($_REQUEST['msg']))
fatal_error("Hacker...");
$msg = $_REQUEST['msg'];

$accept = isset($_REQUEST['accept']) ? 1 : -1;

// 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 && $accept == 1)
$firstSubject = '[SOLVED] ' . $firstSubject;
  elseif (strstr($firstSubject, '[SOLVED]') === true && !$accept)
    $firstSubject = substr($firstSubject,9);

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

</replace with>

<search for>

// Set the message as accepted
$icon = $accept == 1 ? 'topicsolvedIconAccept' : 'topicsolvedIconReject';
db_query("
UPDATE {$db_prefix}messages
SET topicSolved = $accept, icon = '$modSettings[$icon]'
WHERE ID_MSG = $msg AND ID_MSG != $FIRST_MSG", __FILE__, __LINE__);
// Lock it?
if ($accept == 1 && !empty($modSettings['topicsolvedLockSolved']))
db_query("
UPDATE {$db_prefix}topics
SET locked = 1
WHERE ID_TOPIC = $topic", __FILE__, __LINE__);

</search for>

<after, add>

  // Update Topic Title
 
  db_query("
    UPDATE {$db_prefix}messages
SET subject = '$firstSubject'
WHERE ID_MSG = $FIRST_MSG", __FILE__, __LINE__);

</after, add>



have fun, and hope everything works for you :P

Lux

edit:

forgot to add:
you need to change your template files to see the two icons for solve!/reject! according to whats mentioned earlier in this thread

edit2:

fixed a bug in post.php (used moderate_forum instead of moderate_board , hehe)

–Michael

#43
Thanks for this mod.

I've added some features  ;)


  • Add [SOLVED] to subject if topic is solved and remove this if it is set to unsolved. This text can be setup in the preferences.
  • 'solved' button is hidden if topic is solved, 'unsolved' button is hidden if topic is unsolved.
  • solved/unsolved buttons will only be displayed if user is the creator of the topic OR is moderator OR is admin
  • included buttons for classic theme and default theme (in English and German [DE in filename]). For using these buttons you need to rename them to solved.gif / unsolved.gif and copy them into the appropriate folder.
Download: topic_solved_mw_1.0.zip

Michael
My SMF Mod: Static Page Mod

Ryan

#44
Can anyone make these modifications to it....

Have it no longer use 3 selected colours from the admin center...
Have it pull the 3 colours from the css of each theme... meaning you can customise the brightness of the greenes etc in the css so a dark theme and light theme would look good with this mod... Becuase at the moment, it only looks good on either a light theme or  dark theme... What about sites like mine that have 16,000 users and loadsa themes.. people complain bout colour :/

Ok thats one way....

Another way to get around this issue would be to change this code below
<tr><td class="', $message['alternate'] == 0 ? 'windowbg' : 'windowbg2', '" ' . (isset($message['messageColor']) ? 'style="background-color: ' . $message['messageColor'] . '"' : '') . '>';


So that it formats the text to black and the solved post background a light green...
I attempted trying to do it but mani failed anyone know how to make the font color black?
Im sure its just a matter of adding text colour in that piece of code above...

These are just my theories i thought up, im sure they apply to everyone that uses this mod!

Thanks :)
must say my users love it!
Certainly organises the place!


Grudge

It should just involve adding color: black; to the style bit:

'style="background-color:

Goes to:

'style="color: black; background-color:
I'm only a half geek really...

Ryan

yea thats what i thought but i couldnt work out how the style tag for color went!

i shall attempt this now :) wish me luck

Ryan

#47
dont seem to be changing the colour of the text :/

HEres what im doing..
my edited version
<table width="100%" cellpadding="3" cellspacing="0" border="0">
         <tr><td class="', $message['alternate'] == 0 ? 'windowbg' : 'windowbg2', '" ' . (isset($message['messageColor']) ? 'style="color: black; background-color: ' . $message['messageColor'] . '"' : '') . '>';

original
   <table width="100%" cellpadding="3" cellspacing="0" border="0">
         <tr><td class="', $message['alternate'] == 0 ? 'windowbg' : 'windowbg2', '" ' . (isset($message['messageColor']) ? 'style="background-color: ' . $message['messageColor'] . '"' : '') . '>';

That look right?

Grudge

Yes it does.All I can think is that maybe where the text body is ($message['body']), the surrounding cell to that ALSO needs to have that style set, as it may be overriding the outer cell. So find where $message['body'] as, and whatever tag surrounds it (Span/div/td) add this to it:

' . (isset($message['messageColor']) ? 'style="background-color: ' . $message['messageColor'] . '"' : '') . '
I'm only a half geek really...

Ryan

Yep works very well :)
Team work! lol

Hope others find this code addition handy :)

Nitro

i have installed this twice in my forum but i see no option in the 'manage boards' section. i wonder, is there something missing? i am using the default theme and english lenguage.
should i change something manually? thank you man!
MPF Rocks!!!

d3v


Grudge

I'm only a half geek really...

Elijah Bliss

I get a "hacking attempt" when attempting to install this with 1.1 Beta 3.

Herman's Mixen

most of the mods are not yet compatible with SMF 1.1 beta 3 public !!
these mods are designed for SMF 1.0.x !!
Met vriendelijke groet, The Burglar!

 House Mixes | Mixcloud | Any Intelligent fool can make things bigger, more complex, and more violent.
It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Albert Einstein

Former Godfather of our dutch community ;)

Elijah Bliss

Quote from: The Burglar! on July 26, 2005, 07:04:02 AM
most of the mods are not yet compatible with SMF 1.1 beta 3 public !!
these mods are designed for SMF 1.0.x !!

The description said this mod was compatible with 1.1 Beta 3.

TekserMan

#56
I get a "./Themes/default/Display.template.php Failure" message in the install actions screen is there a way I can fix this?

I'm using SMF 105 and trying to install tsolved_v111.2.tar.gz

Col

Hi Grudge,

I'd be interested to learn if there was some way of addapting this mod, so that posts by the member who started the thread is one colour, and replies by anyone else is another colour. If I understand the mod correctly, this can be done with this, but only manually. I thought that this might be good for a quick visual reference on a blog board, where blogs are one colour, and comments another. Maybe that's more like a completely new mod, but thought it worth asking.

Thanks.

BNX

Will this ever work for 1.1 RC1?


Advertisement: