• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Calling custom options?

RickM

Well-known member
#1
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
 

RickM

Well-known member
#2
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.