Jump to:

10979 Posts in 2722 Topics by 1815 members

All other Modules

SilverStripe Forums » All other Modules » Change Default Subsite

Discuss all other Modules here.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 905 Views
  • dompie
    Community Member
    88 Posts

    Change Default Subsite Link to this post


    although Subsites is not coded to work with SS 2.4, it works most the time. Anyway, maybe someone can give me some hints how to fix the following 2 issues, to make it work better with SS 2.4.

    I have the following Subsites created:
    SubSite A
    SubSite B

    1) I created a user and put him into a "Content Editors" Group and allowed access to all Subsites (and languages). When the user logs in, always 'SubSite A' is active by default. How can I change this and make 'Main Site' the default after login? I tried to hard code, and to modify SubsiteList / currentSubsiteID, but without success

    2) Furthermore I'm using Translatable together with Subsites. Every time I change the language on 'Main Site' or 'SubSite B', 'SubSite A' becomes active. Anyone got an idea how to fix this? (workaround would be great too).

  • KINKCreative
    Community Member
    56 Posts

    Re: Change Default Subsite Link to this post

    Anyone had any progress on this?

    This has been an issue for me for editing child pages under RemodelAdmin. I just realized thanks to your post that the issue is that not the Main site but a subsite is forced for non-admins...

  • KINKCreative
    Community Member
    56 Posts

    Re: Change Default Subsite Link to this post

    I just did this - it may help. Under Subsite.php, there is a changeSubsite() method.

    I set up my various ModelAdmin classes to work with numeric PageIDs and added a $subsiteID parameter.

    class BlogAdmin extends RemodelAdmin {

       static $managed_models = array (
       static $url_segment = "blog";
       static $menu_title = 'Blog';
       public $showImportForm = false;
       static $parent = 100;
       static $parent_page_type = "ArticleHolder";
       static $subsiteID=1;

    Then I just added this into the init funciton of RemodelAdmin.php:

    public function init() {
        if(($subsiteID = $this->stat('subsiteID'))>=0 ) {

    It may not be orthodox, but it sure works, esp since I have article sections in several subsites managed with RemodelAdmin by different users.

    I am guessing you could do the same and perhaps check what subsite needs to be set based on the user's group. Hope this helps anyone!

Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.