Problem/Motivation

View profiles permissions ist not yet ready for Drupal 11.

Steps to reproduce

Drupal Rector summarizes 5 obstacles on the way to Drupal 11 readiness

Proposed resolution

Check via Drupal Rector and find:

modules/contrib/view_profiles_perms/src/ViewProfilesPermsPermissions.php
Row 26:
Call to deprecated function user_roles(). Deprecated in drupal:10.2.0 and is removed from drupal:11.0.0. Use Drupal\user\Entity\Role::loadMultiple() and, if necessary, an inline implementation instead.

modules/contrib/view_profiles_perms/view_profile_perms.install
Row 13:
Call to deprecated function user_roles(). Deprecated in drupal:10.2.0 and is removed from drupal:11.0.0. Use Drupal\user\Entity\Role::loadMultiple() and, if necessary, an inline implementation instead.

modules/contrib/view_profiles_perms/tests/modules/view_profiles_perms_test/view_profiles_perms_test.info.yml
Row 5:
Value of core_version_requirement: ^8 || ^9 is not compatible with the next major version of Drupal core. See https://drupal.org/node/3070687.

modules/contrib/view_profiles_perms/composer.json
Row 1:
The drupal/core requirement is not compatible with the next major version of Drupal. Either remove it or update it to be compatible. See https://www.drupal.org/docs/develop/using-composer/add-a-composerjson-fi....

Remaining tasks

Would anyone be able to patch the module to enable it to be maintained throughout Drupal 11? This would be great
As I am no developer I am unable to solve the issues.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

mediengenosse created an issue. See original summary.

mediengenosse’s picture

Is this module still maintained? Or will it be abandoned?
I am in doubt, as there are no responses to this question.

chike’s picture

I am equally worried about the status of this module. It is a very useful module, and for it to still be stuck at Drupal 10, with all the DCMS buzz is worrying.

chike’s picture

The attached patch makes the module ready for Drupal 11, produced with help of ChatGPT Codex.

Changes made include:

  • Fixed deprecated role API usage in view_profile_perms.install by replacing user_roles(TRUE) with entity storage loading via \Drupal::entityTypeManager()->getStorage('user_role')->loadMultiple().
  • Updated dynamic permissions loading to use injected entity storage (no static entity loading) in ViewProfilesPermsPermissions.php.
  • Added Drupal 11 compatibility metadata in view_profiles_perms.info.yml and composer.json.
  • Fixed test-module dependency syntax for current schema and Drupal 11 compatibility in view_profiles_perms_test.info.yml.
titacvetkovic’s picture

StatusFileSize
new1.95 KB

@chike's patch at #4 no longer applies cleanly against 2.1.1 due to context mismatches, as the installed version of ViewProfilesPermsPermissions.php differs from what the patch expects.

I have attached a new patch for 2.1.1 that addresses all issues flagged by Upgrade Status:

  • Replaces deprecated user_roles() in ViewProfilesPermsPermissions.php with Role::loadMultiple() filtered via array_filter(), explicitly excluding ANONYMOUS_ID, AUTHENTICATED_ID and admin roles
  • Updates core_version_requirement in view_profiles_perms.info.yml to ^9 || ^10 || ^11
  • Updates core_version_requirement in the test module's info.yml to ^8 || ^9 || ^10 || ^11

Please note that the view_profile_perms.install file still references user_roles() in the view_profile_perms_update_8600() hook. As this is a historical update hook that would only run on sites upgrading from a very old version, it is not addressed in this patch.
Also, the composer.json drupal/core constraint fix from the original patch is also not included here as Upgrade Status flags this as a false positive. The current constraint ^9 || ^10 || ^11 in the installed version is already correct.

tim corkerton’s picture

Is there any update on when or if a stable D11 version will be released?

I applied the latest patch and get
web/modules/contrib/view_profiles_perms/view_profile_perms.install
Call to deprecated function user_roles(). Deprecated in drupal:10.2.0 and is removed from drupal:11.0.0.
Use Drupal\user\Entity\Role::loadMultiple() and, if necessary, an inline implementation instead.

manuel garcia made their first commit to this issue’s fork.

manuel garcia’s picture

Version: 2.1.1 » 2.1.x-dev
Status: Active » Needs review

Thanks everyone for the patches and the testing, and sorry for the long wait.

I opened MR !8, which makes 2.1.x compatible with 11.x and 12.x:

  • core_version_requirement: ^10.5 || ^11.2 || ^12, also in composer.json and the test module. It matches edit_profiles_perms, which needs core 10.5 or 11.2 for how it handles deleted roles.
  • Removes view_profile_perms.install. Its file and function names never matched the module's (view_profile_perms instead of view_profiles_perms), so its one update hook never ran on any site. It only mattered for sites upgrading from 8.x-1.0-alpha1. It is also where the user_roles() error @tim corkerton reported comes from.
  • PHPUnit attributes on the test, since doc-comment metadata goes away in PHPUnit 12.

The patches here also replace user_roles() in ViewProfilesPermsPermissions. 2.1.x-dev already did that in #3406820, after 2.1.1 was tagged, so that part is already in. The latest patch also left admin roles out of the generated permissions. I didn't include that, because sites that granted those permissions would lose them.

Tests pass on 11.4 and 12.x-dev. Once this is in I'll tag 2.2.0.

AI-Generated: Partially. Claude Code drafted this comment; I reviewed the change and ran the tests on 11.x and 12.x.

ressa’s picture

Priority: Normal » Major

Thanks @manuel garcia, since Drupal 10 is soon EOL (~6 weeks), perhaps this should be elevated to Major Priority?

Drupal 10 end of life

Drupal 10.6.0 is the last minor release of Drupal 10.

Drupal 10 will reach end of life on December 9, 2026. This is the same week that Drupal 12 will be released. No new releases of Drupal 10 will be made after this date.

https://www.drupal.org/about/core/policies/core-release-cycles/schedule#...

ressa’s picture

Status: Needs review » Reviewed & tested by the community

I tried the MR in Drupal 11, and it works well. I can block access to different profiles, based on the role of the visitor and the role of the profile. If I do not allow anonymous user access to the Content editor role and an anonymous user tries to access such a user profile, the page is blocked and this inserted in the log:

Type	access denied
Date	Friday, 30 October 2026 - 20:38
User	Anonymous (not verified)
Location	https://drupal11.ddev.site/user/2
Referrer	
Message	Path: /user/2. Drupal\Core\Http\Exception\CacheableAccessDeniedHttpException: The 'access user profiles' permission is required. in Drupal\Core\Routing\AccessAwareRouter->checkAccess() (line 114 of /var/www/html/web/core/lib/Drupal/Core/Routing/AccessAwareRouter.php).

If I allow anonymous user access to profiles with this role, the profile for users with the Content editor role can be accessed. Users with another role, such as Administrator, is still blocked.

Likewise, I can grant view access between roles, such as Content editor role profiles access to Administrator role profiles.

  • manuel garcia committed 3636d3cb on 2.1.x
    fix: #3540750 Drupal 11 readiness
    
    By: mediengenosse
    By: chike
    By:...
manuel garcia’s picture

Status: Reviewed & tested by the community » Fixed

Drupal 11 compatibility is merged into 2.1.x as 3636d3c and released as 2.1.2.

Testing: the GitLab CI PHPUnit job passed on Drupal 11.4.9 (PHP 8.3, MySQL 8.0), and @ressa on Drupal 11 confirmed the role-based access. Thanks to everyone who tested and posted patches.

Still open: MR !9 (#3036516) for the linked-label fix, which builds on this change.

AI-Generated: Yes (Claude Code drafted the CI file and the release notes; I reviewed them and ran the CI pipeline.)

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

ressa’s picture

Thank you @manuel garcia!

Status: Fixed » Closed (fixed)

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