
02-02-2005, 11:37 PM
|
 |
|
|
Join Date: Aug 2003
Location: Canada
Posts: 2,845
Благодарил(а): 0 раз(а)
Поблагодарили:
0 раз(а) в 0 сообщениях
|
|
Quote:
Originally Posted by buro9
It was doing weird things when a user edits a post... so I've created this work around for the bit of text that goes into functions_bbcode.php
Code:
// HACK : START : ME
global $post;
if ('' == $post[username]) {
$meUsername = $bbuserinfo[username];
} else {
$meUsername = $post[username];
}
$bbcode = preg_replace('#^/me (.*)$#im', "<font color=\"red\">* $meUsername \\1</font>", $bbcode);
// HACK : END : ME
Essentially if you are editing a post the $post array does not exist, as another context is used instead. So you lose the username.
I've added a switch that tests for this, and if $post doesn't exist, it uses the name of the current poster... fine for my forum as I only allow post owners to edit their messages... but this is a crude hack and it will break when an admin or mod edits their post... so not good.
Does anyone know a better context that I can use? How to find out the equivalent of an $editpost array or the post id so that I can get the proper name.
Cheers
David K
|
Whats that fix for?
|