FixedBit
12-27-2008, 07:29 PM
I have tried doing this and I know it is probably wrong but its been a while since I wrote a vbulletin plugin.
I overall just need help. I am trying to create a bbcode that is parsed when the thread is displayed, NOT when edited, like the usual bbcode way is.
I need it to parse the text between two blocks, and then check if a user is logged in or not.
If the user is logged in, it displays the html formatted text, if not logged in, do not display the text at all but instead a message to login.
I have tried finding a plugin for this but had no luck so I am just trying to handle it myself.
If anyone can help I would appreciate it, or provide more info if needed.
Basically it would take "text here" and then, as the thread is being displayed to the user, check if they are logged in. The rest I think is pretty self explainitory.
I am trying this but of course it is not working.
global $vbulletin;
if($vbulletin->options['fb_bbsoc_active'])
{
if ($vbulletin->userinfo['userid'] != 0)
{
$post['message'] = preg_replace('\[block\]([^[]+?)\[/block\]',
"<div style=\"margin:20px; margin-top:5px;\">
<div class=\"smallfont\" style=\"margin-bottom:2px\">
<span style=\"color:#000000; font-weight:bold;\">Header Text:</span>
</div>
<table cellpadding=\"$stylevar[cellpadding]\" cellspacing=\"0\" border=\"0\" width=\"100%\">
<tr>
<td class=\"alt1\" style=\"border:1px inset; background-color:#FFFFFF\">
<span style=\"font-weight:bold; color:#000000\">$1</span>
</td>
</tr>
</table>
</div>",
$post['message'];
}
else
{
$post['message'] = preg_replace('\[block\]([^[]+?)\[/block\]', 'You must <a href='register.php'>register</a> to see this, or be logged in.', $post['message'];
}
}
I overall just need help. I am trying to create a bbcode that is parsed when the thread is displayed, NOT when edited, like the usual bbcode way is.
I need it to parse the text between two blocks, and then check if a user is logged in or not.
If the user is logged in, it displays the html formatted text, if not logged in, do not display the text at all but instead a message to login.
I have tried finding a plugin for this but had no luck so I am just trying to handle it myself.
If anyone can help I would appreciate it, or provide more info if needed.
Basically it would take "text here" and then, as the thread is being displayed to the user, check if they are logged in. The rest I think is pretty self explainitory.
I am trying this but of course it is not working.
global $vbulletin;
if($vbulletin->options['fb_bbsoc_active'])
{
if ($vbulletin->userinfo['userid'] != 0)
{
$post['message'] = preg_replace('\[block\]([^[]+?)\[/block\]',
"<div style=\"margin:20px; margin-top:5px;\">
<div class=\"smallfont\" style=\"margin-bottom:2px\">
<span style=\"color:#000000; font-weight:bold;\">Header Text:</span>
</div>
<table cellpadding=\"$stylevar[cellpadding]\" cellspacing=\"0\" border=\"0\" width=\"100%\">
<tr>
<td class=\"alt1\" style=\"border:1px inset; background-color:#FFFFFF\">
<span style=\"font-weight:bold; color:#000000\">$1</span>
</td>
</tr>
</table>
</div>",
$post['message'];
}
else
{
$post['message'] = preg_replace('\[block\]([^[]+?)\[/block\]', 'You must <a href='register.php'>register</a> to see this, or be logged in.', $post['message'];
}
}