SharePoint 2010: Limiting web-scoped features to specific site definitions

581 views Asked by At

I have created a number of web-scoped features for my customised Blog site definition. All my features work fine, however they appear on the "Site Features" page of all sites in my site collections -- not just the blogs.

Obviously they are only relevant to blogs (as they do things like enabling anonymous comments on blog posts etc).

Is there any way to limit the visibility of certain web-scoped features to sites of a specific type (i.e. those created from a particular site definition)?

1

There are 1 answers

1
MLF On

I don't think its possible to do that.

If you are worried people will activate your feature from the UI you could make your feature hidden.

<Feature Hidden="TRUE"></Feature>

Then in your custom BLOG Site Template's ONET.xml you can force your feature to be activated when the site is created.

<Configurations>
    <Configuration>
        <WebFeatures>
            <Feature ID="[Insert GUID of your feature]"/>
        </WebFeatures>
    </Configuration>
</Configurations>

This wouldn't stop the feature from being activated via STSADM or PowerShell. If you wanted to go that far maybe you could add a feature receiver to your feature to prevent it from being activated on non-BLOG sites... but is it really necessary?