Drupal 6

 →  Железный drupal_goto()

published 05 January 2012

Когда используем drupal_goto() в кастомном модуле на хуках типа hook_nodeapi() или hook_user() наш редирект могут запросто перехватить, другие модули, поэтому можно воспользоваться следующей хитростью

unset($_REQUEST['destination']);
drupal_goto('somewhere');

Для drupal 7 работает такая штука

function mersibo_helper_user_login(&$edit, $account) {
    $GLOBALS['destination'] = 'user';
}

 →  Закачка добавленного видео на ютуб

published 30 July 2011

I thought I would share the configuration I came up with, in case it is helpful to anyone else.

My use case: Upload a video, display it on youtube, and then display the video on my site in an emfield.

Setup: (a) Enable and configure these modules: emfield, emvideo media_youtube media_mover_api, media_mover_cck, media_mover_emfield (b) Create a cck node type (“video”) with both a filefield (eg “field_filefield_video) and an emvideo field (eg “field_emvideo”) (c) Create a few video-type nodes. Leave the emvideo field blank, and upload some videos into the filefield.

 →  Запрос в drupal 6

published 26 July 2011

db_query(“SELECT us.name FROM {user_relationships} ur INNER JOIN {users} us ON ur.requestee_id = us.uid WHERE ur.requester_id = ‘%s’ AND ur.approved = %d”, $uid, 1);

%s - means string

%d -means integer

%b - means Binary

%% -means Inserts a literal % sign

%f - means Float

while ($item = db_fetch_object($result)) { $options[$item->name] = $item->name; }