Calling custom options?

RickM

Well-known member
Anyone worked out how to use custom created options for an addon inside your main addon class yet?

bit stuck!

I've worked out that standard options for XenForo_Application are called as follows, but cant figure out custom ones:

PHP:
$options = XenForo_Application::get('options');

EDIT: Scrap that - they are stored in the default array! Man I need to sleep! :D

Edit2: Hmm...it wont let me use the options in a custom addon :/ I just get this:

Fatal error: Cannot use object of type XenForo_Options as array
 
Right. Ignore me - got it sorted.

For anyone looking to use custom (or standard) options in their addons, you call them like so:

PHP:
$rating_forum = XenForo_Application::get('options')->ratingforum_id;

Where 'ratingforum_id' is the unique ID you assigned the option when creating it.
 
:D

I'll confess....had to look at the code of a couple of existing mods before I figured it out! :oops:
 
Top Bottom