You need to sign in to do that
Don't have an account?
Lucas Isla
How to tell whether user is in Community or main Salesforce site
Hi,
I am trying to show special header and footer components on a Visualforce page if the user is logged into the Community.
Otherwise, if the user is just on the main Salesforce site, I want to render the page without the header and footer.
Is there an easy way to get the context of the user from within the Visualforce page to conditionally render these components based off of this?
Thanks
I am trying to show special header and footer components on a Visualforce page if the user is logged into the Community.
Otherwise, if the user is just on the main Salesforce site, I want to render the page without the header and footer.
Is there an easy way to get the context of the user from within the Visualforce page to conditionally render these components based off of this?
Thanks
Profile pfile = [Select Name from Profile where Id =: userinfo.getProfileid()];
String pname = pfile.name;
System.debug(pname);
Boolean isCommunityUser = false;
if(pname == 'Customer Community User') {
isCommunityUser = TRUE;
}
if(isCommunityUser){
// show header footer
}
You can replace 'Customer Community User' with your community Profile name.