0

When i log in to drupal doesn't matter with any account either admin or normal user. I get error Access Denied. I then again try to login and it works fine. What is that problem? My theme was shipped with its own drupal so i guess they might have done some thing wrong.

I feel some session issue because my error messages on drupal valiation forms also occurs one page delayed. So if a submit a invalid form the page post back and hight light the fields with red color but don't show any message. When i go to any other page the error message dive comes up. This happens on both front end and admin panel forms.

Update: I forgot to mention that i am using a custom template for user login page.

Here is the code for my user login template. I am not sure if this is causing issue or something else.

<?php
     // we aren't getting messages, get them manually
            if (isset($_SESSION['messages'])) {
                echo '<div class="messages">';
                foreach($_SESSION['messages'] as $type=>$messages) {
                    echo "<p class=\"$type\">".implode("</p><p class=\"$type\">", $messages)."</p>";
                }
                echo '</div>';
                unset($_SESSION['messages']);
            }
?>
<h1>Login</h1>
<div class="qualia-user-login-form-wrapper">
  <?php print drupal_render_children($form) ?>
</div>

Updatd Part: I found the culprit i.e my own module

Actually i got the problem. But coudln't find the work around. I have a custom module that redirects user to paypal when he is creating account on my site. I put the $form and $form_state values in session and when the user return back from paypal i pass both variables to user_register_submit function to resume the process of creating account. For this purpose i have to put @session_start() at the start of my module file. This works fine in case of my paypal process. But because of sesion_start() my login flow is disturbed. What can i do to resolve this issue as i need session to hold form and form state

1

What worked for me was enabling and configuring the $cookie_domain variable in settings.php (because I have a site that can be accessed by 2 different domains).

Pay attention to the comment before this variable! The domain name must start with a period. EX:

$cookie_domain = '.example.com';

Good luck!

0

Try rebuilding the site's permissions. Goto Reports -> Status Report. About half way down the page you'll find a link to rebuild permissions.

  • Still same issue :( – user38296 Oct 28 '14 at 15:48
  • If you are using any modules that affect permissions, try disabling them and then enable them one at a time until you find the culprit. – Neal Garrett Oct 28 '14 at 18:20
  • Isn't there any way to find it via code ? I have 100 modules shipped with the theme/ – user38296 Oct 28 '14 at 20:24
  • There's only a handful that deal with permissions. Use module_filter with keyword "access". – Neal Garrett Oct 28 '14 at 21:04
  • Try adding a !empty condition to your if $_SESSION statement. if (!empty($_SESSION['messages'] && isset($_SESSION['messages'])) {...} sometimes you'll run into values being set but are empty... – Neal Garrett Oct 28 '14 at 21:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy