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 10-02-2014, 01:36 PM
Black Snow Black Snow is offline
 
Join Date: Jul 2012
Location: Scotland
Posts: 471
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Change Default vB Settings via Custom Mod

Hi,

Is it possible to create a new modification and use it to change settings that come in default vB?

For example:

If I create a mod for "Who has read a thread" that changes the CSS style etc, is it possible to enable/disable the "Who has read a thread" via this new mod without making new tables etc?

If so, how would I go about it?
Reply With Quote
  #2  
Old 10-02-2014, 01:45 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If I understand what you're asking, then yes, you can usually change vb settings in a plugin by resetting the value, if your plugin is at a hook location that gets called before the value is used. The settings values are in $vbulletin->options['setting_name']. You have to know 'setting_name' for the setting you want to change, of course. You can figure that out by looking at the code where it's used, or by hovering your cursor over the value in the admincp (I think you need to have the site in debug mode for that to work). You can also look at the html source for the settings page in the admin cp, if all else fails.
Reply With Quote
  #3  
Old 10-02-2014, 02:04 PM
Black Snow Black Snow is offline
 
Join Date: Jul 2012
Location: Scotland
Posts: 471
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks for the reply. It's not a plugin I want to do it with (I don't think). When you go to admincp>options>settings, turn board on/off, there is an select option to turn the board online/offline. Is it possible to create an addon with that exact setting in it so I can turn the board on/off via my new mod in settings?
Reply With Quote
  #4  
Old 10-02-2014, 02:08 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

No, you wouldn't be able to add that exact setting to your mod. But you could add a setting to your mod and use the same text as the vb setting so that it looks the same, then write a plugin that changes the vb setting depending on your mod's setting.

But maybe I still don't understand, because I don't see why you'd want your mod to have the same setting as one of the vb settings.
Reply With Quote
  #5  
Old 10-02-2014, 02:18 PM
Black Snow Black Snow is offline
 
Join Date: Jul 2012
Location: Scotland
Posts: 471
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

There are some mods available that require certain settings to be enabled or disabled for the mod to work. For Example:

If I wanted to change how reputation was shown on postbit_legacy but I had the rep system turned off. I wanted to be able to make a mod with various options. Therefore I would have to enable the new rep mod, then go to the rep settings and enable the rep system.

I want to be able to turn it on/off and change my custom settings on the same page.
Reply With Quote
  #6  
Old 10-02-2014, 02:22 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

OK, fair enough. What I mentioned above would actually be a way to override the default vb setting. If you want a setting that would mirror the vb setting (so that no matter which one the user changed, the other would change also), then I think it could be done but you need a plugin that runs when the settings are changed. If that's what you want, I don't know offhand how to do that but I think, Ozzy47 does.
Reply With Quote
  #7  
Old 10-02-2014, 02:26 PM
Black Snow Black Snow is offline
 
Join Date: Jul 2012
Location: Scotland
Posts: 471
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

OK thanks. I see the variable for turning the board on/off is:

Code:
$vbulletin->options['bbactive']
but I can't for the life of me work out where it sends a request to change/store the option selected.
Reply With Quote
  #8  
Old 10-02-2014, 02:36 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

In general I think it calls save_settings(), which is in includes/adminfunctions_options.php. If you were writing your own code to change the setting, you could just update the value in the settings table in the db, then call build_options(). If you want to do it in response to one of your mod options begin changed, then you need a plugin, maybe on one of the hooks in that function, I'm not sure.

I'd figure it out, but like I mentioned I believe Ozzy was just talking about something like this so I think he'll know off the top of his head.
Reply With Quote
  #9  
Old 10-02-2014, 02:43 PM
Black Snow Black Snow is offline
 
Join Date: Jul 2012
Location: Scotland
Posts: 471
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

So I could just create a plugin and run an UPDATE sql command to change the setting from on to off and vice versa?
Reply With Quote
  #10  
Old 10-02-2014, 02:53 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Right. I haven't tried it, but I think you can use the save_settings() function like this:

Code:
include_once("includes/adminfunctions.php");
include_once("includes/adminfunctions_options.php");

save_settings(array('bbactive' => 0));
or if you just wanted to change the setting when your mod is installed, you could put that in your mod's install code (although I'm not sure that's what you'd want to do - some people might object to it).

Edit: On second thought, I'm not really very familiar with install code. It might be that wouldn't want to do it that way because build_options() might already get called when a product is installed. If that is what you want to do, I could check the product install code and see (unless someone else happens to know)
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 11:54 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.07105 seconds
  • Memory Usage 2,251KB
  • 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
  • (1)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