Go Back   vb.org Archive > Community Discussions > Modification Requests/Questions (Unpaid)

Reply
 
Thread Tools Display Modes
  #1  
Old 01-23-2005, 05:37 PM
rin rin is offline
 
Join Date: Aug 2004
Location: Mainland of China
Posts: 109
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default bb code modification

hello,

here's one for you. i'd like to have a bb-code which works like this:

[noguest]this text won't appear to guests even if they are allowed to view a thread[/noguest]

i think the bb code speaks for itself. the idea is to have a bb code which hides text or pictures and anything within the text to guests. i think thats not possible with just adding a complicated bb-code in the bb-code manager.
i hope that someone else also finds this useful and is encouraged to make a modification for it. if it is possible without modifying any code or if there already is a hack, please tell me where to find it. thanks a lot.

ps: would be cool instead of displaying nothing to guests showing text telling them to register to view the hidden message.
Reply With Quote
  #2  
Old 01-25-2005, 06:58 AM
rin rin is offline
 
Join Date: Aug 2004
Location: Mainland of China
Posts: 109
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

anyone?
Reply With Quote
  #3  
Old 01-26-2005, 12:52 PM
rin rin is offline
 
Join Date: Aug 2004
Location: Mainland of China
Posts: 109
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

tralalala.
Reply With Quote
  #4  
Old 01-26-2005, 01:36 PM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Just a quick solution, not tested!!!

Open file includes/functions_bbcodeparse.php.

Find:
PHP Code:
// ###################### Start bbcodehandler_code #######################
function handle_bbcode_code($code)

Add before:
PHP Code:
// ###################### Start bbcodehandler_noguest #######################
function handle_bbcode_noguest($code)
{
    global 
$bbuserinfo;

    
// remove empty codes
    
if (trim($code) == '')
    {
        return 
'';
    }

    if (
$bbuserinfo['userid'] == 0)             // Guest
    
{
        return 
"Sorry this text is not viewable by guests.";
    }
    else
    {
        return 
$code;
    }

In the same file find:
PHP Code:
        // [U]
        
$bbcodes['standard']['find']['[u]'] = '#\[u\](.*)\[/u\]#esiU';
        
$bbcodes['standard']['replace']['[u]'] = "handle_bbcode_parameter('\\1','" str_replace("'""\'"'<u>\1</u>') . "')";
        
$bbcodes['standard']['recurse']['u'][0] = array('replace' => 'u'); 
Add After:
PHP Code:
        //[NOGUEST]
        
$bbcodes['custom']['find']['[noguest]'] = '#\[noguest\](.*)\[/noguest\]#esiU';
        
$bbcodes['custom']['replace']['[noguest]'] = "handle_bbcode_noguest('\\1')";
        
$bbcodes['custom']['recurse']['noguest'][0] = array('handler' => 'handle_bbcode_noguest'); 
This should do the trick.
Reply With Quote
  #5  
Old 01-26-2005, 01:40 PM
Colin F's Avatar
Colin F Colin F is offline
 
Join Date: Jul 2004
Location: Switzerland
Posts: 1,551
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by rin
hello,

here's one for you. i'd like to have a bb-code which works like this:

[noguest]this text won't appear to guests even if they are allowed to view a thread[/noguest]

i think the bb code speaks for itself. the idea is to have a bb code which hides text or pictures and anything within the text to guests. i think thats not possible with just adding a complicated bb-code in the bb-code manager.
i hope that someone else also finds this useful and is encouraged to make a modification for it. if it is possible without modifying any code or if there already is a hack, please tell me where to find it. thanks a lot.

ps: would be cool instead of displaying nothing to guests showing text telling them to register to view the hidden message.
Interesting idea, but I have no idea how something like this would be done.


Edit: now that I think about it, I do... have a look at the hide hacks floating around. What you want to do should be rather similiar, except that it's a different condition.
Reply With Quote
  #6  
Old 01-26-2005, 01:58 PM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

No need to think Colin, just read back
Reply With Quote
  #7  
Old 01-26-2005, 02:25 PM
rin rin is offline
 
Join Date: Aug 2004
Location: Mainland of China
Posts: 109
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

wow. thanks a lot! works perfectly fine! you may want to publish it as a hack! i like it!
and thanks colin too for being helpful.
Reply With Quote
  #8  
Old 01-26-2005, 03:08 PM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by rin
wow. thanks a lot! works perfectly fine! you may want to publish it as a hack! i like it!
and thanks colin too for being helpful.
Done
Reply With Quote
  #9  
Old 01-26-2005, 03:10 PM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hmm, I wonder if this won't cause problems with the postcache ...
Reply With Quote
  #10  
Old 01-26-2005, 03:12 PM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Why would it Kirby?
Am i missing something?
Reply With Quote
Reply

Thread Tools
Display Modes

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 01:45 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.04513 seconds
  • Memory Usage 2,264KB
  • Queries Executed 11 (?)
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
  • (4)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)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_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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete