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

How to convert an admin option into an array?

0ptima

Well-known member
#1
Im trying to hide polls in certain forums and would like to configure which forums will not have polls in the Admin CP.

I created a new option with a comma delimited value
upload_2013-9-5_19-51-41.png

In the thread_create template, I want to access this option, but I need it in an array format as the following will not work
upload_2013-9-5_19-53-53.png

How can I achieve this? Thanks.
 

0ptima

Well-known member
#4
This
{xen:helper dump, $xenOptions}

(got a syntax error with your code)

printed
["zhidepolls"] => string(21) "s:14:"13,14,38,59,60""

(Ive been fiddling with the option so its not quite the same as when I first posted.)
 

0ptima

Well-known member
#7
If I change it to array, I get this error

  • Data Type:
    Please select a data type other than 'array' if you want to allow single selections only.
  • Array Sub-Options:
    Please enter a list of sub-options for this array.

What is a sub-option?
 

Jake Bunce

XenForo moderator
Staff member
#8
That is a string var. It doesn't eval like you are thinking. You can check individual values using PHP code (explode the string, process the individual array elements). If you are wanting to do this using template syntax then you need to explode the string in PHP, pass the resulting array to the template, then use in_array() on it.
 

0ptima

Well-known member
#10
That is a string var. It doesn't eval like you are thinking. You can check individual values using PHP code (explode the string, process the individual array elements). If you are wanting to do this using template syntax then you need to explode the string in PHP, pass the resulting array to the template, then use in_array() on it.
Where would I execute the PHP code?