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

(Fixed) default_value is not a valid array


New member
Hi there.

I'm trying to make an option section with 2 checkboxes.
The first checkbox is the main one and the second one is an child of the first one.

I'm using:
  • Edit Format: Named Template
  • Format Parameters: option_template_MC_RTR
  • Data Type: Array
  • Default Value: a:2:{b:0;b:0;}
  • Array Sub-Options: adminNeedTested, noAdminSelfTesting
Image of the setup:

The admin template "option_template_MC_RTR" looks like this:
<xen:checkboxunit label="">
    <xen:option name="{$fieldPrefix}[{$preparedOption.option_id}][adminNeedTested]" label="{$preparedOption.title}" value="1"
        <xen:hint>{xen:phrase stopforumspam_enable_registration_check_explain}</xen:hint>
            <xen:option name="noAdminSelfTesting" selected="{$preparedOption.option_value.noAdminSelfTesting}">
                <xen:label>Test Label<!--{xen:phrase stopforumspam_moderate_registration_threshold}-->:</xen:label>
    <xen:explain>{xen:raw $preparedOption.explain}</xen:explain>
Once I click Save Option, I get this error:

Now I have been searching and reading a little here on XenForo forum, help page and the resource section, to try to figure out how the array default options needs to be done, and the only thing I found on this issue is this threat about it: Default value for data type array

But there is not much of help on it, since after what I can see on that page and on other options sections, the default value looks alright, but I'm still very new to making addon's for XenForo and I'm clearly missing something important.

So anyone that could point me in the right direction or explain how this would need to be setup in more dept, would be appreciated allot.

Kind regards


XenForo developer
Staff member
the default value looks alright
Unfortunately, it's not. Pop the value through unserialize and you'll see you get an error: "unserialize(): Error at offset 9 of 14 bytes".

Have a look at another option that is formatted like you want and see how it's implemented and the structure of the default value. It should point you to what you need to use.


New member
Thanks for pointing me in the right direction.
I did a quick search on google to learn a bit more about the unserialize :)

I have to do it this way instead :p
I actually tried that at one point but it didn't work, but that was due to me not adding the quotes around the string value. (Silly me) it was looking like this :p
Anyway, I got it to work and thanks again. You are an champ ;)