Login  Register

Re: Edit User groups for Subcategory

Posted by Pedro on Mar 19, 2014; 2:58pm
URL: https://support.nabble.com/Edit-User-groups-for-Subcategory-tp7589823p7589864.html

Please, try this:
<override_macro name="menu_manage_users_and_groups" requires="node">
    <n.if.is_in_command name="dropdown">
        <then>
             dropdown.add('manageGroups', '<n.javascript_string_encode.manage_users_and_groups_link/>', 'display:none');
        </then>
        <else>
            <n.set_local_node.this_node/>
            <n.if.both condition1="[n.local_node.is_root/]" condition2="[n.visitor.can_manage_users_and_groups/]">
                <then>
                    NabbleDropdown.show('manageGroups');
                    <n.if.visitor.is_in_group group="master" >
                        <then>
                            $(document).ready(function() {
                            var group = $("#manageGroups a").attr("href");
                            $("#manageGroups a").attr("href",group+"&group=subForum");                         
                            });
                        </then>
                    </n.if.visitor.is_in_group>
                </then>
            </n.if.both>
        </else>
    </n.if.is_in_command>
</override_macro>

<override_macro name="can_manage_users_and_groups" requires="user">
        <n.either>
        <condition1.is_site_admin/>
        <condition2.is_in_group group="master" />
    </n.either>
</override_macro>

<override_macro name="manage_users_and_groups" requires="servlet">
    <n.if.not.visitor.can_manage_users_and_groups>
        <then>
            <n.login.><t>Only authorized users can proceed in this area.</t></n.login.>
        </then>
    </n.if.not.visitor.can_manage_users_and_groups>
    
    <n.if.is_submitted_form>
        <then.save_users_and_group/>
    </n.if.is_submitted_form>
    
    <n.html>
        <head>
            <META NAME="robots" CONTENT="noindex,nofollow"/>
            <n.title.><t>Manage Users & Groups</t></n.title.>
                <n.if.is_submitted_form>
                    <then>
                        <script type="text/javascript">
                            $(document).ready(function() {
                            notice('<t>Data successfully saved</t>', 2000, 1000);
                            });
                        </script>
                    </then>
                </n.if.is_submitted_form>
                </head>
                <body>
                    <n.edit_header first_text="[t]Manage Users & Groups[/t]" second_text="[n.root_node.subject/]" />
                    
                    <div class="weak-color" style="margin-top:1em">
                        <t>Below you can manage groups and users. You can copy and paste users in order
                            to move them from one group to another.</t>
                    </div>
                    
                    <div class="weak-color" style="margin:.5em 0 1em">
                        <t>You can also <n.root_node.change_permissions_link.>change the permissions</n.root_node.change_permissions_link.> of the groups below.</t>
                    </div>
                    
                    <n.user_groups.>
                        <n.add.members_group/>
                        <n.add.administrators_group/>
                        <n.sort/>
                        <n.vertical_tab_control.>                           
                            <n.if.visitor.is_in_group group="master" >
                                <then>
                                    <n.add_group_vertical_tab group="subForum"/>
                                </then>
                                <else>   
                                    <n.add_new_group_vertical_tab/>                                 
                                    <n.add_all_users_vertical_tab/>
                                    <n.add_registered_vertical_tab/>
                                    <n.loop.>
                                        <n.add_group_vertical_tab group="[n.current_group/]"/>
                                    </n.loop.>
                                </else>
                            </n.if.visitor.is_in_group>
                            <n.reset_list_index/>
                        </n.vertical_tab_control.>
                    </n.user_groups.>
                </body>
    </n.html>
</override_macro>
You can add the User only in "master" group. Take a look at the code and let me know if you want any explanation.
My test forum.