Agaric Design Collective

Changents

Change the SVN branch your repository checkout is using

As shown here http://svnbook.red-bean.com/en/1.4/svn.branchmerge.switchwc.html

it is simply the svn switch statement with the path to the respository (which in our case was at svn://example.com...)

svn switch http://svn.example.com/repos/calc/branches/my-calc-branch

 

Always show N number of items when showing items in sets of N

<?php
/**
* Pad an array with its own elements to make it divisible by the given number.
*
* Take items from the beginning of the array and add to the end to ensure the
* array is a multiple of that number. Useful for display with innerfade.
*
* Utility function that does not have any other home yet, but desperately
* wants to escape from object-land here...
*/

 

Looking at SQL to fix broken queries in a Drupal environment

Alternate title: Apparently I don't understand SQL (and so need all the help I can get)

The easiest way to get a better look at your SQL in Drupal is to install the devel module. (Hint: It's for use on development sites, not production sites!)

 

File upload not working on Mac OS X development environment

Update: Solution

slarosa reported on this "Files Don't Attach" thread that the only thing that fixed file uploading was:

EXPLICITLY SET the upload tmp dir in php.ini to be THE SAME of the tmp dir set up in the file upload config in Drupal; for instance:

vi /Applications/xampp/etc/php.ini

 

Print information associated with a node elsewhere in page.tpl.php, using a separate template file for theming

Thanks to a little refresher on the _phptemplate_callback function (replaced in Drupal 6's theming system with the theme registry) from searching Nick Lewis' site.

<?php
function _phptemplate_variables($hook, $vars = array()) {
if ($hook == 'page') {

 

PHP's Debug Backtrace Function

debug_print_backtrace()
http://us2.php.net/manual/en/function.debug-print-backtrace.php

and

debug_backtrace()
http://us2.php.net/manual/en/function.debug-backtrace.php

the latter outputs an array rather than printing directly and has lots more options, and can even take an object to run the backtrace on.

 

Another reason user module needs to be rewritten... or maybe this is just a file handling issue

I'm blaming user module even though I know intimately that I shouldn't: a 2 hour estimate to add user picture upload to the client's custom registration form has become a journey through HTML form and PHP file handling hell because even Drupal core doesn't let you upload a user picture when uploading. Finally just put it on the second page of the client's two screen login process.

 

Automatically putting a user's post into an organic group

The final result is in the (as yet unreleased, but if you want the code we'll send it) special treatment module.

Some test ouput and discovery of key function along the way:

<?php
'og_groups' =>
array (
11054 =>
array (
'title' => 'A Center for Development and Entrepreneurship',
'type' => 'partner',
'status' => '1',

 

Getting around a subversion file lock on a live server

Another contractor on a project with us, and one way or another there came to be this issue with files modified locally on the live server— to which, in our own practice, we only ever update, so there can never be conflicts.

I've made the change we discussed last week to the audio blog module.
PIN numbers are now being stored in a separate table