Select which forums something will appear on

Matthew Hawley

Well-known member
I want to select which forums something will appear on.

Like this:
bZLnI3u.png


Any suggestions?
 
I made a checkbox that makes users check "I believe this forum is the section for this topic".

This is the checkbox code
Code:
<dl class="ctrlUnit fullWidth">
        <dd><input type="checkbox" id="threadTitleCheckbox" name="threadTitleCheckbox" /><font style="margin-left:5px;">I believe {$forum.title} is the best forum for this topic.</font></dd>
</dl>

I want to select which forums the checkbox will appear on.
 
hmm you could use a "if" statement (lazy way) or code an addon for it.

Edit that, You would need to code an addon for this I would say. As the checkbox is on making a thread.
 
I already coded an addon for it. I just want to know how to do the select forums thing. Do you know how to do that?
The trick to doing stuff like this is to find an example of where it's already been done by XenForo.

In this case, what you're trying to do is replicated as part of the "page criteria" when editing notices.

We then go find the relevant template in admin templates, which happens to be notice_edit. The relevant code:
<xen:select name="page_criteria[nodes][data][node_ids]" size="12" multiple="true">
<xen:foreach loop="$pageCriteriaData.nodes" value="$_criteriaNode">
<xen: option value="{$_criteriaNode.node_id}"
selected="{$pageCriteria.nodes.node_ids} AND in_array({$_criteriaNode.node_id}, {$pageCriteria.nodes.node_ids})">
{xen:string repeat, '&nbsp; &nbsp; ', $_criteriaNode.depth}{$_criteriaNode.title}</xen: option>
</xen:foreach>
</xen:select>

I've bolded the interesting stuff.

We now need to find what's supplying the node information. Since notices are in the admin panel, go to /library/XenForo/ControllerAdmin/ and open up the relevant file, which is Notice.php

The function we're looking for is actionEdit() (since we were in the edit page for a notice), and this function leads us to _getNoticeAddEditResponse(), which tells us the source of the nodes:

Code:
'pageCriteriaData' => XenForo_Helper_Criteria::getDataForPageCriteriaSelection(),

You'll need to make a controller (and listener to load it?) for your template and pass this node information as part of the view parameters.
 
Last edited:
Top Bottom