Hi Everyone,
I want to Hide custom action for all users and groups , only anonymous users can see it.
How I can do this ?
Hi,
I didn’t mean to write this code in custom action code.This code can be written in master page JQuery linked file. It should work there. no need to add a scriptblock. I had used the similar script to hide a custom action from a list display form. It had worked perfectly fine.
Custom action permission can be configured using it’s Right property that can take up any of the 33 inbuilt permissions SharePoint has. Refer to this article for more details. Else you can create a custom class that will decide when you want to show the menu item based on the custom logic. Refer to this article.
-Ateet
Thanks  Shubhdeep but it didn’t work also this code must write in ScriptBlock attribute and Location must be  ScriptLinkÂ
<CustomAction Id=”Id1″ Location=”ScriptLink”
ScriptBlock=”$(document).ready(function () {
var managerName;
var userName = new String($().SPServices.SPGetCurrentUser());
if(!userName)
{
$(‘Id1’).hide()
}” GroupId=”SiteActions” Title=”SignUp”
>
<UrlAction Url=”http://dina/_layouts/15/ListsAndPages/RegisterPage.aspx”/>
But i need the location is  Microsoft.SharePoint.StandardMenu
if you have solution for this I will be pleasedÂ
Thanks In Advance
You can try the following :
<script type=”text/javascript” src=”../../JSLibrary/jquery-1.3.2.min.js”></script><script type=”text/javascript” src=”../../JSLibrary/jquery.SPServices-0.4.8.min.js”></script>script type=”text/javascript”>
$(document).ready(function () {
        var managerName;
        var userName = new String($().SPServices.SPGetCurrentUser());
    if(userName)
    {
        $(“mycustomcontrol”).hide()  //id of the custom control
   }