Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 08-24-2009, 09:50 AM
share4vn.com share4vn.com is offline
 
Join Date: Feb 2008
Posts: 27
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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
Reply With Quote
  #2  
Old 08-24-2009, 10:24 AM
James Birkett James Birkett is offline
 
Join Date: Jun 2009
Posts: 633
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #3  
Old 08-25-2009, 04:41 AM
share4vn.com share4vn.com is offline
 
Join Date: Feb 2008
Posts: 27
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by James Birkett View Post
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
Reply With Quote
  #4  
Old 07-26-2011, 06:04 AM
I.M.O.G. I.M.O.G. is offline
 
Join Date: Aug 2010
Posts: 24
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #5  
Old 07-26-2011, 09:54 AM
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
Senior Member
 
Join Date: Jun 2008
Location: New York
Posts: 10,610
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #6  
Old 07-26-2011, 10:10 AM
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
Senior Member
 
Join Date: Jun 2008
Location: New York
Posts: 10,610
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 04:53 AM.


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.06416 seconds
  • Memory Usage 2,210KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_code
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (6)post_thanks_box
  • (6)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (6)post_thanks_postbit_info
  • (6)postbit
  • (6)postbit_onlinestatus
  • (6)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete