-
Notifications
You must be signed in to change notification settings - Fork 116
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
Custom Roles not tracking #836
Comments
I tried to reproduce this issue but no effect. I am using WP 4.4.2 and the newest Stream. I created a few custom roles and users for those roles. All activities of those users were properly tracked in Stream either with User Switching plugin or without it. |
@lukecarbis Have you tried to replicate it? |
@joelworsham Could there be something else going on here? Do you happen to have an object cache? |
Yes, we use WP Engine, so there is some caching going on. |
Try clearing your object cache. I think the problem is that you're creating a new role, but the object cache isn't cleared. When Stream tries to get the user's role, and unknown role is returned, which results in a silent fail. Not ideal, but can you test by:
|
Hmmm I tried that and it still does not work. I've recorded a screencast just so you can see it with your own 👀 https://www.dropbox.com/s/3oquayjpm4ghpgo/Stream%20Custom%20Roles%20Example%20-%203-22-16.mov?dl=0 NOTE: If you look closely, it may seem like I'm purging the wrong URI, but that's just how WP Engine works, purging from the live side of the server. It does purge the staging server as well. |
Thanks for helping us try to get to the bottom of this, Joel. I can't replicate the same thing on my end at all. Maybe could you post the code you're using to create the user role in a gist? I'll try out the same role with the same capabilities, etc. and see if I can replicate it that way. |
I know this has been tried already, but I have been unable to replicate it locally. I'm going to try it on a WP Engine site and see if I get better results. |
Just for clarification, I am using the gist plugin code you've listed above and following the same instructions you've listed to create a user with the custom role, switch to the user, update a post, and switch back. Upon switching, all the logging happens correctly, and actions are being logged as that user instead of as the admin user. |
@joelworsham Could you see if this is unique to custom roles, or if it applies to all roles? For instance, if you switch to a user with a standard (Contributor, Editor, etc) roles are you getting the same problems? If this is cache oriented, I would expect to see that it would work the same for both custom and standard roles. In which case, figuring out how to override the cache would be the most important element. Sidenote: Apparently the free developer site I had attached to the WP Engine account expired. So I'm flying blind as far as working to figure out the problems as they apply to WP Engine. I'll see if they have any docs to help support us. |
We gained access to a WP Engine test site, and I am not able to replicate your bug following the instructions you've provided using the plugin in your gist. Is there any special caching related plugins you have @joelworsham? |
It is on WP Engine, so yes there is some caching involved. We have object caching turned off though and most caching is done on the frontend though there is probably still some caching going on. No caching plugins though. |
@joelworsham Maybe you could provide a list of plugins which are active on your site? |
Sure thing. regenerate thumbnails All prefixed |
@Chacha Would you be available to test this out? |
Attempted again to replicate the issue. Using the DZS Roles Plugin, I did the following:
Couldn't find any problems. The edit was attributed to the new user. |
Man... I'm not sure what's going on then. This is absolutely bizarre. I just tested again but found something odd. I tested logged in with a user with the "Communications Editor" role, and it did not work. Nothing was tracked when editing a post. I then did the same test but after switching that user's role to "Site Manager" and it did work. It tracked it. Can you try this test out with the "Communications Editor" role and see if it tracks for you? |
Hey guys. I know this is low-priority to you, as you can't replicate it. I get that (being a developer myself). I do want to assure you it is happening though and I'm fairly confident it is not due to a weird conflict. Perhaps it's the combination of stuff. But like I said, I noticed it is not working with the "Communications Editor" role. |
@joelworsham I'll look into this again today. |
@joelworsham I had a look at this issue for you too. The answer is a bit odd! WordPress is truncating the user role id, The reason we were not able to reproduce the issue earlier was because we were likely using user roles with ID's of 20 or less characters. Now that we know what the issue is we can start thinking about how to solve it. Thank you for your patience! Cheers, Update: The Stream database limits user roles to 20 characters. We will need to increase the column sizes in the database to resolve your issue. |
rolls are not getting entries into the database. The column size of 20 characters does not pass string validation for user rolls with longer lengths and causes a WP_Error and in turn a `wp_stream_record_insert_error`.
Thanks so much! I'm glad we were able to get to the bottom of this. You guys rock. |
…-tracking Bugfix: #836 Custom Roles not tracking
To replicate:
You will only see entries for the admin user, not the user with a custom role. It seems as though custom roles aren't having any activity records logged.
Reported here: https://wordpress.org/support/topic/custom-roles-not-tracking?replies=4
The text was updated successfully, but these errors were encountered: