I've been searching around for a good while now, and most of the info I am finding seems to pertain to the older membership model. I am using Umbraco 4.7 and ASP.NET membership.
Overall what I'm trying to do is simple: create a usercontrol that allows a person logged in and in the admin member group the ability to edit the profiles of others. To do this, I need to do a seemingly super simple task: create a list of users by name (real name, not username).
I've created custom params for the user type (aliases firstName and lastName), and after doing some digging thought that I might be able to access this info by node ID. For example:
Dim Member AsMembershipUser = System.Web.Security.Membership.GetUser(RoleMembers(x)) Dim MemberID AsInteger = CInt(Member.ProviderUserKey) Dim MemberNode AsNewNode(MemberID) Dim FirstName AsString = MemberNode.GetProperty("firstName").Value
(RoleMembers() is just an array of usernames that we are iterating through)
However, this returns the following error: "No published item exist with id 1080"
And yet, here it is:
I've also read about creating a derivative of the Profile base, editing web config, etc, however this seems like a complicated solution to a simple problem, and it only seems to work for accessing the properties of the user currently logged in, not an arbitrary user.
Any suggestions are greatly appreciated. Maybe I'm totally in the wrong direction on this, but it does seem to me like this should be simple, so I assume I'm missing something.
Instead of using the umbraco.presentation.nodeFactory.Node class you'll want to use the umbraco.cms.businesslogic.member.Member class.
Dim Member As MembershipUser = System.Web.Security.Membership.GetUser(RoleMembers(x)) Dim MemberID As Integer = CInt(Member.ProviderUserKey) Dim MemberNode As New Member(MemberID) Dim FirstName As String = MemberNode.getProperty("firstName").Value
Accessing info about a member by node ID
Hello,
I've been searching around for a good while now, and most of the info I am finding seems to pertain to the older membership model. I am using Umbraco 4.7 and ASP.NET membership.
Overall what I'm trying to do is simple: create a usercontrol that allows a person logged in and in the admin member group the ability to edit the profiles of others. To do this, I need to do a seemingly super simple task: create a list of users by name (real name, not username).
I've created custom params for the user type (aliases firstName and lastName), and after doing some digging thought that I might be able to access this info by node ID. For example:
Dim Member As MembershipUser = System.Web.Security.Membership.GetUser(RoleMembers(x))
Dim MemberID As Integer = CInt(Member.ProviderUserKey)
Dim MemberNode As New Node(MemberID)
Dim FirstName As String = MemberNode.GetProperty("firstName").Value
(RoleMembers() is just an array of usernames that we are iterating through)
However, this returns the following error: "No published item exist with id 1080"
And yet, here it is:
I've also read about creating a derivative of the Profile base, editing web config, etc, however this seems like a complicated solution to a simple problem, and it only seems to work for accessing the properties of the user currently logged in, not an arbitrary user.
Any suggestions are greatly appreciated. Maybe I'm totally in the wrong direction on this, but it does seem to me like this should be simple, so I assume I'm missing something.
Hi Joe,
Instead of using the umbraco.presentation.nodeFactory.Node class you'll want to use the umbraco.cms.businesslogic.member.Member class.
HTH,
Hendy
Hendy,
That worked perfectly. Thank you sir.
is working on a reply...