Drupal 6.x

Oz's picture

Node Import playing nice with Organic Groups

Out of the box the Node Import module doesn't play nice with the Organic Groups module. When trying to configure nodes to be posted into a group after the content import, two Drupal database tables are important: og_access_post and og_ancestry. The og_access_post table has two columns, nid and og_public. The og_public field should either 0 or 1 depending on whether you want the post to be public or not. The og_ancestry table also has two columns, nid and group_nid. After importing content, it is import to update these two tables with the appropriate data.

Oz's picture

Function to retrieve a content type form array

.code {
background: #ffffd0; margin: 12px 12px 12px 12px; padding: 3px 3px 3px 3px;

//$form['#field_info'] contains information about cck fields
function _cck_form_array($type) {
module_load_include('inc', 'node', 'node.pages');
global $user;
$form_state = array();
$node = array('type' => $type, 'uid' => $user->uid, 'name' => $user->name);
$form = drupal_retrieve_form($type.'_node_form',$form_state,$node);
drupal_prepare_form($type.'_node_form', $form, $form_state);
return $form;

Oz's picture

Node Import Tip

I was unable to import node reference fields that were autocomplete fields. To make this work, I had to change the node reference field to a select field. Then in the csv, use the Title of the node to import that reference. Also, when trying to import a field that is a single on/off checkbox, I wasn't able to import the on value. I kept receiving an invalid value error. To fix this I had to change the single on/off value to a regular select field.

Oz's picture

Applying Drupal Patches in Windows

Download GNU Patch Utility

Navigate to module directory you are patching.
Type "patch -p0 < path/file.patch --binary"
Without --binary you will receive the message "Assertion failed: hunk, file ../patch-2.5.9-src/patch.c, line 354

This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information."

Oz's picture

Removing orphaned actions


Use the url:

to remove orphaned actions

Oz's picture

Drupal install database configuration page: no result or no error messages and page reloads

When trying to install Drupal and entering database credentials, the page just reloads with no error messages displayed. The problem is because the default.settings.php file was renamed instead of copied. You must copy this file and rename the copy.

Oz's picture

How to programmatically assign a user to a group

It took me a while to find some functions that can be used to programmatically assign a user to a group. So here is some functions, links, and details for anybody who wants to do something similar. These functions were a pain to find using Google, so here are some reference notes.

og_subscribe_user($groups = array(), $account = NULL, $replace = FALSE, $request = '')

This will subscribe a user to group, but membership must be approved.

Oz's picture

Calling node_delete from hook_cron doesn't delete node

When calling node_delete from within a hook_cron function, it will not delete the node because of the node_access call within node_delete. To make this work you must load a user who has permission to delete nodes.

global $user;
$user = user_load(1);

Oz's picture

Sorting views columns that are node/user reference fields

I used to just slap views together using the cck content fields as column data. The problem I have found with this is you cannot sort the columns. To do so, you must use the relationships offered by views. So when adding a field, you choose node->title and choose the appropriate relationship. By doing this, you will be able to configure views to sort the columns .

Oz's picture

Changing theme to Pixture Reloaded does not load stylesheets

I recently changed a site from Pixture to Pixture Reloaded and all of a sudden there was just links, text, and white space .... no styles! I couldn't figure out why this was happening, so I cleared the cache which will sometimes solve this problem. This didn't work. I read somewhere that configuring the color scheme settings for Pixture Reloaded will fix this. So I changed the settings, and it worked. I changed from Pixture to Pixture Reloaded because it seems that Pixture doesn't display node titles.

Syndicate content