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...Building ExtensionsBuilding ExtensionsModulesModuleschange username in codechange username in code
Previous
 
Next
New Post
9/3/2013 5:39 AM
 
no, that does nothing.. I am guessing it needs to be explicity updated..

Something like this:

UserController.UpdateUser(portalID,m UserInfo User)

But I can't find an example..

DNN API documentation is non existent. Its pathetic.. I think I am going to have to look for an alternative to DNN.
This really isn't much fun...

"if the only tool you have is a hammer you tend to see every problem as a nail" http://www.carawaydesign.com
 
New Post
9/3/2013 6:10 AM
 
tried this:

UserInfo userInfo = UserController.GetUserById(PortalId,UserId);
// userInfo.Username = txtNewEmail.Text;
userInfo.Email = txtNewEmail.Text;
userInfo.Membership.Approved = false;

UserController.UpdateUser(PortalId, userInfo);

Works great until you uncomment the line that sets the username. It blows with an critical error. Object ref not set.
So the API won't let me change the username. Be interested to see how its done in DNN7 in the user manager..

guess there's only one way to find out..


"if the only tool you have is a hammer you tend to see every problem as a nail" http://www.carawaydesign.com
 
New Post
9/3/2013 4:35 PM
 
I looked in the DNN 7.1.1 source and found a new method: ChangeUsername on UserController.

I ended up with this code that works. But if you try to call ChangeUsername before UpdateUser it will blow.
I send the user an email and log them out immediately after this code and redirect them to a success page.
They get a new authorisation email and have to re-verify their account.
It all seems to work but I have no idea how sensible (stable/reliable) this approach is.

// change the username and email and unauthorise the user
UserInfo userInfo = UserController.GetUserById(PortalId,UserId);
userInfo.Email = txtNewEmail.Text;
userInfo.Membership.Approved = false;
UserController.UpdateUser(PortalId, userInfo);
UserController.ChangeUsername(UserId, txtNewEmail.Text);

If the DNN API had proper documentation I might not have found myself in this mess. It really is frustrating to have to work on this.
Considering how long DNN has been going we're still fumbling in the dark..

BTW. The feature to update a username was added in DNN 7.1.0:

https://dnntracker.atlassian.net/browse/DNN-21512

Gus

"if the only tool you have is a hammer you tend to see every problem as a nail" http://www.carawaydesign.com
 
New Post
9/3/2013 6:45 PM
 
Good on you for letting us know how it went! Thanks.

Best wishes,
- Richard
Agile Development Consultant, Practitioner, and Trainer
www.dynamisys.co.uk
 
New Post
9/4/2013 4:02 AM
 
You may also add your findings to the Wiki. This will make it easier for others to solve the same problem. Thank you.

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...Building ExtensionsBuilding ExtensionsModulesModuleschange username in codechange username in code


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