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

Reply
 
Thread Tools Display Modes
  #1  
Old 01-18-2012, 02:59 PM
MediaHound MediaHound is offline
 
Join Date: May 2004
Location: Florida
Posts: 165
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Programming a Product: How to add vBulletin options?

I am writing a Product that emails a user when a certain condition is met. I would like the text of the email to be editable by the vBulletin admin. I access the text of the email with $vbulletin->options['testOptions_email_body'] just fine, but I cannot get the option to edit the text to appear in the vBulletin control panel! This is what I tried:
Code:
<?xml version="1.0" encoding="UTF-8"?>

<product productid="testOptions" active="1">
	<title>Test Options</title>
	<description>Test Options</description>
	<version>1.0</version>
	<phrases>
		<phrasetype name="vBulletin Settings" fieldname="vbsettings">
			<phrase name="setting_testOptions_email_body_title"><![CDATA[Email body]]></phrase>
			<phrase name="setting_testOptions_email_body_desc"><![CDATA[The body of the email.]]></phrase>
		</phrasetype>
	</phrases>

	<options>
		<settinggroup name="friendsPost" displayorder="500">
			<setting varname="testOptions_email_body" displayorder="510">
				<datatype>free</datatype>
				<optioncode>textarea</optioncode>
				<defaultvalue><![CDATA[Dear {USERNAME},
This is an email that you will receive when a certain condition is met.
Regards,
	Me]]></defaultvalue>
			</setting>
		</settinggroup>
	</options>
</product>
I also tried adding date, username, and version attributes to the two <phrase> elements, but that did not help. Note that I can access the text of the body and send the email as I expect, the only problem is that the option to edit the text does not show up in the vBulletin Options! The product title is "Test Options" and the productid is "testOptions". It is set as active. What have I done wrong, or what may be missing?

Thanks.
Reply With Quote
  #2  
Old 01-18-2012, 03:17 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I can't tell right off what's wrong, but it's easier if you put the site in debug mode, create your product using the adminCP (and new controls that appear when you're in debug mode), then export the product to xml. I think the best way is to have a test site set up so you can not only leave it in debug mode all the time, but also you don't have to worry about crashing your site when testing new code. But if you can't do that you could use one of these methods to set debug mode just for yourself: https://vborg.vbsupport.ru/showthrea...ght=debug+mode

When you do that, go to the settings in the admin CP and you'll see new controls for adding and editing options. Make sure when you add one that you select your product.
Reply With Quote
Благодарность от:
MediaHound
  #3  
Old 01-18-2012, 03:47 PM
MediaHound MediaHound is offline
 
Join Date: May 2004
Location: Florida
Posts: 165
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you kh99! The tips about enabling debug mode are terrific, I may employ that some day. However I am not the owner of the site and I have explicit instructions not to enable debug mode. Even if I could, it would entail restarting Apache so that config.php were reread, and I don't have root access.

From examining other installed Products that do modify the options, it seems that I'm not missing anything. "Seems" being the operative word, and it is Not Working for me!
Reply With Quote
  #4  
Old 01-18-2012, 03:58 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

OK, well, I tried importing your product and the setting does appear, but the setting group has no name (is blank). To fix that I think you need a phrase named settingroup_friendsPost.
Reply With Quote
Благодарность от:
MediaHound
  #5  
Old 01-18-2012, 04:10 PM
MediaHound MediaHound is offline
 
Join Date: May 2004
Location: Florida
Posts: 165
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you kh99, you found it! I very much appreciate that you took the time to triage. Have a great evening!
Reply With Quote
  #6  
Old 01-18-2012, 10:38 PM
Yellow Slider Yellow Slider is offline
 
Join Date: Aug 2006
Posts: 249
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by MediaHound View Post
Thank you kh99! The tips about enabling debug mode are terrific, I may employ that some day. However I am not the owner of the site and I have explicit instructions not to enable debug mode. Even if I could, it would entail restarting Apache so that config.php were reread, and I don't have root access.

From examining other installed Products that do modify the options, it seems that I'm not missing anything. "Seems" being the operative word, and it is Not Working for me!
You can enable debug mode just for your own IP address.
And you don't have to restart Apache, the changes are applied as soon as you save the file.
Reply With Quote
Благодарность от:
MediaHound
  #7  
Old 01-19-2012, 11:29 AM
MediaHound MediaHound is offline
 
Join Date: May 2004
Location: Florida
Posts: 165
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Yellow Slider View Post
You can enable debug mode just for your own IP address.
And you don't have to restart Apache, the changes are applied as soon as you save the file.
Thank you Yellow, that is important to know.
Reply With Quote
  #8  
Old 01-19-2012, 02:34 PM
nerbert nerbert is offline
 
Join Date: May 2008
Posts: 784
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You need to explain these methods of using debug mode for yourself only to the site owner. Building a control panel manually is very tedious (I've done it before)

Before you edit anything in config.php make a copy, config_save.php, so you have it in pristine form in case you mess something up
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 01:14 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.03939 seconds
  • Memory Usage 2,239KB
  • 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
  • (1)bbcode_code
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (8)post_thanks_box
  • (3)post_thanks_box_bit
  • (8)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (3)post_thanks_postbit
  • (8)post_thanks_postbit_info
  • (8)postbit
  • (8)postbit_onlinestatus
  • (8)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
  • 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