Back to vBulletin 3 Articles

[How-To] Create your own Inline Moderation
by Revan 07 Jul 2006

This How-To will only work with the upcoming Beta 5 or RC1 or whatever they decide to name it. It will not work with Beta 4, because of http://www.vbulletin.com/forum/index.php?t=190808.

Wouldn't it be cool to have your own Inline Moderation? Of course it would. Especially if you paginate your results, you might want to mark multiple items across pages.

You don't need to understand AJAX in order to find this guide useful. Hell I don't know much AJAX, I'm just good at tinkering with code until it works

Im assuming you know how to create and submit forms, so I won't go into details on how to alter the example form in order to make it work with your hack.

Make sure your php file has the "inlinemod" phrasetype included.
  1. HTML Code:
    <form action="l2cp.php" method="post" id="banmanageform">
    The one thing you should know about this form is that the l2cp.php or whatever you decide to put there, is the file that will handle your inline moderation. vBulletin uses inlinemod.php for this purpose.
  2. In order to get the fancy dropdown menu, put this in the bit where you have the class="thead":
    HTML Code:
    <if condition="$show['popups']">
                    <td class="vbmenu_control" id="imod" align="center" title="$vbphrase[moderation]"><script type="text/javascript"> vbmenu_register('imod'); </script></td>
                <else />
                    <td class="tcat" align="center">
                        <input type="checkbox" name="allbox" id="checkall_all" title="$vbphrase[check_uncheck_all]" onclick="inlineMod.check_all()" />
                    </td>
                </if>
    Then a little later somewhere put this:
    HTML Code:
    <if condition="$show['popups']">
        <div class="vbmenu_popup" id="imod_menu" style="display:none" align="$stylevar[left]">
            <table cellpadding="4" cellspacing="1" border="0">
    <tr><td class="thead">$vbphrase[l2cp_from_this_page]</td></tr>
    <tr><td class="vbmenu_option" onclick="inlineMod.check_all(true)">$vbphrase[select_all]</td></tr>
    <tr><td class="vbmenu_option" onclick="inlineMod.check_all(false)" id="arse">$vbphrase[deselect_all]</td></tr>
    <tr><td class="vbmenu_option" onclick="inlineMod.check_all('invert')">$vbphrase[invert_selection]</td></tr>
    </table>
        </div>
    </if>
  3. Put this wherever you want it to appear:
    HTML Code:
    <strong>$vbphrase[moderation]</strong><br />
                <select name="do">
                    <optgroup label="$vbphrase[option]">
                        <option value="someaction">$vbphrase[somephrase]</option>
                    </optgroup>
                </select><input type="submit" class="button" id="inlinego" value="$vbphrase[go]" />
                <input type="hidden" name="s" value="$session[sessionhash]" />
                </div>
                <script type="text/javascript" src="clientscript/vbulletin_inlinemod.js?v=$vboptions[simpleversion]"></script>
                <script type="text/javascript">
                <!--
                inlineMod = new vB_Inline_Mod('inlineMod', 'post', 'banmanageform', '$vbphrase[go_x]', 'productname_inline');
                //-->
                </script>
    This has a ton of things to explain.
    First of all, the select is what determines what action the script should do.
    Secondly, theres the new vB_Inline_Mod(). That's used to instantiate the JS class. The first parameter is the varname, in this case inlineMod. Next you'll have whether or not this is a thread or a post, you have to leave it at post. Next is the form name like you defined above, then the vbphrase for the go (0) button, then the cookiename. You can make that anything you want, just make sure its unique.
  4. The final bit here is the checkbox that'll mark the result bit, so in your repeating template put this:
    HTML Code:
    <input type="checkbox" name="plist[$idvar]" id="plist_$idvar" style="vertical-align:middle; padding:0px; margin:0px 0px 0px 5px" />
    The only thing you need to change here is the $idvar. That can be anything such as {$result[userid]} or whatever.

That should do the trick
Feel free to ask if there's anything you find unclear, I was in sort of a hurry and Im not very good at explaining

Similar Mods

Inline Moderation Tools (v1.2.1) vBulletin 3.0 Full Releases

vblts.ru supports vBulletin®, 2022-2024