MyBB Community Forums

Full Version: Private tag
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I've been working on a bbcode but have no idea what to do next.

In "inc/functions_post.php" I put
$message = preg_replace("#\[pri={$mybb['username']\](.*?)\[/pri\]#si", "<font size='2'><i>Private: $1</i></font>", $message);

If a member would type [pri=harmor]Private message here[/pri]
I would see it as Private: Private message here
But all the other members would see "[pri=harmor]Private message here[/pri]"
How would I make it invisible to everyone except to the person that the private message is for?

I did make something similiar.
After the globals I made an array of the current admins
$mybb = array(s_admins => "harmor", s_admins => "Cory");

Then I made a conditional after the [hr ] bbcode
Here's the code
if (!$mybb['username'] == $mybb['s_admins']) {
	$message = preg_replace("#\[pri\](.*?)\[/pri\]#si", "<font size='2'><i>Private: $1</i></font>", $message);
    if ($mybb['username'] == $mybb['s_admins']) {
	$message = preg_replace("#\[pri\](.*?)\[/pri\]#si", "", $message);

I have no clue why putting ! worked because doesn't that mean if it doesn't match then diplay the following code?
See your thread in mybb community forums.