I have a controller extension and want to use the Tabbed view to get rid of the Chatter caused endless scrolling.
public class UserProfileGetter {
public UserProfileGetter(ApexPages.StandardController controller) {
String userProfileName = [select u.Profile.Name, id, UserType from User u where u.id = :Userinfo.getUserId()].Profile.Name;
system.debug('Profile===================='+userProfileName);
}
}
When I run the debug it shows my Profile as 'System Administrator' correctly.
My VF page code:
<apex:page standardController="Account" extensions="UserProfileGetter" showHeader="true" tabStyle="account" >
<apex:tab label="Opportunities" name="Opportunities" id="tabOpp" rendered="{userProfileName!='Chatter Content'}">
<apex:relatedList subject="{!account}" list="opportunities" />
</apex:tab>
</apex:tabPanel>
</apex:page>
So the logic for render I want is - if the user profile name isn't Chatter Content, render. But if I have this logic in the page it won't render for anyone, including me. Ideas? Thanks
Amending - to query other variable on the user, a checkbox called "Admin Team" to display the tab for Account Teams related list, I query for both like this:
public class UserProfileGetter {
public String userProfileName {
get {
return [
select Profile.Name
from User
where Id = :Userinfo.getUserId()
].Profile.Name;
}
}
public boolean userAdminTeam {
get {
return [
select Admin_Team__c
from User
where Id = :Userinfo.getUserId()
].Admin_Team__c;
}
}
public UserProfileGetter(ApexPages.StandardController unused) {
}
}
And then I use like this:
<apex:tab label="Account Team" name="Account Team" id="Act" rendered="{!userAdminTeam}">
Thanks all.