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 ExtensionsModulesModulesGetCurrentUserInfo.CreatedByUserID and GetCurrentUserInfo.CreatedOnDate not working...GetCurrentUserInfo.CreatedByUserID and GetCurrentUserInfo.CreatedOnDate not working...
Previous
 
Next
New Post
8/17/2012 8:43 AM
 

I am reading user information from the user table and am getting weird results:

                    lblTesting.Text &= "<br>FirstName: " & UserController.GetCurrentUserInfo().FirstName & "<br>"
                    lblTesting.Text &= "<br>CreatedOnDate: " & UserController.GetCurrentUserInfo().CreatedOnDate & "<br>"
                    lblTesting.Text &= "<br>CreatedByUserID: " & UserController.GetCurrentUserInfo().CreatedByUserID & "<br>"

What happens is the first line works great, get's my name.  The next two do not get the right information:

DisplayName: Randy Ansems
CreatedByUserID: -1
CreatedOnDate: 12:00:00 AM

The CreatedByUserID should be 1 (+1) and the date should be last week sometime.

Any thoughts?  What am I missing?


 
New Post
8/17/2012 2:57 PM
 
I just looked in dbo.Users with Sql Server Management Studio, and CreatedByUserId is -1 which makes sense if you think about it. Your UserId before and while you registered (created the line you are looking at) was AnonymousUser = -1.

I would personally use CreatedOnDate.ToShortDateString() for the date portion which will also help with the string concatenation and maybe the results will remain in the order you say you are calling them.
 
New Post
8/23/2012 7:54 AM
 

Thanks for the comment, but I am actually reading this from the database for already created users.  To clarify:  I have 10 users who have registered over the past month, when I retrieve their info from the DB to display on a module I know their user ID and/or I can iterate through the list.

The problem being is that the two fields highlighted are not correct b/c I can see the datat in the user table being there as correct:

DisplayName: Randy Ansems
CreatedByUserID: -1
CreatedOnDate: 12:00:00 AM

CreatedByUserID should be a "1" for some b/c they were created by the admin, me.  The date should show a correct date.  I will use CreatedOnDate.ToShortDateString() but the date/time is still null.

Now I get:

DisplayName: Randy Ansems
FirstName: Randy
CreatedOnDate: Monday, January 01, 0001
CreatedByUserID: -1

as output....thoughts?



 
New Post
8/23/2012 1:44 PM
 

I managed to get the correct date using

lblTesting.Text &= "<br>FirstName: " & UserController.GetCurrentUserInfo().FirstName & "<br>"
lblTesting.Text &= "<br>CreatedOnDate: " & UserController.GetCurrentUserInfo().Membership.CreatedDate.ToShortDateString() & "<br>"
lblTesting.Text &= "<br>CreatedByUser: " & UserController.GetCurrentUserInfo().CreatedByUser(PortalId) & "<br>"

 
New Post
8/23/2012 2:32 PM
 

Now we are getting somewhere.  The created date works, but the Created by user did not.  What I am trying for is if someone of my staff creates a new user (member) they get rewarded, and or they will have some special privileges for the users they created.  

The problem of course right now is that I cannot see from DNN who created the user.  Even though it is stored in the user database correctly.  I might just have to do a DataReader with a stored proc to pull it our, but seems clunky and unnecessary.

 
Previous
 
Next
HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesGetCurrentUserInfo.CreatedByUserID and GetCurrentUserInfo.CreatedOnDate not working...GetCurrentUserInfo.CreatedByUserID and GetCurrentUserInfo.CreatedOnDate not working...


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