Morgan
Active member
So I'm a bit confused on what I'm doing wrong so instead of beating myself up and giving up just to ask I figured that someone here might be able to point out what I've been missing! I am making custom notice fields for a user and as such adding a multiple selection. This works fine when the user criteria is selected and such, but when it isn't (such as a new notice or one that doesn't use this data) I get the following error:
The relevant section of my template is:
I'm pretty sure that I'm missing something important but really I have no idea what! I'm expecting the array $userCriteria.steam_not_game.games to be null at this point since it hasn't be initialized given this is a new notice!
Thanks for any help
Code:
in_array() [<a href='function.in-array'>function.in-array</a>]: Wrong datatype for second argument in /home/mlp/domains/massivelan.com/public_html/forum2/library/XenForo/Template/Abstract.php(265) : eval()'d code, line 55:
54: 'value' => htmlspecialchars($_criteriaUg['id']),
55: 'selected' => (in_array($_criteriaUg['id'], $userCriteria['steam_not_game']['games'])),
56: 'label' => htmlspecialchars($_criteriaUg['name'])
The relevant section of my template is:
Code:
<label><input type="checkbox" name="user_criteria[steam_not_game][rule]" value="steam_not_game" class="Disabler" id="ucrit_steam_not_game" {xen:checked $userCriteria.steam_not_game} />{xen:phrase steam_game_not_owned}:</label>
<div class="criteriaQualifier" id="ucrit_steam_not_game_Disabler">
<xen:select name="user_criteria[steam_not_game][data][games]" size="8" multiple="true">
<xen:foreach loop="$steam_games" value="$_criteriaUg">
<xen:option value="{$_criteriaUg.id}" selected="in_array({$_criteriaUg.id}, {$userCriteria.steam_not_game.games})">{$_criteriaUg.name}</xen:option>
</xen:foreach>
</xen:select>
</div>
I'm pretty sure that I'm missing something important but really I have no idea what! I'm expecting the array $userCriteria.steam_not_game.games to be null at this point since it hasn't be initialized given this is a new notice!
Thanks for any help