1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Select which forums something will appear on

Discussion in 'XenForo Development Discussions' started by Matthew Hawley, Dec 14, 2013.

  1. Matthew Hawley

    Matthew Hawley Well-Known Member

    I want to select which forums something will appear on.

    Like this:

    Any suggestions?
  2. Wuebit

    Wuebit Well-Known Member

    ???? Come again?????
    (and don't say "That's what she said!" :p)
    What is something and what forums?
  3. Matthew Hawley

    Matthew Hawley Well-Known Member

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

    This is the checkbox 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>
    I want to select which forums the checkbox will appear on.
  4. Wuebit

    Wuebit Well-Known Member

    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.
  5. Matthew Hawley

    Matthew Hawley Well-Known Member

    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?
  6. Wuebit

    Wuebit Well-Known Member

    No I don't my PHP coding skills are poor.
  7. ceribik

    ceribik Active Member

    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:
    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:

    '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: Dec 15, 2013

Share This Page