Jump to content
apeisa

Multisite

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?

Share this post


Link to post
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

Share this post


Link to post
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?

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

That plugin for c5 seems to do exactly same approach and share same issues. It mentioned as for simple use cases. Only difference is that their plugin costs 80 bugs.

Share this post


Link to post
Share on other sites
Just now, Soma said:

...80 bugs.

By far many more than multisite module for PW (haven't encountered many bugs in all the years).

And also more expensive :D 

  • Like 1

Share this post


Link to post
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 ^_^

Share this post


Link to post
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.

Share this post


Link to post
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

Share this post


Link to post
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.

Share this post


Link to post
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.

Share this post


Link to post
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?

Share this post


Link to post
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

Share this post


Link to post
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.

 

Share this post


Link to post
Share on other sites

No, I just played with the settings, since you can allow user to see all the branches but edit just some.

  • Like 1

Share this post


Link to post
Share on other sites

However, while visiting the domain and the subdomain (pw.local, and nord.pw.local), it seems to bring cookies problem. I will have to investigate this. I tried to set the restriction by Role, and it does not seem to work. I can edit everything.

Share this post


Link to post
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?

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
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 ?

Share this post


Link to post
Share on other sites

The title of the page is different from its path. There are now multilingual settings here. Have you tried with the multisite installed?

Share this post


Link to post
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?

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By d'Hinnisdaël
      Happy new year, everybody 🥬
      I've been sitting on this Dashboard module I made for a client and finally came around to cleaning it up and releasing it to the wider public. This is how it looks.
      ProcessWire Dashboard

      If anyone is interested in trying this out, please go ahead! I'd love to get some feedback on it. If this proves useful and survives some real-world testing, I'll add this to the module directory.
      Download
      You can find the latest release on Github.
      Documentation
      Check out the documentation to get started. This is where you'll find information about included panel types and configuration options.
      Custom Panels
      My goal was to make it really simple to create custom panels. The easiest way to do that is to use the panel type template and have it render a file in your templates folder. This might be enough for 80% of all use cases. For anything more complex (FormBuilder submissions? Comments? Live chat?), you can add new panel types by creating modules that extend the DashboardPanel base class. Check out the documentation on custom panels or take a look at the HelloWorld panel to get started. I'm happy to merge any user-created modules into the main repo if they might be useful to more than a few people.
       Disclaimer
      This is a pre-release version. Please treat it as such — don't install it on production sites. Just making sure 🍇
      Roadmap
      These are the things I'm looking to implement myself at some point. The wishlist is a lot longer, but those are the 80/20 items that I probably won't regret spending time on.
      Improve documentation & add examples ⚙️ Panel types Google Analytics ⚙️ Add new page  🔥 Drafts 🔥 At a glance / Page counter 404s  Layout options Render multiple tabs per panel panel groups with heading and spacing between ✅ panel wrappers as grid item (e.g. stacked notices) ✅ Admin themes support AdminThemeReno and AdminThemeDefault ✅ Shortcuts panel add a table layout with icon, title & summary ✅ Chart panel add default styles for common chart types ✅ load chart data from JS file (currently passed as PHP array) Collection panel support image columns ✅ add buttons: view all & add new ✅
    • By Gadgetto
      Status update links (inside this thread) for SnipWire development will be always posted here:
      2020-01-14 --> new date range picker, discount editor, order notifiactions, order statuses, and more ... 2019-11-15 --> orders filter, order details, download + resend invoices, refunds 2019-10-18 --> list filters, REST API improvements, new docs platform, and more ... 2019-08-08 --> dashboard interface, currency selector, managing Orders, Customers and Products, Added a WireTabs, refinded caching behavior 2019-06-15 --> taxes provider, shop templates update, multiCURL implementation, and more ... 2019-06-02 --> FieldtypeSnipWireTaxSelector 2019-05-25 --> SnipWire will be free and open source If you are interested, you can test the current state of development:
      https://github.com/gadgetto/SnipWire
      Please note that the software is not yet intended for use in a production system (alpha version).
      If you like, you can also submit feature requests and suggestions for improvement. I also accept pull requests.
      ---- INITIAL POST FROM 2019-05-25 ----
      I wanted to let you know that I am currently working on a new ProcessWire module that fully integrates the Snipcart Shopping Cart System into ProcessWire. (this is a customer project, so I had to postpone the development of my other module GroupMailer).
      The new module SnipWire offers full integration of the Snipcart Shopping Cart System into ProcessWire.
      Here are some highlights:
      simple setup with (optional) pre-installed templates, product fields, sample products (quasi a complete shop system to get started immediately) store dashboard with all data from the snipcart system (no change to the snipcart dashboard itself required) Integrated REST API for controlling and querying snipcart data webhooks to trigger events from Snipcart (new order, new customer, etc.) multi currency support self-defined/configurable tax rates etc. Development is already well advanced and I plan to release the module in the next 2-3 months.
      I'm not sure yet if this will be a "Pro" module or if it will be made available for free.
      I would be grateful for suggestions and hints!
      Please have a look at the screenshots to get an idea what I'm talking about (open spoiler):
      (Please note: these screenshots are from an early development state of SnipWire. To see actual screens please have a look at later posts below!)
       
    • By Robin S
      This module is inspired by and similar to the Template Stubs module. The author of that module has not been active in the PW community for several years now and parts of the code for that module didn't make sense to me, so I decided to create my own module. Auto Template Stubs has only been tested with PhpStorm because that is the IDE that I use.
      Auto Template Stubs
      Automatically creates stub files for templates when fields or fieldgroups are saved.
      Stub files are useful if you are using an IDE (e.g. PhpStorm) that provides code assistance - the stub files let the IDE know what fields exist in each template and what data type each field returns. Depending on your IDE's features you get benefits such as code completion for field names as you type, type inference, inspection, documentation, etc.
      Installation
      Install the Auto Template Stubs module.
      Configuration
      You can change the class name prefix setting in the module config if you like. It's good to use a class name prefix because it reduces the chance that the class name will clash with an existing class name.
      The directory path used to store the stub files is configurable.
      There is a checkbox to manually trigger the regeneration of all stub files if needed.
      Usage
      Add a line near the top of each of your template files to tell your IDE what stub class name to associate with the $page variable within the template file. For example, with the default class name prefix you would add the following line at the top of the home.php template file:
      /** @var tpl_home $page */ Now enjoy code completion, etc, in your IDE.

      Adding data types for non-core Fieldtype modules
      The module includes the data types returned by all the core Fieldtype modules. If you want to add data types returned by one or more non-core Fieldtype modules then you can hook the AutoTemplateStubs::getReturnTypes() method. For example, in /site/ready.php:
      // Add data types for some non-core Fieldtype modules $wire->addHookAfter('AutoTemplateStubs::getReturnTypes', function(HookEvent $event) { $extra_types = [ 'FieldtypeDecimal' => 'string', 'FieldtypeLeafletMapMarker' => 'LeafletMapMarker', 'FieldtypeRepeaterMatrix' => 'RepeaterMatrixPageArray', 'FieldtypeTable' => 'TableRows', ]; $event->return = $event->return + $extra_types; }); Credits
      Inspired by and much credit to the Template Stubs module by mindplay.dk.
       
      https://github.com/Toutouwai/AutoTemplateStubs
      https://modules.processwire.com/modules/auto-template-stubs/
    • By Mike Rockett
      Jumplinks for ProcessWire
      Release: 1.5.60
      Composer: rockett/jumplinks
      ⚠️ NOTICE: 1.5.60 is an important security patch-release for an XSS vulnerability discovered by @phlp. It's HIGHLY RECOMMENDED that all Jumplinks users update to the latest version as soon as possible.
      Jumplinks is an enhanced version of the original ProcessRedirects by Antti Peisa.
      The Process module manages your permanent and temporary redirects (we'll call these "jumplinks" from now on, unless in reference to redirects from another module), useful for when you're migrating over to ProcessWire from another system/platform. Each jumplink supports wildcards, shortening the time needed to create them.
      Unlike similar modules for other platforms, wildcards in Jumplinks are much easier to work with, as Regular Expressions are not fully exposed. Instead, parameters wrapped in curly braces are used - these are described in the documentation.
      Under Development: 2.0, to be powered by FastRoute
      As of version 1.5.0, Jumplinks requires at least ProcessWire 2.6.1 to run.
      View on GitLab
      Download via the Modules Directory
      Read the docs
      Features
      The most prominent features include:
      Basic jumplinks (from one fixed route to another) Parameter-based wildcards with "Smart" equivalents Mapping Collections (for converting ID-based routes to their named-equivalents without the need to create multiple jumplinks) Destination Selectors (for finding and redirecting to pages containing legacy location information) Timed Activation (activate and/or deactivate jumplinks at specific times) 404-Monitor (for creating jumplinks based on 404 hits) Additionally, the following features may come in handy:
      Stale jumplink management Legacy domain support for slow migrations An importer (from CSV or ProcessRedirects) Feedback & Feature Requests
      I’d love to know what you think of this module. Please provide some feedback on the module as a whole, or even regarding smaller things that make it whole. Also, please feel free to submit feature requests and their use-cases.
      Note: Features requested so far have been added to the to-do list, and will be added to 2.0, and not the current dev/master branches.
      Open Source

      Jumplinks is an open-source project, and is free to use. In fact, Jumplinks will always be open-source, and will always remain free to use. Forever. If you would like to support the development of Jumplinks, please consider making a small donation via PayPal.
      Enjoy! 🙂
    • By Robin S
      Add Image URLs
      Allows images/files to be added to Image/File fields by pasting URLs.

      Usage
      Install the Add Image URLs module.
      A "Paste URLs" button will be added to all image and file fields. Use the button to show a textarea where URLs may be pasted, one per line. Images/files are added when the page is saved.
       
      https://github.com/Toutouwai/AddImageUrls
      https://modules.processwire.com/modules/add-image-urls/
×
×
  • Create New...