/me
(case insensitive) surrounded by whitespaces with the current username when creating (not editing) a post. Hence if the author's nickname changes in the future the substituted username in the post itself won't be updated. This is the least obstructive solution without impacting performance at all.Code: Select all
// Parse Attachments - before checksum is calculated
$message_parser->parse_attachments('fileupload', $mode, $forum_id, $submit, $preview, $refresh);
Code: Select all
/*** 2011-04-15 BEGIN AmigoJack
Convert "/me" to current poster ***/
if( $mode!= 'edit' ) {
$message_parser-> message= preg_replace( '#(^|\\s)/me($|\\s)#i', '$1'. $user-> data['username']. '$2', $message_parser-> message );
}
/*** 2011-04-15 END ***/
Code: Select all
/*** 2011-04-15 BEGIN AmigoJack
Convert "/me" to current poster ***/
if( $mode!= 'edit' ) {
$message_parser-> message= preg_replace( '#(^|\\s)/me($|\\s)#i', '$1*'. $user-> data['username']. '$2', $message_parser-> message );
}
/*** 2011-04-15 END ***/
thanx! It works great. Yet another question from on of the users on my forum, is if there is a possibility to get the converted text in a anothor colorAmigoJack wrote:That would be:Code: Select all
/*** 2011-04-15 BEGIN AmigoJack Convert "/me" to current poster ***/ if( $mode!= 'edit' ) { $message_parser-> message= preg_replace( '#(^|\\s)/me($|\\s)#i', '$1*'. $user-> data['username']. '$2', $message_parser-> message ); } /*** 2011-04-15 END ***/
[color=]
and such.well, together with my friend studied about it, but the colorizing of it in my theme has something do with the css orso. Didn't understand what me ment exactly, but thnx voor the help!AmigoJack wrote:Yes. Compare my last code with the original code - I'm sure you'll find out where to add any text you want. So you can add aswell[color=]
and such.
Code: Select all
/*** 2011-04-15 BEGIN AmigoJack
Convert "/me" to current poster with leading asterisk in green color ***/
if( $mode!= 'edit' ) {
$message_parser-> message= preg_replace( '#(^|\\s)/me($|\\s)#i', '$1[color=green]*'. $user-> data['username']. '[/color]$2', $message_parser-> message );
}
/*** 2011-04-15 END ***/
i love it that you want to help me, because i don't have got any knowledge of PHP. And yes, your last solution posts the user name in the green color, but i want the whole sentence (or action) in the same color.AmigoJack wrote:Seriously.Code: Select all
/*** 2011-04-15 BEGIN AmigoJack Convert "/me" to current poster with leading asterisk in green color ***/ if( $mode!= 'edit' ) { $message_parser-> message= preg_replace( '#(^|\\s)/me($|\\s)#i', '$1[color=green]*'. $user-> data['username']. '[/color]$2', $message_parser-> message ); } /*** 2011-04-15 END ***/
Code: Select all
[me={TEXT1}]{TEXT2}[/me]
Code: Select all
<span style="color:green;">*{TEXT1} {TEXT2}</span>
ViolaF wrote:Go to your ACP > Posting > BBcodes
BBCode usage
HTML replacementCode: Select all
[me={TEXT1}]{TEXT2}[/me]
change green with whatever colorCode: Select all
<span style="color:green;">*{TEXT1} {TEXT2}</span>
Code: Select all
?>
Code: Select all
/**
* Wulfric
* Parses to replace /me with username and color
* Gives HTML output, use only before final output
*/
function replace_slash_me_display($text, $username, $color) {
$text = preg_replace( '#(^)/me(\s+.+)($)#im', '$1<i><b>* <font color="#'. $color . '">' . $username . '</font></b><font color="red">$2</font></i>$3', $text );
return $text;
}
Code: Select all
$message = bbcode_nl2br($message);
Code: Select all
// BEGIN Wulfric - replace '/me'
$message = replace_slash_me_display($message, $row['username'], $row['user_colour']);
// END - replace '/me'
We have 2013 and you're still using this dinosaur? Use at least proper XHTML, like:Wulfric wrote:Code: Select all
<font
Code: Select all
<em style="font-weight: bold; color: #FFF">theusername</em>