Yetanotherforum get logged in users details
I can get the logged in username from membership system:
// Get user details
var user = Membership.GetUser();
IsLoggedIn = (user != null);
Bu开发者_如何学Got how do I get things like their avatar, user ID and the rest? Thanks for any help I'm really stuck.
I'm not 100% which version you're on, so I'm basing this on the v1.9.5 and greater.
var user = Membership.GetUser();
// combined user data takes a membership user and
// will automatically cache repeated requests for user data.
var userData = new CombinedUserData(user);
// get avatar with v1.9.5 and greater
var avatarUrl = this.Get<IAvatar>().GetAvatarUrlForUser(userData);
// get avatar with versions before v1.9.5
var avatarUrl = new YafAvatar().GetAvatarUrlForUser(userData);
精彩评论