I need to debug a D7 site from the anonymous user. What settings need to be changed to allow anonymous to view dsm(), dpm(), krumo(), etc. commands?
Note: I have already enabled Access developer information
under the Devel module for all roles.
I need to debug a D7 site from the anonymous user. What settings need to be changed to allow anonymous to view dsm(), dpm(), krumo(), etc. commands?
Note: I have already enabled Access developer information
under the Devel module for all roles.
Give them Access developer information
permission at admin/people/permissions
.
Note that this opens a huge security risk so make sure you revoke it when you are done with debugging.
To use drupal_set_message()
for anonymous user, you need to have a uid= 0
in users
table.
Check in your users table with uid=0 record exists. If not create a user with uid = 0;
Also, check here
The Omega custom child theme was blocking messages from being printed.
Excerpt from zone--content.tpl.php:
<!-- zone--content.tpl.php -->
<?php if ($wrapper): ?><div<?php print $attributes; ?>><?php endif; ?>
<div<?php print $content_attributes; ?>>
<?php if ($breadcrumb && 0): // DISABLED! ?>
<div id="breadcrumb" class="grid-<?php print $columns; ?>"><?php print $breadcrumb; ?></div>
<?php endif; ?>
<?php if ($messages && $is_admin): ?>
<div id="messages" class="grid-<?php print $columns; ?>"><?php print $messages; ?></div>
<?php endif; ?>
<?php print $content; ?>
</div>
<?php if ($wrapper): ?></div><?php endif; ?>
Note the if ($messages && $is_admin)
statement.
This is the correct answer for this particular case despite the lack of information provided in the initial question. Though the other answers provided are relevant and highly informative, this answer is selected to help future users troubleshoot.
Thanks everyone for your help!
If you have given the Access developer information permission to anon. user, make sure that the page you are accessing does not have any missing resources: images or anything that would result in status 404 being returned by the server.
While generating 404 response, the server calls drupal_get_messages()
which effectively clears the Drupal message queue, resulting in $messages
variable being empty when rendered in page.tpl.php .
Probably someone needs to debug a variable right away and want to have something like DPM for ONE particular anonymous user without giving the "Access developer information" to ALL anonymous users (which is a dangerous thing in production environment), then you can do this:
if ($some_condition_is_true) {
has_krumo();
drupal_set_message(krumo_ob($my_var));
}
Hope that helps!