Create a fixed position customized information box similar to the Devel Themer module for specific users, but with your own information.
I find on some Drupal sites that I want to see information all the time behind the scenes, but I don't want the client to see. I added simple code to allow me to do just that. While it is true that I can use the Devel or Devel Themer modules, there is some information that I want which is not provided by Devel, so creating my own custom code works. This code can be embedded into a block, module, or in just the page.tpl.php (or any page template suggestions).
Now, to make things simpler in this tutorial, I embedded inline CSS, but you can obviously add this to any .CSS file.
global $user;
$username = $user->name ;
if($username=="developer")
{
// Generate all your Drupal and PHP variables
$nid = arg(1);
$alias = drupal_get_path_alias();
// Print out your HTML div tag with inline CSS or CSS class attribute
echo ('
Developers Only:
Read moreCreating an Excel file
I recently was tasked with creating a report of how many people signed up for the site by date. The query was simple, but creating the file was a bit of a challenge.
<?php
/**
* User sign up report, output as a CSV.
*/
function mymodule_signups_csv() {
// Prevent Devel from messing us up.
$GLOBALS['devel_shutdown'] = TRUE;
// Set the headers to indicate this is a CSV file.
header('Content-type: text/csv; charset=UTF-8');
header('Content-Disposition: attachment; filename=user_signups.csv');
header('Pragma: no-cache');
header('Expires: 0');
// Create a file.
$output = fopen('php://output', 'w');
// Column names.
fputcsv ($output, array('Date', 'Count'));
$query = "SELECT DATE(FROM_UNIXTIME(created)) AS joined, COUNT(*) AS number FROM {users} "
. "WHERE status = 1 "
. "GROUP BY DATE(FROM_UNIXTIME(created)) "
. "ORDER BY created DESC ";
$result = db_query($query);
// Loop through the rows.
foreach ($result as $row) {
fputcsv($output, (array) $row);
}
fclose($output);
}
?>To get to this code was just a matter of creating a MENU_CALLBACK and adding a link to an existing page.
Note the 3rd line. Devel outputs its stuff after the </html> tag, so Excel saw that as data. That simple statement just turns Devel off for this single page load.
Tools for testing & debugging
There are a number of tools available for tuning plugins and configurations, identifying exact parts of a process or config section require your attention.
Rules Debug Log

The Rules Debug Log is built-into Rules and is available through the settings page. It's a very useful complement for the configuration and programming processes, because it follows what rules are executed and displays that information for you in the help region.
For example, it can show what conditions are evaluated TRUE or FALSE, which variables were used, what order operations were executed, how long time each step takes, etc etc.
If something unexpected is happening, then viewing that output is a very helpful way of pinpointing why it is happening. Once you identify the source of a problem, click the [edit] link next to the event.
Also, we've included edit links so you can easily jump from the debug log to the Rules UI in order to fix up a miss-configured rule.
Read moreDevel integration
If you have Devel enabled, you will notice an extra tab when viewing subscription entities.
This allows you to quickly inspect subscription objects and help debug your code:
