我可以从会员系统中获取登录用户名:
// Get user details
var user = Membership.GetUser();
IsLoggedIn = (user != null);
但是我如何获得他们的头像,用户ID和其他内容?谢谢你的任何帮助我真的被卡住了。
答案 0 :(得分:1)
我不是100%你正在使用哪个版本,所以我的基础是v1.9.5及更高版本。
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);