0

I have Visualforce Page with three <apex:commandLinnk> tags (e.g. "New Record", "Edit Record", and"Change Record"). The first link shouldn't be displayed in Sites, but only in Visualforce Pages.

If I view this Visualforce Page in a Force.com Site, I should only see the "Edit Record" and "Change Record" links. Is it possible? How can I set a visibility condition based on whether or not the page is being displayed in a Force.com Site?

<div id="firstBlock" class="one element-animation-slide">
    <apex:pageMessages ></apex:pageMessages><br/><br/>
    <apex:commandLink action="{!newShow}" id="authClick" value="New Record" style="text-decoration: none;" styleClass="slideUp element-animation" rerender="optionPanel, newCRpanel, wholePanel"/><br/><br/><br/>
    <apex:commandLink action="{!editShow}" id="createClick" value="Edit Record" style="text-decoration: none;" styleClass="slideUp element-animation" rerender="optionPanel, newCRpanel, wholePanel"/><br/><br/><br/>
    <apex:commandLink action="{!changeshow}" value="Change Record" style="text-decoration: none;" styleClass="slideUp element-animation" rerender="optionPanel, editCRpanel, wholePanel"/><br/><br/><br/>
</div>

2 Answers 2

0

Site class has a method getSiteTypeLabel() which basically gives your sites name(label). if its not invoked from a site this method returns null.

Have a boolean in your controller 'showNewButton' and set its value in the constructor of the VF page class. If site.getSiteTypeLabel() != null set it to false. else set it to true

in your VF page add a rendered condition to the commandlink based on this condition

<apex:commandLink action="{!newShow}" id="authClick" value="New Record" style="text-decoration: none;" styleClass="slideUp element-animation" rerender="optionPanel, newCRpanel, wholePanel" rendered="{!showNewButton}"/>
0

You can check which type of user is logged in currently. Because when user will be on a site he will be either a guest user or community licensed user.

So what can you do is check the UserType in rendered attribute.

rendered="{!$User.userType = 'Guest'}"

There are various possible values of userType available at below link, you can refer.

Various values of UserType

You can also refer to a similar thread available:

Similar Thread Here - Click on it.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .