Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
  #1  
Old 07-30-2011, 09:49 AM
kiradotee's Avatar
kiradotee kiradotee is offline
 
Join Date: Jul 2011
Posts: 12
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default problem - BBcode (with php)

Hello,
I have downloaded the plugin https://vborg.vbsupport.ru/showthread.php?t=264896 , which gave me an ability to use PHP in BBcode.

For example:
PHP Code:
<?php

$o_style_start 
"<b>";
$o_style_end "</b>";
$o_style $o_style_start $value $o_style_end ;
return 
"$o_style";
?>
and it works.

But why do i need PHP in BBcode is to make an additional profile field in which the user will decide how the BBcode will look like to him.
So i wanted to insert variables in the replacement field in BBcode section, and put if`s and var values in the Module.

BUT the variables are still don`t have values - i used almost all module locations which my mind thought (bbcode_create, global_start, showthread_start and etc.. )

I thought that "okay, i will put the whole thing in the BBcode replacement section, BUT at that point the field57 is not determined >_< .

Now i just don`t know how to do this.

If someone know - could you please tell me how to "fix" this method.

Or maybe there is other method like to make a module/template which will replace the BBcode looking depending on which options the user has selected in field57 .

For example what i want:
I have a BBcode, which will make the text <b></b>, but if the user has selected the second option in field57 then he will see the text with this BBcode as <i></i> while the users with first option will still see the text as <b></b> .


Thank you in advance, people! :*
Reply With Quote
  #2  
Old 07-30-2011, 10:24 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

When you say field57 wasn't defined in some places, how did you access it, through $vbulletin->userinfo['field57']? You may need to add a global $vbulletin before that.

Also, I haven't tried the "use PHP in BBcode", but it could be that if you have post caching turned on, it will not work like you'd expect.
Reply With Quote
  #3  
Old 07-30-2011, 10:33 AM
kiradotee's Avatar
kiradotee kiradotee is offline
 
Join Date: Jul 2011
Posts: 12
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by kh99 View Post
When you say field57 wasn't defined in some places, how did you access it, through $vbulletin->userinfo['field57']? You may need to add a global $vbulletin before that.
Yes, i tried:
Code:
$vbulletin->userinfo['field57']
userinfo['field57']
$vbulletin->post['field57']
post['field57']
Reply With Quote
  #4  
Old 07-30-2011, 10:35 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Did you try:

Code:
global $vbulletin;

$vbulletin->userinfo['field57'] ....
Reply With Quote
Благодарность от:
kiradotee
  #5  
Old 07-30-2011, 10:37 AM
kiradotee's Avatar
kiradotee kiradotee is offline
 
Join Date: Jul 2011
Posts: 12
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by kh99 View Post
Did you try:

Code:
global $vbulletin;

$vbulletin->userinfo['field57'] ....
:O

Oh my god......it worked!
Now i will try to do what i wanted, thank you very much!

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

Now, i think the last, what i want to solve is how to define the variable in module, so the php bbcode can access it.

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

Quote:
Originally Posted by kh99 View Post
but it could be that if you have post caching turned on, it will not work like you'd expect.
You were right

Maybe there is a way to make it working with it on, like changing/creating some templates?

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

Or maybe there is a way to re-cache messages when user updates his Options?
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 12:30 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.08608 seconds
  • Memory Usage 2,203KB
  • 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
  • (3)bbcode_code
  • (1)bbcode_php
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (5)post_thanks_box
  • (1)post_thanks_box_bit
  • (5)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (5)post_thanks_postbit_info
  • (5)postbit
  • (5)postbit_onlinestatus
  • (5)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
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete