[drupal-devel] [bug] Node options are still looking for individual variable instead of an array

Prometheus6 drupal-devel at drupal.org
Mon Apr 25 14:33:30 UTC 2005


Issue status update for http://drupal.org/node/20868

 Project:      Drupal
 Version:      4.6.0
 Component:    blogapi.module
 Category:     bug reports
 Priority:     normal
-Assigned to:  Anonymous
+Assigned to:  Prometheus6
 Reported by:  Prometheus6
 Updated by:   Prometheus6
-Status:       fixed
+Status:       patch

I found an error in my patch. I don't supply a default value for
variable_get() when I get the node options.
 // get the node type defaults
 $node_type_default = variable_get('node_options_'. $edit['type']);
should be
 // get the node type defaults
 $node_type_default = variable_get('node_options_'. $edit['type'],
array());


Should I create a corrected patch for the same module as the first
patch or against what is currently distributed? I'm just starting to
get the hang of this CVS stuff...




Prometheus6



Previous comments:
------------------------------------------------------------------------

April 19, 2005 - 15:28 : Prometheus6

Attachment: http://drupal.org/files/issues/BLOGAPI_4_6.txt (1.17 KB)

blogapi.module can create (or attempt to..) any node type in 4.6, but
the code to create a new node still assumes the node will be of type
'blog'. In addition, it's still looking for individual variables rather
than the arrays that are stored in 4.6. 


It initializes those fields with calls like


variable_get('node_promote_blog', 1);
This will always return 1 unless you've upgraded to 4.6 from a previous
version and set your blog nodes not to publish by default, and it will
use that value for every type of node.


This patch retrieves the array (and "comment_$node->type") variable for
the appropriate node type and assigns the values accordingly.




------------------------------------------------------------------------

April 20, 2005 - 13:20 : walkah

ACK! it's true... please apply to HEAD and DRUPAL-4-6.


+1




------------------------------------------------------------------------

April 23, 2005 - 01:40 : Steven

Commited to 4.6 / HEAD. Made the following code style changes:


'node_options_'.$edit['type'] to 'node_options_'. $edit['type']
no space between . and ", always a space otherwise


$_node_type_default to $node_type_default
no reason to prefix with an underscore







More information about the drupal-devel mailing list