Making 'Publish Related Items' always checked

I need to make 'Publish Related Items' checked every time any content editor publishes an item. It will be nice if I can do it via Roles. But, if I cant then I would like to default it for every user in Sitecore.

  • Hi Mayank, while looking out for a solution to your query I came across a very useful blogpost:   by Mrunal. The blog lists down very clear cut steps as shown below:

    Steps:

    1. Copy Publish.xml file from “sitecore\shell\Applications\Dialogs\Publish” folder to “sitecore\shell\override” folder, so that you don’t messed up original file in case if you want to revert back your changes, just delete newly copied file.

    2. Find xml code for control in Publish.xml file, some thing similar to below:

    Before Sitecore 7.5:

    1
    2
    3
    <Border ID="PublishChildrenPane"  Visible="false">
       <Checkbox ID="PublishChildren" Header="Publish Subitems"/>
    </Border>

    From Sitecore 7.5 onwards:

    1
    2
    3
    4
    5
    <Border ID="PublishChildrenPane" >
       <Checkbox ID="PublishChildren" Header="Publish Subitems"/>
       <br />
       <Checkbox ID="PublishRelatedItems" Header="Publish Related Items"/>
    </Border>

    3. Add Visible=”false” attribute to border control like below: e.g.

    1
    2
    3
    <Border ID="PublishChildrenPane" Visible="false">
       <Checkbox ID="PublishChildren" Header="Publish Subitems"/>
    </Border>

    4. For default checked or unchecked you can add attribute IsChecked=”True” to checkbox

    1
    2
    3
    <Border ID="PublishChildrenPane" Visible="false">
       <Checkbox ID="PublishChildren" Header="Publish Subitems" IsChecked="True"/>
    </Border>

     

    You just need to replicate the last code snippet and then replace the Checkbox for Pubish Subitems by "Publish Related Items".

    Hope this helps.

  • Hi Mayank,

    Check below blog post which illustrates how to make PublishRelatedItems checkbox always checked based on a specific User Role.

    www.bugdebugzone.com/.../always-select-publish-related-items.html
  • In reply to Amrita Shukla:

    Hi Amrita,

    Thank you for the awesome post here. I have a quick question on your response. What i am trying is checkbox for "publish Subitems" should be always false. I tried using your sample code like

    <Border ID="PublishChildrenPane" Visible="false">
    <Checkbox ID="PublishChildren" Header="Publish Subitems" IsChecked="False"/>
    </Border>

    But i guess this will not work as Sitecore will override based on user registry values -


    public static bool PublishChildren
    {
    get
    {
    return Registry.GetBool("/Current_User/Publish/PublishChildren", true);
    }
    set
    {
    Registry.SetBool("/Current_User/Publish/PublishChildren", value);
    }
    }

    I guess for us, we need to override actual behavior by using something Dheer has suggested in this post

    www.bugdebugzone.com/.../always-select-publish-related-items.html