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

Reply
 
Thread Tools Display Modes
  #1  
Old 02-27-2009, 08:48 AM
MTGDarkness MTGDarkness is offline
 
Join Date: Dec 2008
Posts: 270
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Messing with $post[message] in functions_newpost.php-The quest continues! Form vars?

I want to add a snippet of code to each $post[message]. It's for a modification I'm working on. How can I add, say, a conditional clause to it? I tried editing the postbit template and it didn't work...
Reply With Quote
  #2  
Old 02-27-2009, 08:58 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

As you mentioned, editing the postbit(_legacy) template should be sufficient. What exactly did you do?
Reply With Quote
  #3  
Old 02-27-2009, 08:58 AM
MTGDarkness MTGDarkness is offline
 
Join Date: Dec 2008
Posts: 270
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What I'm trying to do is, again, set up this automatic BBCode thing that I've been looking for.

I tried setting it up like this:

Code:
<if condition="$post[field11] AND $post[field12]">$post[field11]</if>
			$post[message]
<if condition="$post[field11] AND $post[field12]">$post[field12]</if>
Where field 11 and 12 are single line text fields asking for BBCode beginning and end tags, respectively, but this basically just adds the content to the beginning and end of each post, and if it's BBCode (which it's supposed to be), it doesn't parse. I also have the feeling that this is a security risk.
Reply With Quote
  #4  
Old 02-27-2009, 09:01 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You need to convert the BB Code into HTML (called "parsing"). This needs to be done inside a plugin. (There are articles describing how to parse BB code.)
Reply With Quote
  #5  
Old 02-27-2009, 09:09 AM
MTGDarkness MTGDarkness is offline
 
Join Date: Dec 2008
Posts: 270
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

https://vborg.vbsupport.ru/showthrea...ghlight=bbcode

I'm not quite sure what I'm doing here. I started out on this code:

Code:
<if condition="$post[field11] AND $post[field12]">
$text = $post[field11] $post[field12]
$do_html = false
$do_smilies = true
$do_bbcode = true
$do_imgcode = true
$do_nl2br = true
$cachable = false
</if>

$parsed_text
			$post[message]
<if condition="$post[field11] AND $post[field12]">$post[field12]</if>
It's not finished yet, because I realized that I'm going to have a hell of a time trying to get the parser to parse half of the bbcode, then the other half. And I'm not sure how to make it parse both.

--------------- Added [DATE]1235735146[/DATE] at [TIME]1235735146[/TIME] ---------------

Is there any way to just modify what goes in to $post[message]?
Reply With Quote
  #6  
Old 02-27-2009, 03:03 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You cannot do php in a template. You will have to write a plugin to do that.
Reply With Quote
  #7  
Old 02-27-2009, 03:23 PM
MTGDarkness MTGDarkness is offline
 
Join Date: Dec 2008
Posts: 270
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Can't I just fiddle with the $post[message] instead? Wouldn't that be simpler?
Reply With Quote
  #8  
Old 02-27-2009, 03:39 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If you are going to 'fiddle' with $post[message] before it is spit out in the template, you must do so using a plugin.
Reply With Quote
  #9  
Old 02-27-2009, 03:44 PM
MTGDarkness MTGDarkness is offline
 
Join Date: Dec 2008
Posts: 270
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Oooh... I see. And which plugin hook? I'm guessing Postdata_Start, but I really don't know where all these hooks go to.
Reply With Quote
  #10  
Old 02-27-2009, 05:37 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If you are in debug mode, there is a list of all the plugins called for the page on the bottom. I think I usually use postbit_display_start when I want to change something that is going into the postbit. But, you can certainly try different locations.
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 10:29 AM.


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.04173 seconds
  • Memory Usage 2,252KB
  • 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
  • (2)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)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