bar
5/10/2016 - 12:35 PM

redirect loop access denied

redirect loop access denied

I was having a bit of a hard time understanding the exact results that you were experiencing, but this might help. For me, it was important to realize that the "user/register" page reacts differently based on whether the user is anonymous or authenticated.

What's Probably Happening
Anonymous Users

User tries to access the protected node.
Drupal identifies a 403 error, tries to serve up the 403 page, which you have defined as "user/register".
Drupal should serve up the user registration form just fine.
Authenticated Users

User tries to access the protected node.
Drupal identifies a 403 error, tries to serve up the 403 page, which you have defined as "user/register".
Drupal sees that the user is already logged in, and attempts to serve up the defined 403 page, since the user has already registered. Loop back to #2, which brings us to #3, and on and on.
In my case, I created a php node with the following code.

Possible Solution
Create a new page (node/add/page), and set the input format to PHP code. (Note: If you don't have this option, you'll need to enable the PHP filter module first.)
Paste the following code into the body of the page, including the <?php ?> tags:
// If the user is NOT logged in, display the login block.
if(!$GLOBALS['user']->uid){
  drupal_set_title('Please Log In');
  print 'This page is only available to certain registered users.';
  print drupal_get_form('user_login_block');
}

// If the user IS logged in... 
else{
  drupal_set_title('Access Denied');
  print 'You are not authorized to access this page.';
}
Save the page. While viewing the page, hover over the Edit tab, and make note of the node id in the URL. (For something like "http://www.site.com/node/1/edit", the node id is 1.)
Go to Administer > Site configuration > Error reporting (admin/settings/error-reporting), and set the Default 403 (access denied) page to the system URL of the node you just created, such as node/1.
Give it a spin!
Hope that helps. It did when I was experiencing a similar problem.