Jump to content

Multisite


apeisa

Recommended Posts

Thanks for your reply, Soma. And also thank you for developing the fantastic Multisite module!

To further test this, I set up a clean installation of ProcessWire 3.0.30, activated link abstraction and put some internal links into the body-fields. Then I dragged and dropped the page branches around the page tree. PW’s link abstraction always correctly modified the links in the body-field.

Then I installed Multisite, and link abstraction unfortunately stopped working. When trying to save a page with any link in the body-field, PW displayed an error message like »Session: Unable to resolve link on page "pagename" in field "body": /link-to-another-page/«.

PW’s link abstraction internally saves page-ids as link-attributes in the database, like this:

<p>This is an <a	data-pwid=1023	href="/child-page-1/grandchild-page-2/">internal link</a>.</p>

When Multisite converts links like »/www.example.com/child-page-1/« to »/child-page-1/«, PW isn't able to recognize them anymore and therefore cannot save the corresponding page-ids to the database. So I assume, link abstraction won't work together with Multisite.

A powerful feature of Multisite is, that editor users see the »real« links in the backend. Modifying the links on page render, as you suggested in a previous post, would confuse those users, because they would see links like »/www.example.com/child-page-1/« in the WYSIWYG-Editors.

The only solution I can think of right now, would be to convert all modified links back to the original links on page save, let link abstraction do it’s work, and modify them again, when displayed in the backend or frontend.

Do you think that would be possible?

Link to comment
Share on other sites

Sorry, there's so many iterations and experiments with this module I can't always recall what the current state is. I'm working on and off on this.

I forgot the current dev still does alter the urls to strip out the domain segment. So as you seen, PW isn't able to resolve the url anymore. This also created various problems not only with link abstraction, but page path history view links etc etc.

Current version I have, works fine here due to NOT rewriting anything in the backend (ready() hooks all commented out + some parsing of the urls on page render). So the only headache free and correct solution is to let them as is. A "/domain1/about/" vs a "/about/" also has some advantage in that it's the physical url and can be recognized and handled in some way if needed while the latter you can't. Domain1 and Domain2 could have both a "/about/" and you don't know which one is which. I guess it's not something we have many options unfortunately.

I'm still testing and working on the new version, but have no ETA.

So this modules is still in "alpha" and each version may not compatible with one or another previous version (also PW versions) and I still do not recommend using it in a important or critical project and only if you're aware of the consequences it may bring (broken links you can hardly recover).

  • Like 1
Link to comment
Share on other sites

Thanks for the detailed explanation of the new module version!

Some time ago, I wrote a simple module for a client website that converted every href-value on page render. It stripped out a certain folder name, i.e. it converted »/container-1/page-1/« to »/page-1/«.

That worked fine, but for my client it caused a really big usability issue in the backend, because they saw the original links in the WYSIWYG-Editor, and not the resulting links.

As much as I understand, the new Multisite version will also leave the original links in the WYSIWYG-Editors, like »/www.example.com/about/« instead of »/about/«.

Do you see any way to just display the »right« links to backend users, while not really altering them?

Link to comment
Share on other sites

1 minute ago, nurkka said:

Thanks for the detailed explanation of the new module version!

Some time ago, I wrote a simple module for a client website that converted every href-value on page render. It stripped out a certain folder name, i.e. it converted »/container-1/page-1/« to »/page-1/«.

That worked fine, but for my client it caused a really big usability issue in the backend, because they saw the original links in the WYSIWYG-Editor, and not the resulting links.

As much as I understand, the new Multisite version will also leave the original links in the WYSIWYG-Editors, like »/www.example.com/about/« instead of »/about/«.

Do you see any way to just display the »right« links to backend users, while not really altering them?

Maybe someone enlighten me here. But unfortunately it's not an easy one. Not one I can think of I would be happy with. Not one that doesn't create all the problems I'm trying to solve or stay away.

The problem with your idea is that it's not the saving and loading of the urls in the RTE but you're talking about the url field you see when selecting a page. That's the page linke editor that works together with a each PW specific RTE plugin editor on top of that. 

