Hide CustomAction on SiteSettings page at sub-site level

I have two functions that add CustomAction to the SiteSettings page. One of the features is at the Site level, and the other is at the Web level.

CustomAction, added at the Site level, is a link to a custom configuration page that controls the site level settings for my application. Therefore, I do not want the link to appear on the SiteSettings page of the child site. I know that there is a parameter (RequireSiteAdministrator) that hides the page in accordance with the access level, but I still would like this page to be displayed for site owners on the top-level / root-level site settings page, and not on the sub-site settings page .

For the CustomAction xml node attribute, there is a RootWebOnly attribute that would solve my problem. The problem with this attribute is that it is only available for SandBoxed solutions.

I know that this is possible, as I see the link behavior for site collection administrators in the Users and Permissions section of the Site Settings page. Please note that if you go to the top / root level settings page, you will see this link. On the other hand, if you go to the site settings page on a subsidiary site, the link no longer exists.

I tried using HideCustomAction, but this hides the link on both pages.

+4
source share
2 answers

After fighting this for two days, I had a moment when I thought I would share it. This will allow you to host a custom action that will only be displayed at the root website level.

Create 2 functions. One at the site level (siteFeature) and one at the web level (webFeature). Make a hidden web function so that it cannot be accessed (activate / deactivate), although manage the function pages. Put the custom xml action element in a web function. In the site function activation event receiver, activate the web function.

+3
source

Unfortunly Unfortunately, this is not possible with custom actions and a custom group.

All you can do is simply set permissions for the link, which will only be displayed to the SiteCollection administrator.

An example of how this will be is the “Site Collection Administrator” group, where links are hidden when you are not at the top level of the site and shown when you are.

Hope this helps,

Andrew

0
source

All Articles