This is for a module called nodepromocode, I couldn't find it on drupal, but it is included with paypalnode. So I assume its a custom module.

I have an odd error going on

foreach ($vocabs as $i => $v) { // these will be used for column headers
$vocab_headers[$v] = taxonomy_get_vocabulary($v)->name;
}

The bold part in this piece of code is causing the site to completely not load. and show a white page, an error is not even given.
If I remove the part in bold everything works fine.
Anyone know why?

Comments

TheDarkFlop’s picture

I have nailed it down to the paypalnode.install file on line 99

foreach ($vocabs as $i => $v) {
$vocab_headers[$v] = taxonomy_get_vocabulary($v)->name;
}

and have also posted it as a critical error at http://drupal.org/node/208411

Any ideas or thoughts to fix this are greatly appreciated!

papile’s picture

The most likely explanation is that one of the $v numbers corresponds to a null value. null->name will throw a fatal error.

In the for loop put this above the vocab_headers line

print "Vocabulary is: ".var_dump(taxonomy_get_vocabulary($v))."\n";

if you see it no output data on one iteration (IE prints just "Vocabulary is:") then you know you are not getting an object back, and you know that is your problem.

To make sure that does not happen you can check for null:

$vocabulary = taxonomy_get_vocabulary($v);
if($vocabulary)
    $vocab_headers[$v] = $vocabulary->name;
TheDarkFlop’s picture

Awesome.
Looks like that was the problem.
First off thanks so much. I ran into this problem and needed it for a client, and things were looking bleak.
I am still learning my way into the drupal programming, I know php preatty darn well, but I need to spend
some time learning how code in drupal.

I probably going to be writing a module for so it will definitely help me bring up the skills.
I am going to start with the drupal handbooks, any other places or articles that have a good intro to using the drupal api?

giggler’s picture

I don't see the setting to enter promocode either, where should it appear for admin? It shows in the node under publishing cost, but I can't seem to fine the configuration for it...