1. So, one and easy way would be to alter the $page->url via a hook (as it is now or was), but that's where it will be systemwide changed and many things may and will stop working. Maybe some options there to only alter if-then... but believe me it creates a whole tale of issues that arise in one place or another. Mixing it up with "here you do it but there you don't" etc. 

2. The other would to explore the PageEditLink module and probably only JS side to see if it can be somehow hidden, but by not altering the -in and -output. That would be more a cosmetic fix. I'm sure there would e some way or another, although not that easy. While I understand what you're saying that it creates usability issues, I think it can also create problems if you hide something that's relevant information too. Imagine you only see "/about"/ and "/about/" but which is which? We have lot of editors that edit multiple sites and cross linking should be easy. Maybe best way would be to "grey it out" and make them aware that it's "secondary" info due to multisite.

The other "problem" here is that it would have to be done for all RTE's etc and upcoming link editor plugins. And as it looks one would have to completely replace some of the complex PW RTE plugins and or the link editor js to make it work, and always try to incorporate changes and new features in the core that will occur in no time for sure (and then there's front-end editing).

So it's also a question of how deep this modules should go or stay out of the way and don't create too much dependencies.

Link to comment
Share on other sites

  • 1 month later...

Hi,

I am to decide which CMS to choose for a future project. I have read and tried the MultiSite module, but I think PW won't be the choice, which I regret greatly! I cannot afford too much uncertainty. I love so much PW though! It won't be Drupal. 

I just want to point here a module made for Concrete 5, which I haven't tried yet (I will wait to see if we obtain the contract). That guy seems to have solved all obstacles. Maybe some of you would be inspired by it:  https://www.concrete5.org/marketplace/addons/multiple-domains1. Concrete 5 works differently than PW, but they do share the "tree" approach.

Another solution would be MODX and it's context feature.

Anyway, just my two cents.

Link to comment
Share on other sites

I've used first apeisa's and later on soma's multisite in several installs. Latest versions rocks. Easy by code configurable module. You won't need to be uncertain about the multi site set-up. Not sure about 5.4 php requirement ^_^

Link to comment
Share on other sites

I don't mind paying $80 on a $60000 project, specially if I can get a swift support. I was just pointing some direction. As of sharing same issues, I can't talk about it right now. The main concern is not just the URL redirection, but the permissions associated with a subdomain.

My client asks that a role associated to a subdomain must be able to just edit the pages of that subdomain. There will be 10 subdomains (this is an international site with 10 region subdomains, sharing a lot of information in each site, but having also regional particularities. The only differences as for the templates will be the colour identifying the region). So far, in my understanding of PW, roles permission are template based (or user based with one of Ryan's module). I have seen a Page per role permission module, but it seems not ready for PW3. It's certainly doable to make some coding here to prevent edit pages (from the admin interface, since everybody will see the tree of the organisation).

In Concrete5 you can set permissions to a specific page in a tree and tells that the children share those permissions.

Anyway, Concrete5 and MODx are fine CMS, but I would like to stick to PW if I can, :-) , because the easiness of rendering and searching things, etc.

 

Just a final note. I'm not a program, but I'm part of a team with programmers. Programming things is not the problem. I am responsible to find the right solution for the project.

Link to comment
Share on other sites

33 minutes ago, Guy Verville said:

I don't mind paying $80 on a $60000 project, specially if I can get a swift support. I was just pointing some direction. As of sharing same issues, I can't talk about it right now. The main concern is not just the URL redirection, but the permissions associated with a subdomain.

My client asks that a role associated to a subdomain must be able to just edit the pages of that subdomain. There will be 10 subdomains (this is an international site with 10 region subdomains, sharing a lot of information in each site, but having also regional particularities. The only differences as for the templates will be the colour identifying the region). So far, in my understanding of PW, roles permission are template based (or user based with one of Ryan's module). I have seen a Page per role permission module, but it seems not ready for PW3. It's certainly doable to make some coding here to prevent edit pages (from the admin interface, since everybody will see the tree of the organisation).

In Concrete5 you can set permissions to a specific page in a tree and tells that the children share those permissions.

Anyway, Concrete5 and MODx are fine CMS, but I would like to stick to PW if I can, :-) , because the easiness of rendering and searching things, etc.

 

Just a final note. I'm not a program, but I'm part of a team with programmers. Programming things is not the problem. I am responsible to find the right solution for the project.

