Snippets
27

using DotNetNuke.Entities.Profile;

string _value = GetUserProfilePropertyValue("MyCustomProfileField").ToString();

        public string GetUserProfilePropertyValue(string propertyName)
        {
            string value = null;
            ProfilePropertyDefinition ppd = UserInfo.Profile.GetProperty(propertyName);

            if (ppd == null)
            {
                value = "";
            }
            else
            {
                value = ppd.PropertyValue;
                if (value == null)
                {
                    if (string.IsNullOrEmpty(ppd.DefaultValue))
                    {
                        value = string.Empty;
                    }
                    else
                    {
                        value = ppd.DefaultValue;
                    }
                }
            }
            return value;
        }

Post Rating

Comments

There are currently no comments, be the first to post one!

Post Comment

Only registered users may post comments.

  120 OLD FREEMANS WAY, BREWSTER, MA 02631
  P. O. BOX 2342, BREWSTER, MA 02631
  (774) 323-3176
  CONTACT US