Skip to content

Instantly share code, notes, and snippets.

View opalsignum-snippets's full-sized avatar

opalsignum-snippets

View GitHub Profile
@opalsignum-snippets
opalsignum-snippets / pw_profile_extender.module
Created June 20, 2013 07:51
PHP: Views Embedding in the User Profile Form with hook_form_alter
<?php
/**
* Implements hook_form_alter().
* - Extends the User Profile Form with the calendar view
*/
function pw_profile_extender_form_alter(&$form, &$form_state, $form_id) {
if ($form_id == 'user_profile_form') {
$form['calendar admin'] = array(
@opalsignum-snippets
opalsignum-snippets / mymodule.module
Created June 21, 2013 09:23
Drupal: Change Multiple Field Values bigger than 10 and smaller unlimited
/**
* Implements hook_form_alter().
*/
function MODULENAME_form_alter(&$form, $form_state, $form_id) {
if ($form_id == 'field_ui_field_edit_form') {
$max_values = 20;
$form['field']['cardinality']['#options'] = array('-1' => t('Unlimited')) + drupal_map_assoc(range(1, $max_values));
}
}
@opalsignum-snippets
opalsignum-snippets / migrateuserd6d7.php
Created June 27, 2013 08:03
This standalone script migrates Users from Drupal 6 to Drupal 7
<?php
/*
Standalone PHP script to migrate users from Drupal 6 to Drupal 7 programatically.
Date: 9-4-2012
*/
// set HTTP_HOST or drupal will refuse to bootstrap
$_SERVER['HTTP_HOST'] = 'example.org';
$_SERVER['REMOTE_ADDR'] = '127.0.0.1';