vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   VIP BBCode ??? - (https://vborg.vbsupport.ru/showthread.php?t=221637)

share4vn.com 08-24-2009 09:50 AM

VIP BBCode ??? -
 
I want create a bbvode [vip]

Exp : [vip] Content [/vip]

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

Quote:

Originally Posted by James Birkett (Post 1873269)
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:
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.


All times are GMT. The time now is 11:41 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.00961 seconds
  • Memory Usage 1,722KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete