Developer forum

Forum » Templates » Usermanagement - Get Subgroups

Usermanagement - Get Subgroups

Mikkel Toustrup Olsen
Reply

Hello all,

I have a contact form on my frontpage where the user is able to search for a specific employee.

I have a main group(places) and below that x amount of subgroups(departments) which contains their respective employees. 

However, on my search result template for the users I cannot access the name of the subgroup and by that let the user know in what department he/she is located.

My current result template is structured as so.. 

<!--@LoopStart(AllUsers)--> 

HTML goes here..

<!--@LoopStart(Groups)-->

Html goes here..

<!--@LoopEnd(Groups)-->

<!--@LoopEnd(AllUsers)-->

 

I am able to get the group name "Places" however not the subgroup in which the specific user is a part of. Not by Dw template tag that is :)

Do I have to rewrite the template in razor to make use of LINQ or something? 

Best Regards,

MikkelTO


Replies

 
Mikkel Ricky
Reply

Razor is always a good idea:

<pre>
@foreach (var item in GetLoop("AllUsers"))
{
    var user = Dynamicweb.Modules.UserManagement.User.GetUserByID(item.GetInteger("UserManagement:User.ID"));
    @: @user.UserName
    foreach (var group in user.Groups)
    {
        @: @group.Name
    }
}
</pre>

Best regards,
Mikkel

 

You must be logged in to post in the forum