Hi there,

I've found that before creating a query that includes node types, the current system nodes are retrieved with a use of node_get_types(). The returned value appears to be misused and the array elements are imploded for the use in the SQL statement. However, the Drupal API for hook_node_info() states that the 'name' is "human readable". This should not be used in SQL.

I believe what should be being imploded for the SQL statement is the key valuse returned from the node_get_types() which are defined by the 'base' setting in hook_node_info()

I have supplied a patch which at least fixes this error.

Regards
--AjK

CommentFileSizeAuthor
nmoderation.module.patch_1_27_011.07 KBAjK

Comments

AjK’s picture

Patch applied by Eaton to HEAD and DRUPAL-4-7

http://drupal.org/cvs?commit=32977

Assume issue remaining "patch (code needs review)" as eaton thinks this issue may be connected, in some way, with other issues still outstanding (see commit message)

Regards
--AjK

eaton’s picture

Status: Needs review » Fixed

Correct. Thanks for catching this one, AjK. I realized that I'd been testing with a pile of basic node types like 'page', 'story', 'image', etc that had identical code-level and human-readable names, ensuring that this problem never appeared. I'm going through other strange issues in the nmoderation queue now, to see if this bug was behind them.

Actually, it makes sense to close this one out and handle other issues in their respective threads. Anyhow, thanks!

calebgilbert’s picture

Title: using using node_get_types() before use in SQL » Thanks for all your work on this Eaton.

Am just wondering what setup you have. Am runnning 4.7.1 with today's cvs nmoderation, and cvs voting api. Still can't get it to promote. Willl try cvs nmoderation with 4.7 votingapi tomorrow. Along with a few other things.

calebgilbert’s picture

Title: Thanks for all your work on this Eaton. » Tried 4.7 realease of

...nmoderation and votingapi and it didn't work either...

However, I just figured out that Vote-Up Down totally rocks!

Just downloaded all the 4.7 version of everything and works great for promoting nodes. Though anyone wanting to set that up would do well to read this (from you, no less):

"Hey there.
Eaton - February 2, 2006 - 04:05

Sorry for the lack of documentation for that module. It's part of a project that I'm completing for a sponsor, and really requires another module based on the VotingAPI (SimpleVote is one example) to be useful.

If you're using the SimpleVote module to rate content, you might try the following setup. Create a Voting Action set that applies to the content type 'Node'.

Add a filter criteria with the value type 'Percentage,' a blank tag, and the function 'average'. Set the comparison to 'greater than' and the value to, say, 80%.

Add a second filter criteria with the value type 'Percentage,' a blank tag, and the function 'count'. Set the comparison to 'greater than' and the value to, say, 10.

Finally, add an action: 'Promote Node to Front Page.'

The result? whenever a user votes on a piece of content, the Voting Action set will be evaluated. If at least 10 people have voted on it, and the average vote is at least 4 out of 5 stars (80%), the node will be promoted to the front page.

I'm working on simpler ways to set up these actions -- right now, it requires some tinkering around and some knowledge of how the results of votes are stored by the Voting API. If you have any ideas on how it might be simplified, I'm all ears!

--
Jeff Eaton | I heart Drupal.

Anonymous’s picture

Status: Fixed » Closed (fixed)