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...DNN Platform (o...DNN Platform (o...Populating UsersPopulating Users' Avatars
Previous
 
Next
New Post
8/1/2011 2:58 AM
 
Everything's working fine now, except for one final hurdle.

User Avatars are being generated and stored to disk in the appropriate Users folder. The Folders database is queried for a FolderID if the folder already exists, otherwise the AddFolder stored procedure is called to generate a FolderID.

The FolderID is used in calling the AddFile stored procedure to register the avatar file with the database and generate a FileID.

Finally, UpdateUserProfileProperty is called to update the user's Picture property with the FileID.

The final hurdle is that the new avatars are shown in the forum for users who have existing avatar images, but not for those who didn't previously have an image set (they were all reset when the forum was upgraded to use the Profile Picture instead of the old Forum Avatar). Now, I recall reading that a user just has to go to their forum settings to fix this (something just needs to be initialized with a visit to the settings page), but is there any way for my app to do this automatically?
 
New Post
8/1/2011 3:58 AM
 
Found the bug. Turns out that the stored procedure UpdateUserProfileProperty, while appearing to accept "-1" as a ProfileID when you don't know what the ProfileID is, won't properly work unless you instead pass a Null as the ProfileID.

All works now, and I'm happy.
 
New Post
8/1/2011 11:27 AM
 
Hi Mike, congratulations on working out the solution and thanks for posting your step by step findings, I'm sure it will prove useful to someone else.

Buy the new Professional DNN7: Open Source .NET CMS Platform book Amazon US
 
New Post
8/15/2011 10:59 AM
 
Mike Cattle wrote:
Finally found what I was looking for in DotNetNuke.Common.Utilities.PathUtils.cs.

The user file path is %Portal%/Users/(UserID AND 255)/(UserID Mod 100)/UserID/, with the first two values padded to three and two digits respectively.

Could you clarify this more please?

You say that the first number is (UserID AND 255).  What does that mean? 

Thanks,
Michael

 
New Post
8/17/2011 2:07 AM
 
In that case, I'm talking about a bitwise or binary mathematical AND. In VB.NET it would be done with the expression (UserID AND 255). In C#, the expression would be (UserID & 255). Both expressions return an integer.

The expression takes the value of the lowest byte of the UserID, and is functionally equivalent to the expression (UserID Mod 256), which would also strip the UserID of anything above the lowest byte.

So, a UserID of 483, when run through the expression, would give you 227, since (483 & 255) = 227. Likewise, from the numbers in a previous post in this thread, (489 & 255) = 233, for a UserID of 489.You may notice that UserIDs that are below 256 would equal themselves, so a UserID of 19 would return 19 (or actually 019 for the directory folder, as it requires three digits).

The logic behind the naming convention for these folders, as far as I can gather, is a means of clustering the User's private folders so as to avoid limitations in the server's file system when a website with tens or hundreds of thousands of users tries to create tens or hundreds of thousands of subfolders in a single folder. Using this system, there are at most 256 folders as children of the portal's Users/ folder, and each of those child folders would have at most 100 children themselves. By clustering the subfolders like this, no single folder will have thousands of child folders, and the server is happy.
 
Previous
 
Next
HomeHomeDevelopment and...Development and...DNN Platform (o...DNN Platform (o...Populating UsersPopulating Users' Avatars


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