It seems that this module does not work together with the module Panels. I think it has to do with hook_nodeapi not beeing invoked.

Comments

peter törnstrand’s picture

Solution, move the code to hook_init.

AlexisWilke’s picture

Hi Blixxxa,

What code did you move to hook_init()?

All the code in hook_nodeapi() requires a node identifier... Can you post a patch?

Thank you.
Alexis

ewa777’s picture

I need help with this issues as well blixxxa. If you could offer a patch or some direction I would very much appreciate it. Thanks!

peter törnstrand’s picture

I have looked through my projects but I can't find the one where I used this solution I'm afraid. I also had a look at the code but I think it has changed since last time. However, you could load the node based on values in arg(). Changes made to the node will not however persist when made through hook_init().

Have a look at what OG Panels module does:

function og_panels_init(){
  if(arg(0) == 'node' && arg(1) > 0){
      $group_node = node_load(arg(1));
      if (og_is_group_type($group_node->type)) {
        og_set_theme($group_node);
        og_set_group_context($group_node);
        og_set_language($group_node);
        if( (arg(2) == "" || arg(2) == 'view') && variable_get('page_manager_node_view_disabled',0) == 1){
          drupal_set_message(t("In order to view the homepage, you need to enable node_view template, click ").'<a href="'.url("admin/build/pages/nojs/enable/node_view", array("query"=>"destination=node/$group_node->nid")).'">'.t("here").'</a> '.t("to enable."),"error");
        }
      }
  }
}

Perhaps the following code will get you started:

function protected_node_init() {
global $user;
if (module_exists('panels') && arg(0) == 'node' && is_numeric(arg(1))) {
$node = node_load(arg(1));
$protected = protected_node_isset_protected($node->nid);
if ($protected && !user_access('bypass password protection')) {
drupal_goto( 'protected-node', 'node/' . $node->nid);
}
}
}
ewa777’s picture

Thanks for the idea and the help. I decided to not even use it as its functionality can be easily broken by updates of other more useful and frequently updated modules. I spent a bunch of hours just to scrap it. Oh well that happens.

Evan

AlexisWilke’s picture

Issue tags: +panels

Hi guys,

Just wondering here... Isn't panel supposed to show multiple nodes? If so, how would you handle the case where several nodes have a different password?

Or do you create a node of type "panel" which would be the one protected?

Thank you.
Alexis

AlexisWilke’s picture

Assigned: Unassigned » AlexisWilke
Status: Active » Fixed

Okay, the newer version should work since it makes use of hook_init().

Thank you.
Alexis Wilke

Status: Fixed » Closed (fixed)
Issue tags: -panels

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