Sharepoint: find out if current user belongs to specified group

sharepoint

Solution

I stumbled upon your post because I have (IMHO) the exact same question, but the replies seem somehow not to match that. So I went on searching and found http://www.eggheadcafe.com/conversation.aspx?messageid=30460140&threadid=30420861:

SPWeb site = SPContext.Current.Web;
SPGroup managerGroup = site.Groups["SP_Project_Manager"];
bool isManager = site.IsCurrentUserMemberOfGroup(managerGroup);

As of 2013, according to s654m's comment, the signature seems to have changed:

bool isManager = site.IsCurrentUserMemberOfGroup(managerGroup.ID);

Problem

How can I find out programmatically if current user belongs to some group on sharepoint website? I need it because I would like to show a different content for the users belonging to one group.

Original source