Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Yannick Smits 321 posts 718 karma points
    Oct 04, 2010 @ 17:27
    Yannick Smits
    0

    Can't produce list of members with properties

    I'm trying to produce a list of members (that belong to a member group) and show some of their properties. It's is listing the LoginName's correctly but fails to load the properties.

    Hope someone can help me out:

    <%
       string[] users = Roles.GetUsersInRole("Certified"); 
       foreach (string user in users)
       {
           MembershipUser mu = Membership.GetUser(user);
           var m = new Member((int)mu.ProviderUserKey);
    %>
      <h3><%= m.LoginName %></h3>
      <p><%= m.GenericProperties.Where(p => p.PropertyType.Alias == "Street").FirstOrDefault() %></p>
    <% }%>

    I've set the defaultMemberTypeAlias in the web.config.

  • Yannick Smits 321 posts 718 karma points
    Oct 04, 2010 @ 17:29
    Yannick Smits
    0

    on a side note, loading this code for 100 members takes over a minute!

  • Yannick Smits 321 posts 718 karma points
    Oct 04, 2010 @ 18:00
    Yannick Smits
    0

    As always just after posting I found the answer: propertyalias should be lowercase, even though you saved it upper-case!

    and the FirstOrDefault() needs .Value appended.

     

    If anybody want to comment on the speed that would still be very helpful!

  • Richard Soeteman 4046 posts 12899 karma points MVP 2x
    Oct 05, 2010 @ 08:31
    Richard Soeteman
    1

    Hi Yannick,

    I think each member has a lot of properties. When you request a poroperty it does a Database call, see also this blogpost. Had the same issue when developing MemberExport and changed my code to access the database directly.

    Cheers,

    Richard

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Oct 05, 2010 @ 09:06
    Dirk De Grave
    0

    Would go with Richard's suggestion and query the db directly instead of using the member api which may be slow when used with +100 members.

     

    Cheers,

    /Dirk

  • Yannick Smits 321 posts 718 karma points
    Oct 05, 2010 @ 11:41
    Yannick Smits
    0

    thanks guys. But if this member stuff in umbraco is slow and old wouldn't it be wiser to swap it out in favor of aspnet_Membership db scheme or would that break the membership admin UI and possibly other stuff?

    Not sure why this slow stuff is still in umbraco.

  • Brendan Rice 538 posts 1102 karma points
    Oct 05, 2010 @ 12:47
    Brendan Rice
    0

    Is there any plans on reworking the member API in future versions of Umbraco?  The fact that property getters/setters hit the database is a bit of an anti-pattern and I keep seeing problems popping up from it.

    I don't mind helping out if I can.

  • Richard Soeteman 4046 posts 12899 karma points MVP 2x
    Oct 05, 2010 @ 12:53
    Richard Soeteman
    0

    @Yannick You can plugin your own MemberShipprovider You can even view data, I think you can't update Data, not 100% sure.

    Since V5 is completely rearchitected I assume there will be no more performance issues for members and content. I'm not sure if the complete ASP.Net membership DB scheme will be implemented, since it's a provider model it  shouldn't matter as long as the underlying stucture is fast.

    Cheers,

    Richard

  • Yannick Smits 321 posts 718 karma points
    Oct 05, 2010 @ 12:55
    Yannick Smits
    0

    He Richard, I know about the possibility of configuring the web.config to use the SqlMembershipProvider but I was wondering what effect it'll have on the umbraco membership elements like the membership admin or even the permission system. Any experience with this to confirm that update is a no go with this approach like Richard says?

  • Yannick Smits 321 posts 718 karma points
    Oct 06, 2010 @ 13:26
    Yannick Smits
    0

    According to the wiki (http://our.umbraco.org/wiki/how-tos/membership-providers/how-to-integrate-aspnet-membership-control-with-umbraco) it is true what Richard says about not being able to edit custom user properties without doing some custom user controls.

    Should I add a codeplex workitem to request this feature?

  • Brendan Rice 538 posts 1102 karma points
    Oct 06, 2010 @ 17:08
    Brendan Rice
    0

    Yannick I think there is a package that might do what you are after.  I tried getting it working but there was a few bugs I had to overcome.  I am planning on realising it as a package but won't be for a few weeks until things calm down.

  • Yannick Smits 321 posts 718 karma points
    Oct 07, 2010 @ 15:44
    Yannick Smits
    0

    Yes there seems to be a profile editor in the osMemberControls. I've tested it on the frontend site not inside umbraco backend yet. Not sure how much work it would be to integrate it into the members section.

Please Sign in or register to post replies

Write your reply to:

Draft