vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Programming a Product: How to add vBulletin options? (https://vborg.vbsupport.ru/showthread.php?t=277206)

MediaHound 01-18-2012 02:59 PM

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.

kh99 01-18-2012 03:17 PM

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.

MediaHound 01-18-2012 03:47 PM

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!

kh99 01-18-2012 03:58 PM

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.

MediaHound 01-18-2012 04:10 PM

Thank you kh99, you found it! I very much appreciate that you took the time to triage. Have a great evening!

Yellow Slider 01-18-2012 10:38 PM

Quote:

Originally Posted by MediaHound (Post 2289444)
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.

MediaHound 01-19-2012 11:29 AM

Quote:

Originally Posted by Yellow Slider (Post 2289639)
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.

nerbert 01-19-2012 02:34 PM

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


All times are GMT. The time now is 05:38 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.01042 seconds
  • Memory Usage 1,736KB
  • 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
  • (1)bbcode_code_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (8)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete