Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDevelopment and...Development and...Getting StartedGetting StartedCanCan't retrieve Profile setting for Email from my module
Previous
 
Next
New Post
10/21/2011 2:41 PM
 
I'm relatively new to module development and in the module I'm working on I would like to be able to retrieve the email value entered by the user when they registered on the site.  I'm using DNN 5.5 as my development environment. In my code behind I am able to use the following code to pull the first and last name and the address fields.

txtNewFname.Text = UserInfo.Profile.GetPropertyValue("FirstName")
txtNewLName.Text = UserInfo.Profile.GetPropertyValue("LastName")
txtNewAddress1.Text = UserInfo.Profile.GetPropertyValue("Street")
txtNewCity.Text = UserInfo.Profile.GetPropertyValue("City")

But when I try the same method for the email address I get no results.

txtNewEmail.Text = UserInfo.Profile.GetPropertyValue("Email")

When I looked into the database I noticed that the email address is not saved the same way that the other information is but rather is saved in the Users table.  Is there a simple way to retrieve the email address from the profile or do I need to read it directly from the Users table instead?

Any help on this would be greatly appreciated.
 
New Post
10/21/2011 3:31 PM
 
Try this:

UserInfo user = UserController.GetUser(PortalSettings.PortalId, UserId, true);
txtNewEmail.Text = user.Email.ToString();

Email is stored on the user.



Steven Webster
Manager, Community Platform
F5 Networks, DevCentral
 
New Post
10/21/2011 4:40 PM
 
That seems to do the trick.  I replaced the code I  had with:
        txtNewEmail.Text = UserInfo.Email

I tried doing the equivalent of your first statement in VB.Net but an error message telling me that the statement had been deprecated in 5.1.  Looks like you can get at the value without the extra statement.

Thanks for the help.  You have saved me a lot of time and grief.
 
New Post
10/21/2011 5:05 PM
 
Awesome. You must have already created the usercontroller earlier in your code so that first line is not needed.


Steven Webster
Manager, Community Platform
F5 Networks, DevCentral
 
New Post
10/23/2011 11:21 AM
 
please note, that username, displayname and email are user properties, while all other data is part of the user profile object, hence the difference. Profile properties are managed by the admin of each website and may even be deleted (though this is usually not a good idea).

Cheers from Germany,
Sebastian Leupold

dnnWerk - The DotNetNuke Experts   German Spoken DotNetNuke User Group

Speed up your DNN Websites with TurboDNN
 
Previous
 
Next
HomeHomeDevelopment and...Development and...Getting StartedGetting StartedCanCan't retrieve Profile setting for Email from my module


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out