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.
After updating to Views 3.6 I am getting the following errors on my products page.
Notice: Undefined property: stdClass::$machine_name in views_plugin_argument_validate_taxonomy_term->validate_argument() (line 108 of sites/all/modules/views/modules/taxonomy/views_plugin_argument_validate_taxonomy_term.inc).
Comment | File | Size | Author |
---|---|---|---|
#6 | views-fix-machine-name-notice-1948646-5.patch | 839 bytes | jsacksick |
Screen Shot - After update | 42.08 KB | ibakayoko | |
Screen Shot - Before update | 110.44 KB | ibakayoko |
Comments
Comment #1
gb2world CreditAttribution: gb2world commentedI am experiencing either the same or a related problem.
After installation of 7.x-3.6 (with Drupal 7.21), none of my taxonomy pages are found.
I've tried disabling clean URLS and the path module - the default path to the taxonomy page still is not found: /?q=taxonomy/term/1
The error reported when trying to view a taxonomy page is:
Notice: Undefined property: stdClass::$machine_name in views_plugin_argument_validate_taxonomy_term->validate_argument() (line 108 of /sites/all/modules/views/modules/taxonomy/views_plugin_argument_validate_taxonomy_term.inc).
Comment #2
osysltd CreditAttribution: osysltd commentedAcknowledge. The same bug!
Comment #3
pslcbs CreditAttribution: pslcbs commentedSame trouble for me
Notice: Undefined property: stdClass::$machine_name en views_plugin_argument_validate_taxonomy_term->validate_argument() (línea 108 de /sites/all/modules/contrib/views/modules/taxonomy/views_plugin_argument_validate_taxonomy_term.inc).
Comment #4
m.ioannidis CreditAttribution: m.ioannidis commentedTemp Fix:
File:
/sites/all/modules/views/modules/taxonomy/views_plugin_argument_validate_taxonomy_term.inc
Lines: 106, 107
$term = taxonomy_term_load($term->tid);
$this->argument->validated_title = check_plain(entity_label('taxonomy_term', $term));
Should be:
//$term = taxonomy_term_load($term->tid);
$this->argument->validated_title = check_plain($term->name);
THIS IS A TEMP SOLUTION! JUST TO GET THINGS WORKING!
Comment #5
m.ioannidis CreditAttribution: m.ioannidis commentedBETTER SOLUTION:
Change line 108 of /sites/all/modules/views/modules/taxonomy/views_plugin_argument_validate_taxonomy_term.inc
from:
return empty($vocabularies) || !empty($vocabularies[$term->machine_name]);
TO
return empty($vocabularies) || !empty($vocabularies[$term->vocabulary_machine_name]);
That should do it!
Comment #6
jsacksick CreditAttribution: jsacksick commentedThese lines have been changed in this commit #1914024: Title-overriden term name not translated on a taxonomy overriden views page, the $term variable used to contain the machine_name retrieved by the sql query
$query->fields('tv', array('machine_name'));
but $term is overriden by a taxomony_term_load and doesn't have the machine_name property, here's the patch that fixes the issue.Comment #7
Rafix CreditAttribution: Rafix commentedI am experiencing he same problem. I see there is a patch but I don't know how to apply it. First time I have to solve something like this.
Can anyone give a guidelines?
Thank you in advance!
Comment #8
roderikPATCH RUSH :D
I was just making the same patch / trying to find out why 'machine_name' was suddenly not OK anymore, and can echo jsacksick's comments.
(The mentioned issue commit introduced the error by not adjusting the 3rd line in its 1st hunk).
Comment #9
fledev.com CreditAttribution: fledev.com commentedSubscribing to the changes - #6 which worked for me to.
Comment #10
roderikInadvertant status change in #9, I assume. This patch has had enough review.
Comment #11
osysltd CreditAttribution: osysltd commentedman patch.
patch -p1 < FILE_NAME
put the patch in sites/all/modules/views
Comment #12
jeanyvesberger CreditAttribution: jeanyvesberger commentedSame problem here.
In contextual filters , i had to change the 'filter value type' from 'term ids' to 'term ids separated by , or +' to make this error disappear. Will try the patch anyway.
Comment #13
Rafix CreditAttribution: Rafix commentedThank you but I don't really know what you say. As I said before, this is the first time I have to use a patch. I am reading about it in drupal (getting involve/ patches) and It is very difficult to me (as my english is only survival and my code experienced is 0, so both thing togehter...)
Would you help me explaining it step by step? I know is very much but with a clear explanation once I will not need asking, and asking other users each time I do an step...
Thank you anyway.
Comment #14
Allthegearnoidea CreditAttribution: Allthegearnoidea commentedRafix
I'm not here to give advice on applying patches as I struggle with it often too. Though for a simple change like this one I found this very useful: http://drupal.org/node/534548
Essentially though for this fix it is very straightforward:
m.ioannidis's comment (#5) is the way to fix this problem, but to repeat what m.ioannidis has posted, simply do the following (having backed everything up).
Go to the file called views_plugin_argument_validate_taxonomy_term.inc located at /sites/all/modules/views/modules/taxonomy
Open the views_plugin_argument_validate_taxonomy_term.inc file in a code editor of some sort (e.g Editplus). Go to line 108 and change the line from:
return empty($vocabularies) || !empty($vocabularies[$term->machine_name]);
TO
return empty($vocabularies) || !empty($vocabularies[$term->vocabulary_machine_name]);
Save the amended file back in to the /sites/all/modules/views/modules/taxonomy location and the problem is fixed. It really is that simple
So in this case no need to try and apply patches you can simply change the code by editing the file directly. Because it is just a case of amending 1 line.
m.ioannidis thank you for the fix, it sorted my site out straight away.
Comment #15
Rafix CreditAttribution: Rafix commented@Allthegearnoidea @m.ioannidis
Thank you very much. I've just did what you explain me and now it is working perfectly! I guess sooner or later I will need to learn how to apply patches but at this moment you both save me!
Thanks again!
Comment #16
jackdaniel9 CreditAttribution: jackdaniel9 commentedPatch #6 Work
Comment #17
djob CreditAttribution: djob commentedHad the same issue today with latest views module. Adding vocabulary_ worked for me.
Will this be corrected in future views module download?
thank you
Comment #18
gb2world CreditAttribution: gb2world commentedThanks for patch in #6 - resolved the problem for meas well.
Comment #19
bluehead CreditAttribution: bluehead commentedThanks dude. I tried all patches and none of them worked. Your hint solved my problem - temporarily. Hope there will be a proper patch soon
Comment #20
dawehnerAlso another duplicate: #1949178: Notice: Undefined property: stdClass::$machine_name in views_plugin_argument_validate_taxonomy_term->validate_argument() (line 1 sorry.
Comment #21
greenwork CreditAttribution: greenwork commentedThis fixed it for me too on my ubercart catalog being blank with a custom view.
Comment #22
samwillc CreditAttribution: samwillc commentedCan confirm #6 fixed it for me too :)
Comment #23
marco71 CreditAttribution: marco71 commentedNice man thanks for that. I was getting puzzeled. Second fix works fine.