Problem/Motivation
When trying to post a new topic as a non-admin user, the website throws an error:
Error: Call to undefined function forum_access_get_settings_by_user() in forum_access_form_node_form_get_available_tids() (line 798 of modules/contrib/forum_access/forum_access.module).
Proposed resolution
The module includes/forum_access.acl which contains the function forum_access_get_settings_by_user() seems not to be loaded. Add this line above line 798:
module_load_include('inc', 'forum_access', 'includes/forum_access.acl');
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | forum_access-module-acl-access-not-loaded-for-non-admins-3302353-1.patch | 626 bytes | Tramb |
Issue fork forum_access-3302353
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
Comment #2
TrambHi,
Here the patch to fit with my proposed resolution.
Comment #3
salvisI wonder why no one else seems to have this problem...
Comment #4
salvisComment #5
aimai commentedRe-opening the issue as we've run into it recently as well.
It seems like in some cases
forum_access_form_node_form_get_available_tidsis called before theforum_access.aclfile is included, resulting in the above error.Comment #6
aimai commentedComment #8
nico.b commentedI can confirm that this issue exists, and that the provided MR fixes the issue.
I think the reason why not many people experience this issue is that - as far as I could tell - it only appears if
forum_access_form_node_form_get_available_tidsis called "outside" of the "normal" flow of the module (e.g. by a custom module). Imho, it's still a flaw in the implementation of `forum_access_form_node_form_get_available_tids` though since a caller shouldn't be responsible to load any dependencies of the called method (since the caller can't know what needs to be loaded). Therefore, the fix makes sense in my opinion.Comment #9
nevergoneI tested it and this error does occur when calling the forum_access_form_node_form_get_available_tids() function from outside. The attached patches fix the error.
Comment #13
nevergone