Problem/Motivation

This error occurs when the user has more then one role:

Notice: Undefined offset: 10 na user_view_mode_entity_view_mode_alter() (linha 82 de /var/www/clients/client3/web14/web/repos/ualg/web/modules/contrib/user_view_mode/user_view_mode.module)

Steps to reproduce

Have a site when lot of roles.
Assign 2 distinct role with the same view mode.

When he has 2 roles, the view mode will reset to full, and the above Notice comes up.

Proposed resolution

Change the line 79 of file user_view_mode.module to this:
$highest_id_weight = $i;

and that's it.

The bug is to load the role not using the id which scores the most, but the id of the weight, that is wrong.

Remaining tasks

To build a patch.

CommentFileSizeAuthor
#2 3248969-2.patch585 byteschucksimply

Comments

jrochate created an issue. See original summary.

chucksimply’s picture

StatusFileSize
new585 bytes

Adding a patch for the above

jrochate’s picture

Status: Active » Reviewed & tested by the community

yahyaalhamad’s picture

Thanks for the patch, applied.

yahyaalhamad’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.