Rank: Fanatic
Joined: 7/21/2006 Posts: 255 Location: Salerno - Italy
|
How Can I change dynamically page/template or insert links or function for some registered users or groups???? That is: I'm login as user A then he see only functions and pages for A or A groups, B for B and so... Thanks Red Consulting s.a.s - Umbraco from v1.0
|
Rank: Devotee
Joined: 7/19/2006 Posts: 31
|
you could create different stylesheets, example: group1.css, group2.css.
Then I would create a xslt macro that create the link to the css files.
<xsl:if test="your.library:isMemberOfAGroup("group1",umbraco.library:GetCurrentMember()/@id)"> <link rel='stylesheet' type='text/css'href='/css/group1.css' /> </xsl:if>
so you can make a library with this c# code:
public static bool isMemberOfAGroup(string groupName, int memberId) { Member m = new Member(memberId); System.Collections.IDictionaryEnumerator en = m.Groups.GetEnumerator(); while (en.MoveNext()) { if(groupName == ((umbraco.cms.businesslogic.member.MemberGroup)en.Value).Text)return true; } return false; }
.NET/Umbraco developer @ ebita ApS
|
Rank: Devotee
Joined: 7/19/2006 Posts: 31
|
hmm deleted my xslt example, but ist something like this
if test="your.library:isMemberOfAGroup("group1",umbraco.library:GetCurrentMember()/@id)"> <link rel='stylesheet' type='text/css'href='/css/group1.css' /> /if
.NET/Umbraco developer @ ebita ApS
|
Rank: Fanatic
Joined: 7/21/2006 Posts: 255 Location: Salerno - Italy
|
Could you explain more precise ? Thanks Red Consulting s.a.s - Umbraco from v1.0
|