Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
ehren. Posted August 2, 2015 Posted August 2, 2015 Hi everyone,I have a button on my theme which I want to show to certain user groups using an array. This works using:{{if member.inGroup( array(2,4) )}} xxx {{endif}}The "xxx" code is shown to Guests (id=2) and Admins (id=4). So far, so good.To make this customizable, I turned the array into a setting. It uses a Text Input and is called pickerGroups. In the input field, I entered:2,4And my template code looks like this:{{if member.inGroup( array(theme.pickerGroups) )}} xxx {{endif}}Strangely enough, this works for Guests (2), but not for Admins (4). If I reverse the numbers and change the theme setting to 4,2, the button appears for Admins (4), but not for Guests (2).. it's basically only visible for whatever id comes first.If I output the setting using {theme="pickerGroups"}, it correctly shows 2,4 - but it doesn't work correctly in the array tag. Am I doing something wrong.. or is this a bug?
newbie LAC Posted August 3, 2015 Posted August 3, 2015 Hello,array(2,4)Here you create an array with 2 elementsarray(theme.pickerGroups)Here you create an array with 1 elementAm I doing something wrong..Use explode (http://php.net/manual/en/function.explode.php){{if member.inGroup( explode(',', 'theme.pickerGroups) )}}
ehren. Posted August 3, 2015 Author Posted August 3, 2015 Nice, that was almost perfect - except for the extra apostrophe in your final code. Thanks for the help, this seemed to work {{if member.inGroup( explode(',', theme.pickerGroups) )}}
Recommended Posts
Archived
This topic is now archived and is closed to further replies.