[development] node_get_types() question

Gerhard Killesreiter gerhard at killesreiter.de
Sun May 28 09:44:26 UTC 2006


AjK wrote:
> Hi all,
>
> I just got this issue on a module of mine:-
>
>   http://drupal.org/node/65893
>
> I have managed to reproduce the error and as far as I can
> see the fix is trivial. However, it raises something I'm
> not 100% sure on. The Drupal API docs state for hook_node_info():
>
> 	"The 'name' value is a human-readable name for the node..."
>
> Now, the error as reported to me is the name I use is "Jan's node"
> which I believe to meet the criteria in the hook definition. The
> problem comes in nmoderation.module due to this line:-
>
>   $types = implode("','", variable_get('nmoderation_node_types',
> node_get_types()));
>
> which feeds through to the SQL query thus
>
>   .. WHERE n.type IN ('$types') ..
>
> I can fix my module and remove the quote in the name but as far as
> I can tell nmoderation is not escaping before imploding. If the API
> says "human-readable" then "Jan's node" complies.
  return array('janode' => array('name' => t("Jan's node"), 'base' => 
'janode'));

is the code in question. IMHO there is a bug there somewhere, as 
"janode" should be used as the node type when inserting into the database.

Cheers,
    Gerhard



More information about the development mailing list