Custom user criteria


Well-known member
Does anybody know how to create new user criteria, e.g. for use in notices? Couldn't find anything by searching.

Thanks :)


Well-known member
Not sure if this works for what you're trying to do, but you could simply set it up like this.

Privileges and Status - Select user is logged in, and also user state is valid.
Content and Achievements - User has posted no more than X messages, set to zero.

Turn off the Notice may be dismissed option as well if you'd like, then the notice will remain until the member makes their first post.


Well-known member
The hook you listed above is what you need. It's a hook into the admin template helper_criteria_user. Look through that template to see how the options are formatted. Create a new code event listener listening to template_hook with your content to insert, and add it to your add-on.


Active member
Has anyone released an addon that implements this? I'd like to see an example if possible. Would rather avoid the trial and error phase if possible!


Active member
So I've implemented an admin template, setup a user_criteria and all is working except when I edit a notice the previous values do not show up. This is the template I am using, am I missing something?

<template title="steam_helper_criteria_privs" version_id="1" version_string="1.0.0"><![CDATA[
    <label><input type="checkbox" name="user_criteria[steam_state][rule]" value="steam_state" class="Disabler" id="ucrit_steam_state" {xen:checked $userCriteria.steam_state} />{xen:phrase steam_state_is}</label>
    <div class="criteriaQualifier" id="ucrit_steam_state_Disabler">
        <xen:select name="user_criteria[steam_state][data][state]" value="{$userCriteria.steam_state.state}" inputclass="autoSize">
            <xen:option value="associated">{xen:phrase steam_state_associated}</xen:option>
            <xen:option value="deassociated">{xen:phrase steam_state_deassociated}</xen:option>


Active member
Oh, I see. I had to do:
array_merge($hookParams, $template->getParams())
Is there somewhere that would explain what $hookParams and $template->getParams() are and how the differ? I doubt I should be merging these.


Well-known member
$hookParams are the parameters that are passed via the hook, such as:
<xen:hook name="some_hook_name" params="{xen:array forum={$forum}, thread={$thread}}">
$template->getParams are the parameters available to the template (usually $viewParams).