Closed (fixed)
Project:
Forum Access
Version:
8.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
22 Apr 2020 at 08:03 UTC
Updated:
21 Oct 2021 at 02:19 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
nickolajComment #3
nickolajComment #5
kristen polFixing outdated tag.
Comment #6
dillix commented@nickolaj thanks for your patch, but I've found several issues for D9 compability:
1) web/modules/contrib/forum_access/forum_access_migrate/forum_access_migrate.install
Line 8: Call to deprecated function db_delete(). Deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Instead, get a database connection injected into your service from the container and call delete() on it.
2) web/modules/contrib/forum_access/includes/forum_access.admin.inc
Line 92: Call to deprecated method entityManager() of class Drupal. Deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use Drupal::entityTypeManager() instead in most cases. If the needed method is not on \Drupal\Core\Entity\EntityTypeManagerInterface, see the deprecated \Drupal\Core\Entity\EntityManager to find the correct interface or service.
3) web/modules/contrib/forum_access/includes/forum_access.admin.inc
Line 116: Call to deprecated method entityManager() of class Drupal. Deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use Drupal::entityTypeManager() instead in most cases. If the needed method is not on \Drupal\Core\Entity\EntityTypeManagerInterface, see the deprecated \Drupal\Core\Entity\EntityManager to find the correct interface or service.
4) web/modules/contrib/forum_access/includes/forum_access.admin.inc
Line 135: Call to deprecated function drupal_set_message(). Deprecated in drupal:8.5.0 and is removed from drupal:9.0.0. Use Drupal\Core\Messenger\MessengerInterface::addMessage() instead.
5) web/modules/contrib/forum_access/includes/forum_access.admin.inc
Line 139: Call to deprecated function drupal_set_message(). Deprecated in drupal:8.5.0 and is removed from drupal:9.0.0. Use Drupal\Core\Messenger\MessengerInterface::addMessage() instead.
6) web/modules/contrib/forum_access/forum_access.module
Line 411: Call to deprecated function db_or(). Deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Create a \Drupal\Core\Database\Query\Condition object, specifying an OR conjunction: new Condition('OR');
7) web/modules/contrib/forum_access/forum_access.module
Line 413: Call to deprecated function db_and(). Deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Create a \Drupal\Core\Database\Query\Condition object, specifying an AND conjunction: new Condition('AND');
8) web/modules/contrib/forum_access/forum_access_migrate/forum_access_migrate.info.yml
Add core_version_requirement: ^8 || ^9 to designate that the module is compatible with Drupal 9.
Comment #7
mrinalini9 commentedUpdated patch #2 by adding
core_version_requirement: ^8 || ^9in theforum_access_migrate.info.ymlfile. And other deprecations mentioned in #6 seems to be already fixed in the branch 8.x-1.x, please review.Comment #9
mrinalini9 commentedComment #11
Mfgr45 commentedAny further evolutions envisaged to make the module D9-compatible ?
I tried to make it work with the core_version_requirement: ^8 || ^9 and it seemed to work properly for a moment.
But if I try to create a forum with sub-forums, configure roles and then add a topic in it, I get this issue :
Call to undefined method Drupal\node\NodeAccessControlHandler::writeGrants() in forum_access_node_insert() (line 231 of modules/custom/forum_access/forum_access.module).
A new contribution appears in the "Topic" column of /forum page but when you click on it it's like it does not exist. And nothing appears in the "Last post" column. So basically we can't create a proper new topic.
Hope this will help for the transition from D8 to D9.
Comment #12
Mfgr45 commentedI solved my previous issue and add it to the previous patch.
Comment #13
freelockLooks like there's a patch here that has not been tested...
Comment #14
salvisSee https://www.drupal.org/pift-ci-job/1923227
Comment #15
Mfgr45 commentedHere is a fix of my previous patch.
Comment #17
Mfgr45 commentedComment #18
salvisComment #19
Christopher Riley commentedIt would be nice if we at least had a version that would install on Drupal 9 so that we could use composer to manage the module. I know that I can pull it and patch it myself but I grow lazy in my old age.
Comment #20
jackg102 commentedCompletely new to contribution -- not Drupal itself though -- please be kind :- ). I went and tested patch #15 locally on my machine. It is a Drupal 9.1.10 site with the origin/8.x-1.x branch checked out -- I cloned the repo locally and had to get the other ACL module. I found that the patch applied cleanly, and the functionality to block access to forums worked at a basic level, when I configured it to block anonymous users from visiting forums.
However, the problem creating a sub-forum produced an error: "Notice: Undefined index: update_choice in _forum_access_update_access_records() (line 59 of /var/www/web/modules/contrib/forum_access/includes/forum_access.admin.inc)"
Not sure if this is a separate issue referenced in #11.
Was thinking about using this module for a company project rather than a custom solution, but it's a Drupal 9 project.
Edit: After fiddling with it more, the issue has disappeared with creating a sub-forum and no more error, maybe I didn't do something with rebuilding permissions. If I have time, I'll try to reproduce this error, but the access blocking works with sub-forums as well with topics in the sub-forums.
Comment #22
sadashiv commentedThanks all for the patches, have commited this code.
Thanks,
Sadashiv