Hi, Thank you for this nice module. Currently I am having some problems. I am using D6.22 with protected-node-1.6 or 1.7. It seems that in neither of these versions the actions work. If I execute the action "protect all nodes" I receive this error, both with 1.6 and 1.7:

user warning: Column count doesn't match value count at row 1 query: INSERT INTO protected_nodes (SELECT n.nid, 0 AS protected_node_show_title, 1 AS protected_node_is_protected, '' AS protected_node_passwd FROM node n LEFT JOIN protected_nodes pn ON n.nid = pn.nid WHERE pn.nid IS NULL) in /xxxxxxxxx/public_html/sites/all/modules/protected_node/protected_node.settings.inc on line 649.

Nor does "remove protection" work when I have enabled protection in Edit contentype --> protected node settings. The protection still maintains.

Also the protected node statics shows all nodes unprotected even when some are (manually) protected. Any idea?

Comments

Strato’s picture

And also when I add a string in "Password field label on password page " the password protected page shows a blank page.

AlexisWilke’s picture

I checked in a fix for the "Protect all nodes" action from the global settings of Protected node. The table changed and the SQL used in that action was not compatible anymore. I changed the SQL so changes to the table won't matter any longer.

The "Remove password protection from all nodes" seems to do what is supposed to happen from what I can tell. However, I noticed my stats changing from 7 nodes to 8 nodes after I clicked on "Restore nodes that already have a password".

As for the label, I use it with "Please [user], enter the password for this page here" and it works. Did you try to enter some HTML in there? Or use other tokens that could add HTML?

Also, I would try with a different theme to see whether the theme could be the cause. But I doubt it at this point.

Thank you.
Alexis Wilke

Strato’s picture

Thank you for your very prompt reply.

"protect all nodes" seems to work after your update. Statistics are also working when "protect al nodes" is executed.

"Remove password protection from all nodes" only removes protection from the "protect all nodes protection". Not protection which is set in edit 'node type'. This remains but is not included in the stats.

I do not know what you exactly mean with "Restore nodes that already have a password", do you mean "Protect nodes that already have a password" under restore protection?

If I enter "test" in the label, the password protected node shows blank when I click on the title ("Password protected"). Even with Garland. So when the system has to print the label it shows a blank.

Manually protected nodes aren't included in the statistics. I can protect a node which isn't shown in "protected nodes" in statistics. Only batch actions seems to update the statistics correctly.

AlexisWilke’s picture

Strato,

Well... if you know PHP maybe you can help by testing the code?

The "Remove password protection from all nodes" simply clears the protected_node_is_protected flag. When a node is protected, that flag is set to 1 (TRUE). When the node is not protected, it is set to 0 (FALSE).

function protected_node_action_unprotected_all($form, &$form_state) {
  $sql = "UPDATE {protected_nodes} SET protected_node_is_protected = 0 WHERE protected_node_is_protected = 1";
  db_query($sql);
}

In the module we check that flag whenever a user is about to view a node:

  [...]
  case 'view':
    if (!empty($node->protected_node_is_protected)) {
      // node is protected, deal with it...
      [...]

So I do not see how the protection could still happen after such a function.

"Restore nodes that already have a password" was renamed already: "Protect nodes that already have a password"

The statistics does not take anything in account other than the protected_node_is_protected flag as you can see in this statement:

  $sql = "SELECT COUNT(nid) FROM {protected_nodes} WHERE protected_node_is_protected = 1";
  $protected_count = db_result(db_query($sql));

I'm not too sure how this could fail in your install. Caches are not used so that would not be it... The only problem I could foresee is a page that was cached when unprotected and protecting it does not delete the cache, thus making the page available even though it would have been marked protected.

Thank you.
Alexis Wilke

Grimreaper’s picture

Issue summary: View changes
Status: Active » Closed (outdated)

Hello,

I close this issue because Drupal 6 is no more supported. https://www.drupal.org/drupal-6-eol

If this issue is present in Drupal 7, feel free to re-open it.