Portal Engine Questions on portal engine and web parts.
Version 6.x > Portal Engine > How i can Find out which user upload media in media gallery ? View modes: 
User avatar
Member
Member
mehdi_nafisi-ymail - 9/17/2013 5:55:16 AM
   
How i can Find out which user upload media in media gallery ?
Hi,
I have to write name of user( that upload file in media gallery) in front of file that he/she upload into site ...
How i can understand the name or username of user that upload file in media gallery ?

Best Regards,
Mehdi

User avatar
Kentico Support
Kentico Support
kentico_janh - 9/17/2013 6:08:41 AM
   
RE:How i can Find out which user upload media in media gallery ?
Hello,

You can find the UserID of a user who uploaded a media file in the Media_File table or in the media file info object through the FileCreatedByUserID column/property.

Best regards,
Jan Hermann

User avatar
Member
Member
mehdi_nafisi-ymail - 9/17/2013 6:10:32 AM
   
RE:How i can Find out which user upload media in media gallery ?
Hi,
Thanks a lot for your help.
Can you give me a sample in Transformation Code that you use of FileCreatedByUserID ?

User avatar
Member
Member
mehdi_nafisi-ymail - 9/17/2013 6:59:41 AM
   
RE:How i can Find out which user upload media in media gallery ?
Thanks a lot Jan,
I found a solution.
I write this method to my Public Static Class and use in Transformation and esaily get use full name :

 public static string GetUserNamee(object userId)
{
int id = ValidationHelper.GetInteger(userId, 0);
UserInfo user = CMS.SiteProvider.UserInfoProvider.GetUserInfo(id);
return user.FullName;
}

User avatar
Kentico Legend
Kentico Legend
Accepted solutionAccepted solution
Brenden Kehren - 9/17/2013 7:41:25 AM
   
RE:How i can Find out which user upload media in media gallery ?
Without writing your own code, take advantage of the Providers Kentico offers.
string username = CMS.SiteProvider.UserInfoProvider.GetUserInfo(ValidationHelper.GetInteger(Eval("FileCreatedByUserId"), 0)).UserName;
This will work perfect within your transformation.

User avatar
Member
Member
mehdi_nafisi-ymail - 9/17/2013 7:47:50 AM
   
RE:How i can Find out which user upload media in media gallery ?
Thank You very much FroggEye

Your code is very helpfull