Login  Register

How to display user profile (instead of admin profile)

Posted by Coleen_Astalos on Feb 28, 2014; 6:55am
URL: https://support.nabble.com/How-to-display-user-profile-instead-of-admin-profile-tp7589589.html

Ok, I'm pulling my hair out.  I just don't understand the NAML well enough to figure out how to make the change to show the users profile who I just edited in the subscription_msg code (instead of the Admin users).  <n.visitor.profile_header/> gives me my admin user profile and I know that's what I need to change.  So this is what I've done...

So I started with this (base Nabble):  
<macro name="subscription_saved_url">
    <n.remove_spaces.>
        <n.page_node.base_url/>
        /template/NamlServlet.jtp?macro=subscription_saved&node=<n.page_node.id/>
    </n.remove_spaces.>
</macro> 

 <macro name="subscription_saved" requires="servlet">
    <n.node_page.>
        <n.subscription_msg
            header="[t]Subscription Confirmed[/t]"
            message="[t]Your subscription has been successfully saved.[/t]"
        />
    </n.node_page.>
</macro> 

 <override_macro name="subscription_msg" parameters="header,message">
    <n.html>
        <head>
            <n.title.><n.header/></n.title.>
            <n.main_title_css/>
        </head>
        <body>
            <n.visitor.profile_header/>
            <div class="shaded-bg-color rounded second-font main-title">
                <n.header/>
            </div>
 
            <table style="margin-bottom:1em">
                <tr valign="top">
                    <td><img src="/images/success.png" class="image16"/></td>
                    <td>
                        <b><n.message/></b>
                        <p><a href="[n.display_user_subscriptions_path/]"><t>Return to all Subscriptions Page</t></a></p>
                        <p><a href="[n.page_node.url/]"><t>Return to <t.location.page_node.subject/></t></a></p>
                    </td>
                </tr>
            </table>
        </body>
    </n.html>
</override_macro> 
And copied them to create new "user" versions...
<macro name="subscription_saved_user_url" requires="user">
   <n.set_local_user.this_user/>
   <n.remove_spaces.>
        <n.page_node.base_url/>
        /template/NamlServlet.jtp?macro=subscription_saved_user&node=<n.page_node.id/>&user=<n.local_user.id/>
    </n.remove_spaces.>
</macro>
I wasn't sure if I needed to add the &user to the URL to be able to get the user info into the subscription_saved_user macro.

Then I updated the subscription_saved_user macro to this (just changing to call subscription_msg_user instead)
<macro name="subscription_saved_user" requires="servlet" >
    <n.node_page.>
        <n.subscription_msg_user
            header="[t]Subscription Confirmed[/t]"
            message="[t]User subscription has been successfully saved.[/t]"
        />
    </n.node_page.>
</macro>
But I couldn't figure out how to change subscription_msg_user to get the "user" information to it.  When I tried to add the  requires="user" to the macro name line, it doesn't like it.    So then I tried to add "user" to the parameter list and pass it in as a parameter - which appeared worked, but then it didn't like the setting of local_user to either "this_user" or just "user", so I could change the profile header line to  <n.local_user.profile_header/>

I'm sure it's probably something relatively simple that I'm just not getting.  I was hoping if I could figure this out, then maybe I could figure out how to make the "unsubscribe" work for the administrator on the user_nodes page we set up.  I'm really trying to do this without pestering you too much as I know you've probably had enough of me right now.

Thanks,
Coleen