David Thomas

Drush commands

  1. Execute a drush command. Run `drush help [command]` to view command-specific help.

Fix for Add more options to weight form element

  1. /**
  2.  * Implementation of hook_elements().
  3.  */
  4. function example_elements() {
  5.   // add our process function to weight type element
  6.   $type = array();
  7.   $type['weight']['#process'] = array('example

Add more options to weight form element

  1. /**
  2.  * Implementation of hook_elements().
  3.  */
  4. function example_elements() {
  5.   // add our process function to weight type element
  6.   $type = array();
  7.   $type['weight']['#process'] = array('resourc

Supress E_NOTICE errors

  1. <?php
  2. /* The following patch goes in includes/common.inc
  3.  * drupal_error_handler
  4.  * around line 620 in D6
  5.  * to switch off E_NOTICE errors
  6.  * add $conf['e_notice_suppress']
  7.  * to settings.php

Image link to user profile node

  1. <?php
  2. if( user_is_logged_in() ){
  3.   global $user;
  4.   $image = theme('image', path_to_theme().'/images/image.png', t('My profile') );
  5.   $nid = db_result( db_query("SELECT nid FROM {node} WHERE type =

Link to user profile node

  1. <?php
  2. if( user_is_logged_in() ){
  3.   global $user;
  4.   $nid = db_result( db_query("SELECT nid FROM {node} WHERE type = '%s' AND uid = %d", 'photographer_profile', $user->uid) );
  5.   echo l( t('Profile')

Adding to user profile

  1. function sample_user($op, &$edit, &$account, $category = NULL)
  2. {                                                              
  3.     if($op=='view') {                                          
  4.    

drupal_goto escape issue

  1. // in a submit handler  
  2.  
  3.   $q = array();
  4.   $q['firstname'] = $form_state['values']['firstname'];
  5.   $q['lastname'] = $form_state['values']['lastname'];
  6.   $q['org_name'] = $form_state['values']['o

drupal.org access issue

  1. Sep 23 10:10:43 <pipes> ben: yeah we have seen this before
  2. Sep 23 10:10:59 <pipes> something something either varnish or nginx (or both) hashing based on geoip location stuff
  3. Sep 23 10:11:09 <pipes>

drupal.org access issue

  1. Sep 23 10:10:43 <pipes> ben: yeah we have seen this before
  2. Sep 23 10:10:59 <pipes> something something either varnish or nginx (or both) hashing based on geoip location stuff
  3. Sep 23 10:11:09 <pipes>

Fix for Debug cron by logging each module

  1. /* Replace drupal_cron_run in includes/common.inc with the following version
  2. *  Adds logging each module cron run time.
  3. */
  4.  
  5. function drupal_cron_run() {
  6.   // If not in 'safe mode', increase the m

Debug cron by logging each module

  1. /* Replace drupal_cron_run in includes/common.inc with the following version
  2. *  Adds logging each module cron run time.
  3. */
  4.  
  5. /**
  6.  * Executes a cron run when called
  7.  * @return                    

Debug cron by logging each module

  1. // Iterate through the modules calling their cron handlers (if any):
  2. // module_invoke_all('cron');                                      
  3. /* DT 20081217 Applied patch for verbose cron logging */    

make node cck fields into a table

  1. /**
  2.  * return cck fields formatted as table
  3.  */
  4. function phptemplate_content_format_table($node){
  5.   // get fields
  6.   $fields = content_fields(NULL, $node->type);
  7.   $header = array('', '');
  8.   $ro

make node cck fields into a table

  1. /**
  2.  * return cck fields formatted as table
  3.  */
  4. function phptemplate_content_format_table($node){
  5.   // get fields
  6.   $fields = content_fields(NULL, $node->type);
  7.   $header = array('', '');
  8.   $ro

make node cck fields into a table

  1. /**
  2.  * return cck fields formatted as table
  3.  */
  4. function energynews_get_cck_table($node){
  5.   // get fields
  6.   $fields = content_fields(NULL, $node->type);
  7.   $header = array('', '');
  8.   $rows = arr

hide changelog.txt

  1. # Protect files and directories from prying eyes.

put drupal into maintenance mode with SQL

  1. # The following SQL can be used to set Drupal into maintenance mode
  2. # It's necessary to clear the variables cache to refresh the new setting.
  3.  
  4. # SET MAINTENANCE MODE

virtualhost php ini conf - increase max upload size

  1. # increase php settings per-site in the virtualhost conf file
  2. php_value memory_limit 64M
  3. php_value max_execution_time "180"
  4. php_value upload_max_filesize 32M
  5. php_value post_max_size 32M

default node_access entry

  1. drupaldb=> SELECT * FROM node_access;
  2.  nid | gid | realm | grant_view | grant_update | grant_delete
  3. -----+-----+-------+------------+--------------+--------------
Syndicate content