Micheal
Well-known member
Hi everyone
I hope someone will help me with this but im trying to add a new trophy for my add-on
Here is what i have in the Listener
This works fine but its not showing the spinbox when i go and add a trophy
If anyone could help me here that would be great
Thanks
I hope someone will help me with this but im trying to add a new trophy for my add-on
Here is what i have in the Listener
PHP:
public static function templateHook($hookName, &$contents, array $hookParams, XenForo_Template_Abstract $template)
{
if ($hookName == 'user_criteria_content')
{
$userCriteria = $template->getParam('userCriteria');
$checked = $userCriteria['microquiz_correctanswers'] ? 'checked' : '';
$answers = $userCriteria['microquiz_correctanswers']['answers'];
$contents .= '<li><label>
<input type="checkbox" name="user_criteria[microquiz_correctanswers][rule]" value="microquiz_correctanswers" class="Disabler" id="ucrit_microquiz_correctanswers" '.$checked.' />
User has got aleast X correct answers in microquiz:</label>
<div class="criteriaQualifier" id="ucrit_microquiz_correctanswers_Disabler">
<xen:spinbox name="user_criteria[microquiz_correctanswers][data][answers]" value="'.$answers.'" size="5" min="10" step="5" />
</div>
</li>';
}
}
public static function criteriaUser($rule, array $data, array $user, &$returnValue)
{
switch ($rule)
{
case 'microquiz_correctanswers':
$returnValue = true;
break;
}
}
This works fine but its not showing the spinbox when i go and add a trophy
If anyone could help me here that would be great
Thanks