Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Notice: Undefined variable: vocabulary in term_permissions_form_alter() (line 152 of /...mysite.../sites/all/modules/term_permissions/term_permissions.module).
i am system admin ( i have all the permissions ) and i have set my roll to have access to all taxonomy terms but i am getting this error ...
Comment | File | Size | Author |
---|---|---|---|
#5 | term_permissions-undefined_variable-1776178-5.patch | 3.63 KB | drasgardian |
Comments
Comment #1
Exlord CreditAttribution: Exlord commentedi am not sure whats wrong with ur queries but both of the are returning
false
.i changed the queries and they seems to be working dine now ...
line 261: function term_permissions_allowed :
Comment #2
MiSc CreditAttribution: MiSc commented@Exlord, could you please add a patch for the fix?
Comment #3
anavrin CreditAttribution: anavrin commentedHi there, I had the same problem:
Notice: Undefined variable: vocabulary in term_permissions_form_alter() ...
The problem is when (at least in my case) user has permission to only one term in a vocab. Have no idea why in the condition:
if (count($options) <= 1) was less or equal ?
it sould be if (count($options) < 1) - because sometimes user is allowed only one value ...
Changing this solved my problem. I also used a more redable form me version of code sent by Exlord #1 ...
So my whole modification looked like this:
if (count($options) < 1) {
and
instead of
Comment #4
anavrin CreditAttribution: anavrin commentedand no matter what there should be some exception catch added in the situation when user is not allowed to the field at all ...
Comment #5
drasgardian CreditAttribution: drasgardian commentedAttached is a patch against the latest dev implementing the work from #3 and also addressing #4 by denying the user access to the form if they do not have permissions for any of the terms and the field is required.
Comment #6
matthiasm11 CreditAttribution: matthiasm11 at MM-Experience commentedHi
When i read through the #5 patch, I think there is a closing parentheses missing:
vocabulary.', array('%user' => isset($user->name) ? $user->name : variable_get('anonymous', 'Anonymous'),
should be
vocabulary.', array('%user' => isset($user->name) ? $user->name : variable_get('anonymous', 'Anonymous')),
The patch works fine.
Comment #7
gmasky CreditAttribution: gmasky commentedHas this been fixed in the core module? I am still getting this error here http://www.jaaindia.com/user/register
Comment #8
gmasky CreditAttribution: gmasky commentedNever mind. I had a field in the registration form and had not given permission to anonymous users to access the field.
Comment #9
AaronMcHaleI'm getting this same error when using the Pollfield module, using the latest 7.x release of both of these modules. I'm not sure if the issue is with this module or Pollfield though.
Any help would be appreciated
Comment #10
Camario39 CreditAttribution: Camario39 commentedIm not sure if this is related, but as a non admin user with permission to only a single term. If the user does not have access to the DEFAULT term selected in the manage fields section, then this error will display.
removing the default fixed the issue for me.
Comment #12
roborn CreditAttribution: roborn at Frontkom for Norwegian University of Life Sciences commentedPatch on #5, we need to verify if permissions are enabled for the term and update code from 6.x
I fixed that and committed it.
Thank you, guys :)