Edit

Wordpress

Rename stuck field names

<?php

$fields = array(
    'field_inspirational_imagery' => 'field_images',
);
 
// Loop through each of the fields/tables with the old name and change them
foreach($fields as $field_name => $new_field_name) {
 
    // First check that field_name exists
    if(!db_table_exists('field_data_' . $field_name)) {
        // If we cannot find a data table then just continue.
        continue;
    }
 
    // Define some things...
    $data_table_name = 'field_data_' . $field_name;
    $revision_table_name = 'field_revision_' .

OSX Virtual Web Host Config

add line to /etc/hosts

127.0.0.1 amniot.localhost

add lines to /etc/apache2/httpd.conf

NameVirtualHost 127.0.0.1:80

<VirtualHost amniot.localhost:80>

<Directory "/Library/Webserver/Documents_AMNIOT">
    Options FollowSymLinks Indexes
    AllowOverride All
    Order deny,allow
    allow from All
</Directory>
ServerName amniot.localhost
DocumentRoot "/Library/Webserver/Documents_AMNIOT"

</VirtualHost>

MySQL Basics

add export PATH=$PATH:/usr/local/mysql/bin to ~/.bash_profile or /etc/profile

Backup database to text file

mysqldump database_name > database_name.sql

Remove database

mysql> drop database database_name;

Create database

mysql> CREATE DATABASE database_name;

Manually reset Drupal admin password

<?php
define('DRUPAL_ROOT', getcwd());
require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
require_once DRUPAL_ROOT .

PHP

JQuery

Nested-query approach to mining field_collection data and relationship

<?php

function get_species_country($id_country) {
    $inner = new EntityFieldQuery();
    $inner_r = $inner->entityCondition('entity_type', 'field_collection_item')
                     ->fieldCondition('field_species_country', 'target_id', $id_country, '=')
                     ->execute();
    if(!empty($inner_r['field_collection_item'])) {
        $keys = array_keys($inner_r['field_collection_item']);
        $query = new EntityFieldQuery();
        $species_r = $query->entityCondition('entity_type', 'node')
                      ->entityCondition('bundle', se

Create symlinks

<?php

symlink('/homepages/21/d93015512/htdocs/library/organic_connectivity',
        '/homepages/21/d93015512/htdocs/drupal/sites/all/modules/organic_connectivity/lib');

?>

Trauma Informed Care

Subtitle: 
Information &amp; Blog
Installation URL: 
http://www.traumainformedhawaii.net

Pages