Copied to clipboard

Flag this post as spam?

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


  • Tom 713 posts 954 karma points
    Apr 07, 2011 @ 06:06
    Tom
    0

    Member.GetMemberFromLoginName Obselete..

    Hi all I've upgraded to 4.7 and I'm getting the following warning.. the problem with using the standard membership info is then how am I supposed to access a member's properties

    Warning    26  'umbraco.cms.businesslogic.member.Member.GetMemberFromLoginName(string)' is obsolete: '"Use System.Web.Security.Membership.GetUser"'    C:\Users\tom\Dev\PasticheWholesale\Pastiche.Wholesale.Web\usercontrols\MemberLoginUserControl.ascx.cs   15  24  Pastiche.Wholesale.Web
    
  • Simon steed 378 posts 700 karma points
    Oct 27, 2011 @ 12:40
    Simon steed
    0

    Bump !!!

  • Simon steed 378 posts 700 karma points
    Oct 27, 2011 @ 13:30
    Simon steed
    1

    Some code that may help someone else in the same situation :-)

     

    string[] rolesArray;
    
                // get currently logged in user
                var member = System.Web.Security.Membership.GetUser();
    
                rolesArray = Roles.GetRolesForUser();
    
                System.Text.StringBuilder sb = new System.Text.StringBuilder();
                sb.Append("Roles for " + member.UserName);
                foreach (string role in rolesArray)
                {
                    sb.Append(role);
                }
    
                var profile = ProfileBase.Create(member.UserName);
                profile.SetPropertyValue("datePlanExpires"DateTime.Now.AddDays(30));
                profile["interests"] = sb.ToString();
                profile.Save();
    
  • Simon steed 378 posts 700 karma points
    Oct 27, 2011 @ 13:30
  • Tom 713 posts 954 karma points
    Oct 27, 2011 @ 23:52
    Tom
    0

    Cheers Simon,

    Most appreciated!!

  • Simon steed 378 posts 700 karma points
    Oct 28, 2011 @ 00:21
    Simon steed
    0

    Pleasure - little late to help you but hopefully will get someone out of the same hole we were both in :-)

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies