Developer forum

Forum » Templates » UserManagement list template LoopStart(AllUsers) with user groups

UserManagement list template LoopStart(AllUsers) with user groups

Remi Muller
Reply

UserManagement list template LoopStart(AllUsers) with user groups.

 

 

Can i iterate the related extranet groups the for each user in the list template?

 

 

I do not see a template loop for this. It only works on the user detail template.

 

  

 

 


Replies

 
Nicolai Høeg Pedersen
Reply

That is not possible. You can use a user template extender though:

 http://developer.dynamicweb-cms.com/api8/#Dynamicweb~Dynamicweb.Modules.UserManagement.UserTemplateExtender.html

 

BR Nicolai

 
Mikkel Ricky
Reply
This post has been marked as an answer

Or using Razor:

@foreach (var u in GetLoop("AllUsers")) {
	var user = Dynamicweb.Modules.UserManagement.User.GetUserByID(u.GetInteger("UserManagement:User.ID"));

	<fieldset>
		<legend>@user.Name</legend>

		@if (user.Groups.Count > 0) {
		<div>Groups:
			@foreach (var group in user.Groups) {
				<span class="group">@group.Name</span>
			}
		</div>
		}
	</fieldset>
}

 

 

Votes for this answer: 1
 
Remi Muller
Reply

Thanks converted to razor template :)

 

You must be logged in to post in the forum