User login

How to

Information on how to do something... anything.

Example of hook_block in Drupal 6

<?php
/**
* Implementation of hook_block().
*/
function fightfi_block($op = 'list', $delta = 0) {
  $block = array();
  switch ($op) {
    case 'list':
      $block[0]['info'] = t('Sidebar Links');
      $block[1]['info'] = t('Footer Links');
      return $block;
    case 'view':
      switch ($delta) {
        case 0:

Drupal 7 module development gotchas

First we discovered that you need a .module file for your module to be recognized. A .info file is not enough. (In this case, we only wanted the .install file, we made an empty .module file, and all was well. But then we wanted to add some functions to that empty .module file...)

Now we have found that you need to declare

files[] = agaric_example.module

in your agaric_example.info file for your agaric_example.module to be read!!!

Upgrading Drupal modules

Automated help:
http://drupal.org/project/deadwood

http://drupal.org/project/coder also has upgrade assisting functionality.

General best practices and Drupal 5 to 6:
http://drupal.org/node/114774

Resolution

Git update and ignore local changes

The don't-take-no-for-an-answer way:

git reset --hard

Resolution

How to Unpublish Content

Gus helped a client who wanted a quotation to no longer appear in the rotation for a random quotation block.

Dear client,

Yes, you can delete the quote. Though you probably would simply want to unpublish the quote instead of deleting it. This way you can use the quote in the future without having to re-enter it. If you go here:

http://example.com/admin/content/node

Get the lesser of two or more values with PHP

I love it when PHP has the logically named function. To get the lowest of two or more variables, min($var1, $var2)

Resolution

Deploying with DBScripts

Make sure you are on your master branch:
cd /path/to/project/root
git checkout master

Update your own version. Try to do it at a time when no one else will be committing. (You can check that you don't have any committed but not pushed changes with gitk &.)

./scripts/fetch_rebase
[This script combines the commands git-svn fetch and git-svn rebase for convenience.]

Restore locally deleted files with git

In SVN, running svn update will restore any files you have deleted locally where you have not explicitly committed the removal. Not so in git (or at least git-svn) for removed or moved files.

The tip found will restore not just one, but every deleted file. Agaric recommends you check what you're restoring with just git ls-files -d (where -d stands for --delete) first.

git ls-files -d | xargs git checkout --

Resolve a conflict to use local files after a merge goes bad in git pull

benjamin-agaric: looking for a little git help... i've got my repos on the server
I was pulling from it, but when I tried to push i noticed that i must have done it wrong and had the repository url as http
I changed that to the ssh style git. --and i was now connected to the repository two ways
the really weird thing is that when I pushed it said it wasn't up to date (could not fast forward), and when I pulled I got a conflict!!

Syndicate content