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

HomeHomeUsing DNN Platf...Using DNN Platf...Using Modules a...Using Modules a...How to get user biographyHow to get user biography
Previous
 
Next
New Post
10/4/2011 2:12 PM
 
I'm writing a module to display some user details, using UserController and UserInfo to get the information (from UserInfo.Profile).  This is working fine for things like DisplayName, Website, etc., howerver, I am stuck on getting the user biography.  Can someone point me in the right direction to being able to programmatically get a users biography.
 
New Post
10/4/2011 10:17 PM
 
Its a profile property - see http://www.kemmis.info/blog/archive/2007/10/26/letrsquos-talk-dotnetnuke-user-personalization.aspx as an explanation of this - for biography the naming container is "Preferences" with the key being "Biography". You can also implement token replace in your module and then just use [PROFILE:BIOGRAPHY] - see http://www.dotnetnuke.com/Resources/Blogs/EntryId/1547/4-6-0-A-Sneak-Peek-5-Token-Replace.aspx

Buy the new Professional DNN7: Open Source .NET CMS Platform book Amazon US
 
New Post
10/5/2011 1:37 PM
 
Thanks for the quick reply Cathal.  I have checked out the link you posted.  While I think I am close I'm still not there.  My code is below and evey thing works (except the Biography).  Would you have any suggestions.

protected void getUser(object sender, EventArgs e)
{
    int portalID = new PortalInfo().PortalID;
    int moduleID = new ModuleInfo().ModuleID;
    Int32 userID = Convert.ToInt32(myUserID.Text);

    Panel userInfo = new Panel() {CssClass="frameUserInfo" };

    UserController userController = new UserController();
    UserInfo user = userController.GetUser(portalID,userID );

    if (user != null)
    {
        userInfo.Controls.Add(new Label() {Text = "User: " + user.DisplayName + " - " + user.Email + "<br /><br />"});
        userInfo.Controls.Add(new Label() {Text = "Website: " + user.Profile.Website + "<br /><br />" });
        userInfo.Controls.Add(new Label() { Text = "Biography: <br />" });

        PersonalizationController pcc = new PersonalizationController();
        PersonalizationInfo pci = pcc.LoadProfile(userID,portalID);
        
        if (pci != null)
        {
            userInfo.Controls.Add(new Label() { Text = (string)Personalization.GetProfile(pci, moduleID.ToString(), "Biography")});
        }
    }
    frame.Controls.Add(userInfo);
}

Note: insert code did not work, so I manually adjusted the indents; incase it does not look right.

 
New Post
10/5/2011 6:37 PM
 
you need the naming container, otherwise it only searches the default container i.e. Personalization.GetProfile("Preferences","Biography")

Buy the new Professional DNN7: Open Source .NET CMS Platform book Amazon US
 
New Post
10/7/2011 2:36 PM
 
I have tried:

userInfo.Controls.Add(new Label() { Text = (string)Personalization.GetProfile(pci, "Preferences", "Biography") });
and
userInfo.Controls.Add(new Label() { Text = (string)Personalization.GetProfile("Preferences", "Biography") });

No success on the above. I have also used response.write to test the output without luck.  In my code (previous post), I have also use response.write and can confirm that PortalID and pci (PersonalizationInfo) are correct. 
 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Using Modules a...Using Modules a...How to get user biographyHow to get user biography


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