craft-cp-element-count icon indicating copy to clipboard operation
craft-cp-element-count copied to clipboard

Count shows all entries on a multisite setup.

Open thaoms opened this issue 7 years ago • 5 comments

Not sure if this is intended but when you have a channel that has his own entries per site the count badge shows the total result (of both sites).

thaoms avatar May 16 '18 16:05 thaoms

...that has his own entries per site...

Do you mean that the channel is set up to not propagate entries?

aelvan avatar May 16 '18 16:05 aelvan

This is a bug, I'll try to figure out how to pass the current site to the code that does the count, wasn't as straight forward as I thought. :)

aelvan avatar May 16 '18 18:05 aelvan

I almost got it working:

$count = Entry::find()->section($slug)->limit(null)->status(['disabled', 'enabled'])->count(); should be extended with ->siteId(), but I couldn't manage to get the correct current site id:

$siteId = Craft::$app->getSites()->getCurrentSite(); // This always returned 1.
$count = Entry::find()->section($slug)->limit(null)->status(['disabled', 'enabled'])->siteId($siteId)->count();

Saboteur777 avatar Sep 25 '18 13:09 Saboteur777

We have installed the plugin few days ago and we are also using multi sites (using different domains for different sites and the channels are set up to NOT propagate entries). We were testing the plugin and for us it behaves like this:

  1. when switching the site by selecting the site from dropdown in Entries page of Control Panel
  • main site: correct number
  • second site: number from main site
  • third site: number from main site
  1. when switching the site by logging in direcly in the other sites Control Panel (this is not how sites work but tried it for testing purposes)
  • main site: correct number
  • second site: correct number
  • third site: correct number

This tells me the site uses current site as source for counting, which means it will always only look at the main site, no matter on what site you are currently.

We would also like if plugin would count each site separately. Thanks!

Djive avatar Oct 18 '18 11:10 Djive

We also seem to be having a problem with the plugin on a multisite setup. We have three channels for sub sites, each with propagation disabled. However, none of the entries in the channels are counted.

Multisites

martinhellwagner avatar Apr 26 '19 10:04 martinhellwagner