vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   bb code modification (https://vborg.vbsupport.ru/showthread.php?t=74940)

rin 01-23-2005 05:37 PM

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.

rin 01-25-2005 06:58 AM

anyone? :)

rin 01-26-2005 12:52 PM

tralalala.

Marco van Herwaarden 01-26-2005 01:36 PM

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.

Colin F 01-26-2005 01:40 PM

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.

Marco van Herwaarden 01-26-2005 01:58 PM

No need to think Colin, just read back :D

rin 01-26-2005 02:25 PM

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. :)

Marco van Herwaarden 01-26-2005 03:08 PM

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 :D

Andreas 01-26-2005 03:10 PM

Hmm, I wonder if this won't cause problems with the postcache ...

Marco van Herwaarden 01-26-2005 03:12 PM

Why would it Kirby?
Am i missing something?


All times are GMT. The time now is 04:26 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.02617 seconds
  • Memory Usage 1,747KB
  • 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
  • (4)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete