MyBB Community Forums
Private tag - Printable Version

+- MyBB Community Forums (https://community.mybb.com)
+-- Forum: Extensions (https://community.mybb.com/forum-201.html)
+--- Forum: Plugins (https://community.mybb.com/forum-73.html)
+---- Forum: Plugin Development (https://community.mybb.com/forum-68.html)
+---- Thread: Private tag (/thread-22809.html)



Private tag - harmor - 2005-08-24

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?



RE: Private tag - decswxaqz - 2005-08-24

See your thread in mybb community forums.