I'm writing a mod as part of a mod request. The mod basically shows a warning message if a post is being modified after a certain amount of time, asking the user to post in a new post if there is new information to add. I got to the point where the message displays, and everything. The only problem is, the error shows even before it needs to. I wrote an if statement in post.template.php, that looks like this:
Quote
if ((!$context['is_new_post']) && (time() - $row['posterTime'] < ($modSettings['EditTimeWarningAmt'])*60))
echo '
<tr>
<td></td>
<td align="center" class="error">
<B>'. $txt['modEditTimeWarningMsg'] .'</B>
</td>
</tr>';
I've tried numerous ways of writing it, but nothing works. Unless I'm supposed to put it in a different file... ??? The * 60 is so that it converts the seconds to minutes.
BTW - I'm writing this mod for both 1.1.x and 2.0, in case that matters.
:)
OK. Now it's not showing up at all!
if (!$context['is_new_post'] && ($message['posterTime'] + $modSettings['EditTimeWarningAmt'] * 60 >= time()))
echo '
<tr>
<td></td>
<td align="center" class="error">
<B>'. $txt['modEditTimeWarningMsg'] .'</B>
</td>
</tr>';
Anyone?
$row variable in template file is empty. You need to put that value to the context array in source file.
Post.php
Find:
$context['icon'] = $row['icon'];
Replace:
$context['icon'] = $row['icon'];
$context['posterTime'] = $row['posterTime'];
Then you can use $context['posterTime'] instead of $row['posterTime']. But make sure variable is set, before using it with empty() or isset().
It worked!
THANK YOU BLUE DREAM! :) :) :)