how's that for a subject?

So, I've got one content type that belongs to an OG group, rendered by Panels/ctools. It has nothing to do with nodecomments - the comment format for this content type is set to Drupal Comments. When I go to the node/add page for this content type, a blank page with an Access Denied error is rendered (even for user 1). BUT, below that blank page, if you scroll down, is the node/add form, which appears to be fully functional. Unfortunately, if the user doesn't scroll down, he has no idea there's really a form there.

I put in a ddebug_backtrace() call in my page.tpl.php file, and the only thing I can see in the drupal_access_denied array is a reference to nodecomment. I've attached two screenshots: one shows the full output of the access denied page, and one shows the output above the correctly rendered content (which appears on the same page, directly below the access denied page - the page, from <html> to </html>, is being rendered two times). As you can see in the one with the access denied error, it's pointing to nodecomment.module.

Here's the thing - the page that Panels is rendering here has no nodecomments in it. it's a node/add page, and it only contains three panes, two of which are custom HTML with no PHP code in them, the third is the node edit form for this content type. This Panels page is a clone of another (for a different content type also living in OG) that works fine. the only differences between the two panels pages is in the custom html panes, and each has a different selection mechanism, based on content type - otherwise identical. The other one doesn't display the page twice.

So, why would nodecomment.module be involved here at all, and is it involved in this double-render?

CommentFileSizeAuthor
Picture 11.png25 KBfriolator
Picture 10.png130.07 KBfriolator

Comments

friolator’s picture

I should add a couple notes: I've created a couple of dummy content types - one asigned to OG and one not, in an effort to rule OG out. Both of those give me the access denied, in the same place as above - nodecomment.module, line 285:

<?php
 280     // If a node is being used as a comment type, do not simply allow
 281     // creation of it.
 282     if (arg(0) == 'node' && arg(1) == 'add' && !is_numeric(arg(3))) {
 283       foreach (node_get_types('names') as $type => $blank) {
 284         if (nodecomment_get_comment_type($type) == $node->type) {
 285           return drupal_access_denied();
 286         }
 287       }
 288     }
?>

Setting the comment type to a nodecomment type results in the same error

...but none of these are set to use nodecomment as a comment type. all of them use drupal comments.

friolator’s picture

Title: Page renders twice - once with access denied, then correctly, ddebug_backtrace looks like nodecomment might be involved » nodecomment.module triggering access denied error on node/add pages; causing double page load

better title, now that i've got a slightly better handle on what's happening here.

friolator’s picture

Some additional information:

1) the code that's calling drupal_access_denied() says:

<?php
280     // If a node is being used as a comment type, do not simply allow
281     // creation of it.
?>

I've verified that none of the other content types on the site (there are about a dozen) are using this type as a comment type.

2) When I turn the Panels node/edit overrides off (via the disable function in Panels), these pages render without the prepended access denied page. I've checked in the contexts for the page type in Panels, and there's nothing that stands out as unusual - it's very simple: no additional contexts, and all I'm doing is inserting a couple custom content panes (html) and the node/edit form for this content type. I'm using a selection condition in Panels to make sure it's only showing this form for this type of content and that works correctly.

3) I replaced the call to drupal_access_denied() inside of nodecomment.module with a ddebug_backtrace() call, and noticed references to the nodecomment type I use for forum replies (via advanced forum) inside of several ctools related objects. I thought that was strange since the forums aren't connected with this group type in any way, so I printed the $type from the foreach loop at nodecomment.module line 283 and I get:

forum_reply
forum

...which means the Forum Reply content type, which is used as a nodecomment type, is being called here for some reason.

At this point I'm completely confused - I don't know if this is a Panels/Ctools thing, or if it's a nodecomment thing, something to do with advanced forum/panels integration, or what. Any assistance would be greatly appreciated!

friolator’s picture

Status: Active » Closed (fixed)

so, this just cleared itself up all by itself this morning. No coding has really gone on in any areas related to this, but now it's all back to normal.

go figure.