Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi-site getCpEditUrl not scoping for site #3089

Closed
davist11 opened this issue Jul 12, 2018 · 3 comments
Closed

Multi-site getCpEditUrl not scoping for site #3089

davist11 opened this issue Jul 12, 2018 · 3 comments

Comments

@davist11
Copy link
Contributor

Description

On a multi-site install, if you are using getCpEditUrl on the front-end to link to the edit entry screen, the site handle is not added to the url. Presumably, it's because of this line

$this->siteId != Craft::$app->getSites()->getCurrentSite()->id

Steps to reproduce

  1. Create multiple sites
  2. Create a single and enable it for multiple sites
  3. Output getCpEditUrl on the front-end for that entry template

Additional info

  • Craft version: Craft Pro 3.0.13.1
  • PHP version: 7.0.30
  • Database driver & version: MySQL 5.7.22
  • Plugins & versions:
Algolia 1.0.0
Amazon S3 1.0.8
Asset Rev 6.0.0
AsyncQueue 1.3.3
Audit 2.0.1
Automatic Site Switch 1.0.0
Calendar 2.0.3
Category Utilities 1.0.0
Certificates 1.0.0
Converge 1.0.0
Craft Commerce dev-develop
Enupal Snapshot 1.0.4
Environment Label 3.1.4
Feed Me 3.0.0-beta.15
Field Manager 2.0.2
Flat Categories 2.0.0
Forms 2.1.1
Freeform Pro 2.1.1
Geo Cookie 1.2.1
Hamilton Utility 1.0.0
Importer 1.0.0
Inlin 2.0.0
Inventory 1.0.0
OrderExporter 1.0.0
Redactor 2.1.0
Sidebar Toggle 2.0.0
SimpleSentry 1.0.0
Super Table 2.0.7
Taxes 1.0.0
Twig Perversion 2.0.3
@brandonkelly
Copy link
Member

What do you mean by “site handle” ? Can you post the URL you’re getting and the URL you expected to get?

@davist11
Copy link
Contributor Author

Ah sure, an actual URL example would have been helpful, sorry about that...

We have an Applications Index single that is available across multiple sites. If I visit that entry on the front-end of two different sites:

/laboratory-products/applications
/process-analytics/applications

the getCpEditUrl is the same for both:

/admin/entries/applicationsIndex/56677-applications-index

Where I would expect them to be:

/admin/entries/applicationsIndex/56677-applications-index/laboratory
/admin/entries/applicationsIndex/56677-applications-index/processAnalytics

@brandonkelly
Copy link
Member

There was some logic to omit the site handle when creating the entry edit URL, if the entry’s site was the same as the current site, which is fine in the CP, but didn’t take into account that it might be a front-end request, where the entry will almost always be queried for the current site, which may not be the same site that the CP gets.

Fixed for the next release.

brandonkelly added a commit to craftcms/commerce that referenced this issue Jul 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants