jetpack icon indicating copy to clipboard operation
jetpack copied to clipboard

Stats: Changing settings for custom user roles does not work

Open richardmtl opened this issue 9 years ago • 24 comments

Originally reported here: https://wordpress.org/support/topic/setting-to-count-logged-in-page-views-from-customers-does-not-stick/

I was able to reproduce this on my test site. I have several custom roles:

screen shot 2017-11-14 at 11 58 00 am

I can click one of them and Activate it, and I get a green success message. However, when I refresh the page, the role is deactivated again.

richardmtl avatar Nov 14 '17 16:11 richardmtl

Does this happen in the old Jetpack > Site Stats > Configure page, or is the problem the same there as well?

jeherve avatar Nov 15 '17 13:11 jeherve

Interesting question! So it turns out that some of the roles are already active there:

screen shot on 2017-11-15 at 09-29-49 png

If I activate "Employer" it stays checked on that page; if I then go to the new Config screen, I see that it's still not active there.

If I deactivate the 3 custom roles on the old page, and then activate it on the new page, it gets activated on the old page as well. However, if I refresh the new page, it still doesn't appear activated, though it remains activated on the old page on refresh.

So, tl;dr is that the new page does not properly show the activation setting for custom roles (and custom roles only; I tested several default roles and they all worked as expected).

richardmtl avatar Nov 15 '17 14:11 richardmtl

This issue has been marked as stale. This happened because:

  • It has been inactive in the past 6 months.
  • It hasn’t been labeled `[Pri] Blocker`, `[Pri] High`.

No further action is needed. But it's worth checking if this ticket has clear reproduction steps and it is still reproducible. Feel free to close this issue if you think it's not valid anymore — if you do, please add a brief explanation.

stale[bot] avatar Jun 30 '18 00:06 stale[bot]

As noted in 3526-gh-jpop-issues, this also affects changing which roles can view stats reports. Ticket from that issue is 1789238-zen.

aheckler avatar Feb 11 '19 13:02 aheckler

In reference to 1789238-zen

The settings for which roles can view stats reports are actually changing, however custom users are still not able to view stats regardless of the change.

chickenn00dle avatar Feb 13 '19 07:02 chickenn00dle

Hi, this also leads to situation that only administrators are capable of using the woocommerce mobile app to view shop statistics. No custom roles for example by woocommerce (shop manager) are capable of viewing the shop statistics via WOO mobile app or via wordpress.com only site administrators.

Ilardo avatar Feb 13 '19 10:02 Ilardo

@Ilardo Until this gets fixed I would recommend that you use the old Stats configuration screen (Jetpack > Site Stats > Configure) to change the stats access options. That should work.

jeherve avatar Feb 13 '19 13:02 jeherve

@Ilardo Until this gets fixed I would recommend that you use the old Stats configuration screen (Jetpack > Site Stats > Configure) to change the stats access options. That should work.

Hi, Thanks for your suggestion but i have tested this and this is only saving this option but there is no difference in behaviour for the custom role. So the old settings page save the settings but does not actually make any change in privileges.

Ilardo avatar Feb 13 '19 13:02 Ilardo

Thanks for letting us know, that's helpful!

jeherve avatar Feb 13 '19 13:02 jeherve

1924926-zen

aheckler avatar Apr 02 '19 13:04 aheckler

https://wordpress.org/support/topic/site-stats-can-not-be-used-by-custom-roles/

KokkieH avatar May 22 '19 08:05 KokkieH

A VIP user bumped into this as well (96297 for my reference). I'm seeing references to the "old Configure" page in this thread and in others:

Does this happen in the old Jetpack > Site Stats > Configure page, or is the problem the same there as well?

When I visit example.com/wp-admin/admin.php?page=jetpack#/settings?term=Site%20Stats in JP 5.2.2, I'm only presented with the new interface. Is there a way to still access the old interface or a workaround to use to enable stats for custom user roles while this is being worked on?

jeremeylduvall avatar Jul 25 '19 17:07 jeremeylduvall

Is there a way to still access the old interface or a workaround to use to enable stats for custom user roles while this is being worked on?

We removed that old stats configuration page from Jetpack a few versions ago, so I am afraid there is no UI workaround right now.

jeherve avatar Jul 25 '19 17:07 jeherve

Just a note that I found that this is still happening in VIP Go sites. But I also found that the old set up seems lost for clients, for instance in http://example.com/wp-admin/admin.php?page=jetpack#/traffic. When updating, I get success for the Allow stats reports to be viewed by and an error on Count logged in page views from, and the updates don't stick on refreshing.

artkanna avatar Sep 12 '19 12:09 artkanna

96297-zd-wordpressvip 98659-zd-wordpressvip 100987-zd-wordpressvip

poqVs-n48-p2#comment-124366

cafenoirdesign avatar Nov 16 '19 14:11 cafenoirdesign

The problem still there

aitohamy avatar Mar 18 '20 14:03 aitohamy

2997907-zen

Settings in WordPress.com works correctly but in wp-admin, the custom role toggle does not show it's correct value.

dericleeyy avatar May 25 '20 08:05 dericleeyy

This is still a current issue for VIP sites with custom roles.

VIP: (#114669-z)

rawrndres avatar Aug 24 '20 16:08 rawrndres

Here are my findings:

Default roles

  • Wworks as expected. You can toggle active/deactive and everything runs smoothly.

Custom roles

  • The initial toggle active works. It updates stats_options.
  • On page refresh the toggle shows deactive even though stats_options has been updated.
  • Changing the toggle setting doesn't update stats_options.

You can still update the setting with CLI.

Get the roles which have Stats permission, for example:

wp option pluck stats_options roles
array (
  0 => 'administrator',
  1 => 'custom-role',
)

And then delete custom-role with:

wp option patch delete stats_options roles 1
Success: Updated 'stats_options' option.

After some more testings, I've discovered that if you don't refresh the page, you can deactivate the role - this works after the initial page refresh too. Workflow:

Step 1: Go to /wp-admin/admin.php?page=jetpack#/settings?term=Site Stats and activate custom role. => You get settings updated message and option stats_options is updated.

Step 2: Hard refresh the page, try to deactivate the same custom role which shows as deactive. => You get settings updated message and stats_options stays the same.

Step 3: Do not refresh the page, and now with the custom role showing as active, deactivate that custom role. => You get settings updated message, the role now shows deactivated and option stats_options has been updated by removing the role.

hitolonen avatar May 20 '21 08:05 hitolonen

We've got a report of this on 4842500-zen with a user using WooCommerce custom-roles.

muffinpeace avatar Mar 09 '22 14:03 muffinpeace