Problem/Motivation

Context condition userroles anonymous and authenticated users stopped working after installing latest dev or updating to 7.x-3.12. Other (own) userroles are working correct, also with 'make role a negative condition' selected.

Steps to reproduce

Select the role anonymous or authenticated as role condition. See that the reactions are not working.
Select a self made role and the reactions are working.

Proposed resolution

Please make userroles anonymous and authenticated users work again as condition. And also for 'make role a negative condition'.

Remaining tasks

-

User interface changes

-

API changes

-

Data model changes

-

Comments

Anonymous’s picture

cmseasy created an issue. See original summary.

Anonymous’s picture

Title: Condition userroles anonymous and authenticated users stopped working in dev » Condition userroles anonymous and authenticated users stopped working
Version: 7.x-3.x-dev » 7.x-3.12
Issue summary: View changes
Priority: Normal » Critical

I have this problem after updating to 7.x-3.12, I moved back to 7.x-3.11.
Changed issue version to latest 7.x-3.12 and priority to critical.

dsdeiz’s picture

Status: Active » Needs review
StatusFileSize
new678 bytes

Yeah, experienced the same as well. For my case, it was because of the language. I wonder if it's a similar case.

Context condition for user was expecting the translated role names for "anonymous" and "authenticated" while context list only had untranslated role names.

I've attached the patch if that helps.

Anonymous’s picture

I have a Dutch language site.
The patch did work for custum roles.
Not for anonymous (anonieme gebruiker) and authenticated (geverifieerde gebruiker).

dsdeiz’s picture

Yeah, seems to work for my case. I tested with Dutch. You can try debugging using this:

@ plugins/context_condition_user.inc:38 @ class context_condition_user extends context_condition {
   function execute($account) {
     $all_roles = user_roles();
     $users_roles = $account->roles;
+    print_r($all_roles);
+    print_r($users_roles);
     foreach ($all_roles as $rid => $role) {
       foreach ($this->get_contexts($role) as $context) {
         $options = $this->fetch_from_context($context, 'options');
ron collins’s picture

Context was failing for anonymous users on the French pages after updating 3.11 to 3.12.

Patch #3 worked for me. Thanks.

Seems like an easy one to get rolled in for next release.

danyg’s picture

Status: Needs review » Reviewed & tested by the community

It's a simple and super solution for the issue, thanks. I can confirm the patch works when you translated the authenticated and/or anonymous role's name. Changed to RTBC

santiwww’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new789 bytes

Sometimes (depending on when and how drupal 7 was installed, p.e. after a migration from d6) the names in the roles table are already translated, and because of that the patch #3 does not work.

That's the case in some of my sites sites which were built in spanish in d6 and migrated to d7.

I have created a new patch to force the name in english for authenticated and anonymous roles.

I changed the status to needs review.