Is is possible to check if a user is logged in, from inside a template. I know that it's easy from XSLT, but in my case, I can't use XSLT to make this check. This can easily be piece of cake for some of you guys, but I'm not quite sure if this is possible.
Thanks guys. Great that all the extensions are available in the templates as well. I knew it was easy for you guys :)
And Peter, I think that I could have used this one as well actually. Have just seen the umbraco.tv episodes about members and protection, and it looks straight forward. So this could be a solution as well.
Is it possible to insert the code on the template for all versions of umbraco? We are running on 3 (not sure of the exact version number but I can grab it if i need to) and it seems that the code below is displayed directly on the page.
<% if (umbraco.library:IsLoggedOn()) {%>
// Call Umbraco Macros here
<% } %>
Check if user is logged in from template
Hi all.
Is is possible to check if a user is logged in, from inside a template. I know that it's easy from XSLT, but in my case, I can't use XSLT to make this check. This can easily be piece of cake for some of you guys, but I'm not quite sure if this is possible.
Regards,
/Kim A
Kim,
you can use any xslt extension method from your template as well.
Cheers,
/Dirk
You can perhaphs also use asp:LoginView?
Thanks guys. Great that all the extensions are available in the templates as well. I knew it was easy for you guys :)
And Peter, I think that I could have used this one as well actually. Have just seen the umbraco.tv episodes about members and protection, and it looks straight forward. So this could be a solution as well.
/Kim A
Is it possible to insert the code on the template for all versions of umbraco? We are running on 3 (not sure of the exact version number but I can grab it if i need to) and it seems that the code below is displayed directly on the page.
<% if (umbraco.library:IsLoggedOn()) {%>
// Call Umbraco Macros here
<% } %>
Any ideas?
Also trying to acheive the samefunctionality from a template, i.e check if a user is logged in or not
If iuse the above code I get an error:
Compiler Error Message: CS1026: ) expected
Source Error:
Line 15: </umbraco:Macro> Line 16: Line 17: <% if (umbraco.library:IsLoggedOn()) {%> Line 18: // Call Umbraco Macros here Line 19: <% } %>
Am running umbraco 4.7.1
is my code just borked?
Tim,
If using the library function in templates (and therefore .net code), you need to replace the ':' with '.', so use
Furthermore, you'd better rely on the Membership api to achieve the same things, so you could aslo use
Cheers,
Dirk
Tim/Dirk, I think you will need to replace the colon with a dot seperator as the colon has no place there in c#. So it should in fact read:
if(umbraco.library.IsLoggedOn()){ %>
// do stuff if user is logged on
} %>
I had a problem with this but fixed it. So I deleted this post.
is working on a reply...