YAFLogo

johnk
  • johnk
  • 74.8% (Friendly)
  • YAF All-the-Time Topic Starter
12 years ago
How do we modify the URL rewriter.config file so that the url for profile is /forum/member/john

Currently it is /forum/default.aspx?g=profile&u=100

This will allows users to directly change username in URL to see others profile.

Another question:

In backend code, how do we get the profile ID number? We can get profile username by using User.Identity.Name, but not sure how to get the number (example 100 above).

Thank you 🙂

Sponsor
mc-kay
  • mc-kay
  • 50.2% (Neutral)
  • YAF Forumling
12 years ago
For your second question, try this:

public static int GetUserId(string userName)
{
	var yafUserData = new CombinedUserDataHelper(YafContext.Current
	.Get<MembershipProvider>().GetUser(userName, true));
	return yafUserData.UserID;
}
johnk
  • johnk
  • 74.8% (Friendly)
  • YAF All-the-Time Topic Starter
12 years ago
Thanks mc-kay. Another one I found is:

var UserID = YAF.Core.YafContext.Current.PageUserID;