Login  Register

Re: Really need some more Admin capabilities

Posted by Pedro on Feb 19, 2014; 4:54am
URL: https://support.nabble.com/Really-need-some-more-Admin-capabilities-tp7589349p7589460.html

For your own user, the code would be like below. Some macros you already have. Note the difference between  your own profile and the others.
<override_macro name="user_nodes" requires="servlet">
    <n.user_page.>
        <n.html>
            <head>
                <n.user_nodes_meta/>
                <n.title.>
                    <t>Profile of <t.author.page_user.name/></t>
                    <n.hide_if_equals. value1="[n.user_nodes_page_number/]" value2="1">
                        | <t>Page <t.number.user_nodes_page_number/></t>
                    </n.hide_if_equals.>
                </n.title.>
                <style type="text/css">
                    table.nodes {
                    width:100%;
                    border-collapse:collapse;
                    }
                    table.nodes td {
                    padding:.3em;
                    }
                    table.nodes td.header {
                    padding: .2em;
                    font-weight:bold;
                    }
                    div.table-title {
                    font-weight:bold;
                    font-size:120%;
                    margin: 1em .1em 1em;
                    }
                </style>
                <style type="text/css">  
                    table.subscriptions {  
                    border-collapse:collapse;  
                    margin-top:1em;  
                    clear:both;  
                    width:100%  
                    } 
                    table.subscriptions th {  
                    padding: .3em .6em;  
                    text-align:left;  
                    border-bottom-style:solid;  
                    border-bottom-width:2px;  
                    }  
                    table.subscriptions td {  
                    padding: .1em .6em; 
                    }  
                </style> 
            </head>
            <body>
                <n.page_user.profile_header/>
                
                <n.user_nodes_search_box/>
                

                
                <!-- If this is the profile of the visitor -->
                <n.if.visitor.equals.page_user>
                    <then>
                        
                        <n.horizontal_tab_control.>
                            <n.add_horizontal_tab url="" text="[t]Your Posts in [t.location.root_node.subject/][/t]" selected="true" details=""/>
                            <n.add_horizontal_tab url="[n.starred_nodes_path/]" text="[n.small_star_icon/] [t]Stars in [t.location.root_node.subject/][/t]" selected="false" details=""/>
                            
                            <n.add_horizontal_tab url="[n.display_user_subscriptions_path/]" text="[t]Subscriptions[/t]" selected="false" details=""/>
                            
                        </n.horizontal_tab_control.>
                        
                    </then>
                    <else>
                        <n.if.visitor.is_site_admin>
                            <then>
                                <n.display_user_subscription/>
                            </then>
                        </n.if.visitor.is_site_admin>
                
                        <div class="second-font table-title">
                            <t>Posts in <t.location.root_node.subject/></t>
                        </div>
                    </else>
                </n.if.visitor.equals.page_user>
                
                <n.user_nodes_table.>
                    <n.date_column width="7em"/>
                    <n.subject_column/>
                    <n.count_column/>
                    <n.location_column/>
                </n.user_nodes_table.>
            </body>
        </n.html>
    </n.user_page.>
</override_macro>

<macro name="display_user_subscription" requires="servlet">
    <n.root_node.descendant_apps_list.>
        <br/><span style="text-decoration: underline;"><b>Current Subscriptions</b>: </span>
        <table class="subscriptions">  
            <tr class="shaded-bg-color">  
                <th class="medium-border-color"><t>Forum Category</t></th>  
                <th class="medium-border-color"><t>Your category email address</t></th>  
                <th class="medium-border-color"><t>Subscription Type</t></th>  
                <th class="medium-border-color"><t>Frequency</t></th>  
                <th class="medium-border-color"></th>  
            </tr>  
            <n.loop.>
                <tr>  
                    <td class="nowrap"><n.current_node.subject/></td>
                    <td class="nowrap"><n.current_node.user_address email="[n.page_user.user_email/]"/></td>  
                    <n.set_local_subscription.current_node.subscription_for email="[n.page_user.user_email/]" />
                    <n.if.local_subscription.is_subscribed>
                        <then>
                            <td class="nowrap"><n.local_subscription.type_label/></td>
                            <td class="nowrap"><n.local_subscription.type/></td>                                    
                        </then>
                        <else>
                            <td class="nowrap">Not subscribed.</td>
                            <td class="nowrap">Not subscribed.</td>
                        </else>
                    </n.if.local_subscription.is_subscribed>
                    <n.if.visitor.can_view.current_node>
                        <then>
                            <td class="nowrap"><a href="/template/NamlServlet.jtp?macro=subscribe_user&node=[n.current_node.id/]&user=[n.page_user.id/]"><t>Edit Subscription</t></a>                                      
                            </td>
                        </then>
                        <else>
                            <td class="nowrap">Not Authorized</td>
                        </else>
                    </n.if.visitor.can_view.current_node> 
                </tr>
                
            </n.loop.>
            <br/>
        </table>
    </n.root_node.descendant_apps_list.>
</macro>

<macro name="display_user_subscriptions" requires="servlet">
    <n.visitor.as_user_page.>
        <n.if.not.page_user.is_registered>
            <then>
                <n.login.><t>You must login to view this page.</t></n.login.>
            </then>
        </n.if.not.page_user.is_registered>
        <n.html>
            <head>
                <n.title.><t>Stars in <t.location.root_node.subject/></t></n.title.>
                <style type="text/css">
                    table.nodes {
                    width:100%;
                    border-collapse:collapse;
                    }
                    table.nodes td {
                    padding:.3em;
                    }
                    table.nodes td.header {
                    padding: .2em;
                    font-weight:bold;
                    }
                    div.table-title {
                    font-weight:bold;
                    font-size:120%;
                    margin: 1em .1em .3em;
                    }
                </style>
            </head>
            <body>
                <n.page_user.profile_header/>
                
                <n.starrer_nodes_search_box/>
                
                <n.horizontal_tab_control.>
                    <n.add_horizontal_tab url="[n.starred_nodes_path/]" text="[n.small_star_icon/] [t]Stars in [t.location.root_node.subject/][/t]" selected="false" details=""/>
                    <n.add_horizontal_tab url="[n.page_user.path/]" text="[t]Posts in [t.location.root_node.subject/][/t]" selected="false" details=""/>
                    <n.add_horizontal_tab url="" text="[t]Subscriptions[/t]" selected="true" details=""/>
                </n.horizontal_tab_control.>
                
                <n.display_user_subscription/>
                
            </body>
        </n.html>
    </n.visitor.as_user_page.>
</macro>

<macro name="display_user_subscriptions_path">
    <n.encode_url.>
        /template/NamlServlet.jtp?macro=display_user_subscriptions
    </n.encode_url.>
</macro>

My test forum.