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

How to layout the primary plugin file for many menu options

Discussion in 'General Troubleshooting' started by valMETNG, Apr 28, 2012.

  1. valMETNG

    valMETNG Administrator Staff Member Admin

    So I feel a bit like an idiot but, after spending a few days on it, I think it's time I reach out for help.

    I've designed a bunch of functions that, if the user has been granted moderator status within a particular category, he is going to be able to perform certain actions only within that category (e.g., change the posted rules of the category, add other users as moderators, ban users from posting in that particular category). Candidly, and with no offense intended regarding the base design, I preferred this method over what appears to be the Hotaru default (which is that a moderator has control across all communities and has access to the admin panel to perform those actions).

    My ideal is to have a drop-down box as a widget on the side panel that lists the communities he's a moderator for and then, underneath each category, the actions he's allowed. For example, the drop-down would look something like this:

    -- Ban a user
    -- Unban a user
    -- Change category rules
    -- Remove spam
    -- Ban a user
    -- Unban a user
    -- Remove spam

    In other words, within each category that he's a moderator, he has different authorities.

    To me, the easy part was writing the functions to do those actions and creating the widget dropdown. With my head hung low, the hard part is figuring out how to best put these all into a plugin that displays the widget on the side and then accesses the various form (i.e., template) pages where the user will provide the necessary data. For example, if my dropdown looks something like:

    <option>--Ban a user</option>
    <option>--Unban a user</option>

    ...I can't figure out what URLs to provide to each of those so that they go to the appropriate forms in the mod plugin templates directory (e.g., if the user chooses ban a user under the Cars category, how do I send him to the ban_a_user.php template within the /mod/templates directory?).

    To further complicate it, I'd like the URL to display something like /category/cars/ban_a_user or /category/news/remove_spam.

    I just don't know how to best layout the primary plugin file (e.g., mod.php, within the mod plugin directory). For example, what does the "case" in the theme_index_top function look like (which would have a category variable and an action variable)? I tried to use the submit plugin as a template, but submit follows more a step-by-step process, whereas what I want to do here doesn't. It also doesn't put the category name in the URL, which I'd like to do.

    Would anyone be able to offer some direction here please? Many thanks.

    Edit: Never mind. I'm just going to parse the URI and redirect based upon that.
    Last edited: Apr 28, 2012

Share This Page