User login

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

Resolution

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...
*/
function change_agent_au_pad(&$array, $num, $force = FALSE) {
  $count = count($array);
  if ($force || $count > $num) {

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!)

Use Drupal to display a table from an array of data and export to CSV

http://api.drupal.org/api/function/theme_table/5

PHP array to CSV solution from the usenet forums:

<?php
$csvstring = "'" . implode("','", $array) . "'";
?>

The below (from idealog) will only work if you know your data is escaped or has no commas.

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
Then in the file, make sure this is set and not commented out:
upload_tmp_dir = /tmp

That's how to do it.

For historical fun Agaric's misdirected debugging will stay down here.

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.

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.

Wrote a module almost just like http://drupal.org/project/reg_with_pic

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:

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.

Syndicate content