By jacobson on
I have encountered a problem previously identified in node 122234 that seems to arise from calling drupal_access_denied inside a page template. The header and side bars of the page are rendered, and then the entire page (including header and sidebars) are rendered again in the page body. No solution to this problem was provided in node 122234. If an anonymous user tries to access certain pages, I want to give them an access denied error and present the login page. How do I do this from inside a page or node template if not with drupal_access_denied?
Thanks.
Comments
I'm getting the duplicate
I'm getting the duplicate rendering from a different situation. If I register as a user with admin approval being required, an email gets sent to the user. If the user tries to use the one-time login URL before the admin has approved the account, this triggers the "drupal_access_denied()". I have not manually added a call to this function anywhere in my code, but I still get this duplicate rendering.
Any update on this? I'm also
Any update on this? I'm also getting a duplicate page when a new user clicks the one-time login and they were not approved yet.
I know this is pretty late,
I know this is pretty late, but I stumbled upon this post and then found a solution right after. For those who find this in the future, just put an "exit;" call after "drupal_access_denied()", and that should stop the other parts of the page from rendering.
Hey, I stumbled with the same
Hey, I stumbled with the same problem as this one! Thank you very much! I made use of the suggestion you made. It's better late than never! Thanks!
That saved me quite a bit of
That saved me quite a bit of time. Thanks! It worked perfectly.
thanks a lot!! tried <?php
thanks a lot!!
tried
return drupal_access_denied();but it didn't work
Try this: <?phpreturn
Try this:
Web Software Engineer at
Insem S.p.A. - www.insem.it
still same problem
No change same problem.
return drupal_access_denied();
exit();
above code is use less.
Gauri Shankar