View Full Version : VIP BBCode ??? -
share4vn.com
08-24-2009, 09:50 AM
I want create a bbvode
Exp : [vip] Content
Content only view by VIP Members (VIP members have ID=14)
Can you help me ??? thanks
James Birkett
08-24-2009, 10:24 AM
It's not as simple as you think as you can't use conditionals in BBCodes.
I'm not sure on how to do this myself, I believe it's creating a new BBCode handler.
share4vn.com
08-25-2009, 04:41 AM
It's not as simple as you think as you can't use conditionals in BBCodes.
I'm not sure on how to do this myself, I believe it's creating a new BBCode handler.
can you help me, i need it
I.M.O.G.
07-26-2011, 06:04 AM
Came across this via google, I realize its old, but if others need it...
To hide messages from anyone not logged into the forum, you cannot do it with BBCODE, you must implement a custom BBCODE as a plugin. This is how you do that:
1. In admincp>add new plugin
2. Hook location = bbcode_create
3. Title = VIP BBCODE (or whatever)
4. PHP CODE:
$custom_bbcode = 'registered';
$this->tag_list['no_option'][$custom_bbcode] = array ();
$this->tag_list['no_option'][$custom_bbcode]['callback'] = 'handle_external';
$this->tag_list['no_option'][$custom_bbcode]['external_callback'] = 'hide_message_from_unregistered_users';
if (!function_exists ('hide_message_from_unregistered_users')) {
function hide_message_from_unregistered_users (&$theobj, &$value, &$option) {
if ($theobj->registry->userinfo['userid'])
return $value;
else
return '<table border="8"><tr><td>This message can only be viewed by logged in Overclockers Members. <a href="overclockers.com/forums/register.php">Register an account</a></td></tr></table>';
}
}
In order to implement this for a specific usergroup, rather than the example code above which only hides from unregistered users, you'd just need to edit the code slightly.
BirdOPrey5
07-26-2011, 09:54 AM
Does the above take into account posts are often cached? I've seen some implementations fail because the cached version (with or without the hidden code) gets shown to everyone regardless of their usergroup.
BirdOPrey5
07-26-2011, 10:10 AM
Just an update, I tested the above code and it's a good start but there are two problems:
1) The cache issue- The cached version will show and it may or may not have the VIP content.
But even if you shut off the cache, problem 2) If a non-VIP member quotes a post with VIP content they will see the original post code with everything you are trying to hide.
The second might not be an issue if you are hiding from guests since usually guests can't quote posts to begin with- but the cache is still a problem.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.