Hi, i haven't used ProcessWire in a multisite context but have already used the Admin Restrict Branch module to limit  to a given subpages set of theProcessWire page tree.

Edited by Nicolas
Corrected a typo
  • Like 1
Link to comment
Share on other sites

Thank you to pointing that. This plugin is doing exactly what I was hoping for :-)  After further essays, nope... while the page tree is truncated on login, users have still access to the entire site tree if they click on the page tree icon. I will make other tests.

Link to comment
Share on other sites

@Guy Verville - I would really like to know if Admin Restrict Branch works in multisite mode. I expect it should work just fine.

I use it in what sounds like a very similar situation to yours - I have the same set of pages and templates for regional/project specific branches of the page tree. With that module I simply give everyone access to everything on the home template and let inheritance provide access to all templates below and the module takes care of keeping users completely restricted to their regional branch - they can't even see the other branches (or any other pages outside their specific branch).

If you find any problems in multisite mode please let me know and I'll see what I can do about supporting it.

Link to comment
Share on other sites

18 minutes ago, Guy Verville said:

After further essays, nope... while the page tree is truncated on login, users have still access to the entire site tree if they click on the page tree icon. I will make other tests.

Sounds like something isn't quite right - if I click the page tree icon, they still get the same restricted branch. Are you talking about the icon to the left of "Pages"?

Screen Shot 2016-10-08 at 3.54.01 PM.png

When I click that, I still get the restricted branch in the panel, like so:

Screen Shot 2016-10-08 at 3.55.15 PM.png

Is this what you are talking about, or something else?

Link to comment
Share on other sites

Well, perhaps the first time, I didn't enter the site correctly. I can see the branch, but can't edit anything.

I have created a role "nord" (for north region), which has the page-edit permission. I then created a user with that role only set. When I enter the site with that user, I see only the "nord" branch.

OperaScreenSnapz002.pngOperaScreenSnapz001.png

Link to comment
Share on other sites

2 minutes ago, Guy Verville said:

Sorry, my bad. I forgot to apply correctly the page-edit permission to the template! It works.

OperaScreenSnapz003.png

Nice, although I assume that second screenshot is with superuser logged in since it shows all branches?

PS - don't forget what I mentioned earlier on about just applying access permissions to the home template and no others - if you are using this module it simplifies things a lot.

 

Link to comment
Share on other sites

1 minute ago, Guy Verville said:

it seems to bring cookies problem. I will have to investigate this.

Please let me know what you find out.

 

1 minute ago, Guy Verville said:

I tried to set the restriction by Role, and it does not seem to work. I can edit everything.

Are you talking about the "Role Name" matching option? I think some people haven't understood this option properly. It's what I use all the time for my sites, but to be clear, in your case you'd want the name of the role to be "page-nord" to match the name of the page that is the parent of the branch you are restricting them to. Does that help, or is that what you are already doing? Or maybe you found a bug?

Link to comment
Share on other sites

16 minutes ago, Guy Verville said:

ok, I understand. The role must match the page. The multisite module needs the branches to be set on the url name. For our example, it's nord.pw.local. The role should be then nord.pw.local? 

Addendum: it seems to not work.

I just tested that exact name for the name of the parent page and also the role name and it is working fine here, so it should work for you from what I can tell.

Perhaps a multilanguage issue - is the name of the page in all languages set to nord.pw.local ?

Link to comment
Share on other sites

1 minute ago, Guy Verville said:

Ok, i think I got it. When setting to "Role Name", the root of the site must be select.

Do you mean the "Parent to restrict Role Name and Custom PHP code matches to." setting? 

That setting is completely optional, but the key thing is that obviously it must be above all the branches to be restricted. If your branches to be restricted are direct children of Home, then there isn't much point in this setting. It really only comes into play if they are several levels down as it reduces the page selector to that tree. You can see how it works here: https://github.com/adrianbj/AdminRestrictBranch/blob/15c70b90144fa68cafed0cdbb2d802e5dcfa1f2c/AdminRestrictBranch.module#L236 - see how $branchesParentSelector is defined using the "has_parent" selector.

Anyway, that setting isn't relevant to you and it sounds like you have everything working correctly?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...