Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
  #1  
Old 11-08-2004, 05:32 PM
Blam Forumz Blam Forumz is offline
 
Join Date: Jun 2004
Posts: 554
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default How would I go about doing this?

Hi, im trying to make an 'Off Topic' BB Code. I got it working (It uses fieldset)

But what I want to do is make it so users can select in their profile whether to display it or not using profile fields.

I tried this

HTML Code:
<if condition="$post['field9']"><fieldset><legend>Off Topic</legend><table><tr><td>
{param}
</td></tr>
</table></fieldset></if>

Field 9 is a single line text box

Thanks

/blam
Reply With Quote
  #2  
Old 11-08-2004, 05:48 PM
Link14716's Avatar
Link14716 Link14716 is offline
 
Join Date: Jun 2002
Location: Georgia, USA
Posts: 2,519
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Forget about a disappearing off topic BBCode unless you want to try to find a way to do it in functions_bbcodeparse.php.

I do have a creative alternative for you: use quote. Maybe make Off Topic be [quote=OffTopic]. Now edit the template bbcode_quote.

At the begining, put this:
HTML Code:
<if condition="$username != 'OffTopic'">
Then, at the end, put this:
HTML Code:
<else /><if condition="$post['field9']"><fieldset><legend>Off Topic</legend><table><tr><td>
$message
</td></tr>
</table></fieldset></if></if>
Save it and you have an instant off topic tag.

Be creative.
Reply With Quote
  #3  
Old 11-08-2004, 06:03 PM
Blam Forumz Blam Forumz is offline
 
Join Date: Jun 2004
Posts: 554
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks alot! But I wuold like it to be [ot], is that possible without editng funcions_bbcodeparse.php?

Thanks again

Edit - the codes that you gave me didnt work, nothing displays eevn if the field is blank now
Reply With Quote
  #4  
Old 11-08-2004, 06:09 PM
Link14716's Avatar
Link14716 Link14716 is offline
 
Join Date: Jun 2002
Location: Georgia, USA
Posts: 2,519
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Blam Forumz
Thanks alot! But I wuold like it to be [ot], is that possible without editng funcions_bbcodeparse.php?

Thanks again


Edit - the codes that you gave me didnt work, nothing displays eevn if the field is blank now
That's what the condition you posted did, if it's blank, it shouldn't show up. If you want to reverse this, you'd have to add a ! before the $ in the condition to mean if it is blank, show the code.

I know you're going to have to edit functions_bbcodeparse to use [ot], but it probably wouldn't be that bad of an edit.
Reply With Quote
  #5  
Old 11-08-2004, 06:12 PM
Blam Forumz Blam Forumz is offline
 
Join Date: Jun 2004
Posts: 554
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks for your help, but ive decided to leave it how I orignally had it (Showing the code no matter what my users wanted out of it)
Reply With Quote
  #6  
Old 11-08-2004, 06:18 PM
Link14716's Avatar
Link14716 Link14716 is offline
 
Join Date: Jun 2002
Location: Georgia, USA
Posts: 2,519
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Alright, this is not tested at all, so don't blame me if I cause a nuclear explosion to blow up half the world.

In functions_bbcodeparse.php, find this:
PHP Code:
    // [QUOTE]
    
$bbcodes['custom']['find']['[quote]'] = '#\[quote\](<br>|<br />|\r\n|\n|\r)??(.*)(<br>|<br />|\r\n|\n|\r)??\[/quote\]#esiU';
    
$bbcodes['custom']['replace']['[quote]'] = "handle_bbcode_quote('\\2')";
    
$bbcodes['custom']['recurse']['quote'][0] = array('handler' => 'handle_bbcode_quote'); 
Now add this above it:
PHP Code:
    // [OT]
    
$bbcodes['custom']['find']['[ot]'] = '#\[ot\](<br>|<br />|\r\n|\n|\r)??(.*)(<br>|<br />|\r\n|\n|\r)??\[/ot\]#esiU';
    
$bbcodes['custom']['replace']['[ot]'] = "handle_bbcode_offtopic('\\2')";
    
$bbcodes['custom']['recurse']['ot'][0] = array('handler' => 'handle_bbcode_offtopic'); 
Now, find this:
PHP Code:
// ###################### Start bbcodehandler_quote ####################### 
Add this above it:
PHP Code:
// ###################### Start bbcodehandler_offtopic #######################
function handle_bbcode_offtopic($message)
{
    global 
$vboptions$vbphrase$stylevar$show;

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

    
// remove unnecessary escaped quotes
    
$message str_replace('\\"''"'$message);

    global 
$stopsaveparsed$parsed_postcache;
    if (
$stopsaveparsed OR $parsed_postcache['skip'] == true OR !$vboptions['cachemaxage'])
    {
        
$show['iewidthfix'] = (is_browser('ie') AND !(is_browser('ie'6)));
    }
    else
    {
        
// this post may be cached, so we can't allow this "fix" to be included in that cache
        
$show['iewidthfix'] = false;
    }

    eval(
'$html = "' fetch_template('bbcode_offtopic') . '";');
    return 
$html;

Now add the code you have in your first post to a new template called bbcode_offtopic, replacing {param} with $message.
Reply With Quote
  #7  
Old 11-08-2004, 06:28 PM
Blam Forumz Blam Forumz is offline
 
Join Date: Jun 2004
Posts: 554
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

>_< Didnt work, sorry for all the trouble Ive caused, appreciate the help though.

(Half the world hasnt been blown up :P)
Reply With Quote
  #8  
Old 11-08-2004, 06:31 PM
Link14716's Avatar
Link14716 Link14716 is offline
 
Join Date: Jun 2002
Location: Georgia, USA
Posts: 2,519
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What didn't work about it? And is the old [ot] still there? (It shouldn't be).

What would someone put in field9 anyways? You said it was a single line text field.

EDIT: If this ends up working, you might want to add this:
PHP Code:
    // don't know where else bbcodes are defined
    
'bbcode_offtopic'
under this:
PHP Code:
    'option'
in global.php.
Reply With Quote
  #9  
Old 11-08-2004, 08:50 PM
Link14716's Avatar
Link14716 Link14716 is offline
 
Join Date: Jun 2002
Location: Georgia, USA
Posts: 2,519
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

By the way, it works fine here.

http://14716.info/ot_np_hacks.png

If it doesn't work for you, it has to do with your conditional, and I need more info to help you there.

EDIT: Changed to a URL, since it stretched all posts on this thread.
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 05:39 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04680 seconds
  • Memory Usage 2,262KB
  • 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
  • (3)bbcode_html
  • (6)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (9)post_thanks_box
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (9)post_thanks_postbit_info
  • (9)postbit
  • (9)postbit_onlinestatus
  • (9)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