Using the DotNetNuke Profile Photo in a Custom Module

no_avatar dnnprofilephoto

 private string GetUserPhotoUrl(UserInfo user)
 {
        if (user.Profile.Photo == null || user.Profile.Photo == "-1")
            return user.Profile.PhotoURL;
        else
            return VirtualPathUtility.ToAbsolute("~/LinkClick.aspx") + "?fileticket=" + user.Profile.Photo;
 }

An anonymous user or a user without a profile photo will always get the default no_avatar.gif image.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>