I have only one node type assigned as containing webform: 'webform', as by default. But all the content nodes are shown on the webform management page. The problem is in the following code:

function webform_admin_content() {
  $webform_types = webform_variable_get('webform_node_types');
  $placeholders = implode(', ', array_fill(0, sizeof($webform_types), '%d'));
  $result = db_query(db_rewrite_sql("SELECT n.* FROM {node} n WHERE n.type IN ($placeholders)", $webform_types));

- which generates the following SQL statement: SELECT n.* FROM node n WHERE n.type IN (%d) - which for some weird reason returns all nodes.
I don't really understand what happenes here and have no time to investigate the problem, but the following change solves it:

  $webform_types = "'".implode(webform_variable_get('webform_node_types'), "', '")."'";
  $result = db_query(db_rewrite_sql("SELECT n.* FROM {node} n WHERE n.type IN ($webform_types)"));

Comments

quicksketch’s picture

Priority: Critical » Normal

Thanks for the report. I think we just need to change '%d' to '"%s"', since the webform type name is going to be a string, not an integer. I must have not updated the code properly when I borrowed a similar line of code from organic groups.

quicksketch’s picture

Status: Needs review » Fixed
StatusFileSize
new1 KB

Looks like this was both because of using %d instead of %s and because we weren't passing in the variables correctly into db_query (instead we were passing them into db_rewrite_sql). While I was fixing this I also corrected a notice thrown by node.module because $node->format was not set, which is stored in the node_revisions table.

marrch_caat’s picture

Wonderful, thanks for fast reaction and for wonderful helpful module itself!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.