Helping Others Help Others

Node Title for Custom Pagers

Custom Pagers module adds useful navigation to chosen nodes. The navigation can be displayed at the top and/or bottom of node's content, allows selection of specific node types, and further tweaking can be done with views. By default, however, custom pagers can only print <previous next >. How to display the node titles instead? Add this function to the template.php of the chosen theme: function phptemplate_preprocess_custom_pager(&$vars) { $nav = $vars['nav_array']; $prev = 'prev'; if (!empty($nav['prev'])) { $nodeObj = node_load($nav['prev']); if ($nodeObj) { $prev = node_page_title($nodeObj); } } $next = 'next' ...
Read more

Disable Google Analytics by Role or User

Update: new code to allow excluding individual node as well as roles and users. Google Analytics module allows for tracking by selected roles. What it does not natively provide is a mechanism to exclude specific roles. To disable tracking for a particular role or even a specific user, edit Page specific tracking settings section. Choose Add if the following PHP code returns TRUE and enter the following code, adjusting the role names and the user IDs (uid). This could be also used for control of block displays, when displaying content ...
Read more

Simple Rotating Block Content

There are a number of solutions available for management of content display within a block, creating slideshows, tabs, etc. Sometimes a simple rotating message is needed, and can be accomplished with a few lines of code. This example has 4 quotes with css classes that can be further styled in the theme's css. One of the pre-requisites for entering php code into blocks is enabling PHP filter in admin/build/modules and setting appropriate user permissions. Once in the block edit mode, be sure to choose PHP code as the Input Format ...
Read more

View advanced visitor data in Statistics Advanced module

View advanced visitor data through a view. Follow the instructions below, or download and import stats_access_log.txt Download and import the view as described at http://drupal.org/node/398184 Edit the view Change path in the following displays as follows: Page: admin/reports/stats-view/main Page-Hostname: admin/reports/stats-view/hostname/% Page-PageTitle: admin/reports/stats-view/hostname/% For the Default display: Select Access log: Page title under Fields Check Output this field as a link and set Link path: admin/reports/stats-view/pagetitle/[title] Click Update Select Access log: Hostname under Fields Check Output this field as a link and set Link path: admin/reports/stats-view/pagetitle/[title] Click Update I want to ...
Read more

Gushing over Drush

One of the best Drupal modules yet - Drush. Actually it's not a traditional module - it's a command line toolset. In other words, if you enjoyed UNIX, DOS, or BASIC (working without GUI), this is for you. If you have no idea what the above means, stop now. The video below shows installation of views, context, token, cck, and drush module manager. Final times: Manual Method: 2:38:75, Drush Method: 1:17:57. Multiply those savings by 20-30 modules and weekly updates. This will be the first tool I will have in ...
Read more

Multisite Drush

The Drush enjoyment doesn't stop with single site installations. To ensure typo-free commands in multi-site environments, I have set up additional aliases in .bashrc. alias drush1='/home/account/drush/drush -l http://example1.com/' alias drush2='/home/account/drush/drush -l http://example2.com/' This allows for a command like drush1 status or drush1 update to quickly work on the first web site, while drush2 update automagically knows to only update modules on the second web site. Add aliases as desired!
Read more