OG Group Page

<?php

// Create a group page if the account has never been accessed

$temp = users_to_text_file_contents();
users_print($temp);

/**
* Parse users field
*/
function users_print($temp){
foreach($temp as $item) {
if ($item->uid != 0){ // Filter out uid == 0
//drupal_set_message(print_r($item,TRUE));
$node = new stdClass();
$node->type = 'group';
$node->title = $item->name;
$node->uid = $item->uid;
$node->comment = 0;
$node->promote = 0;
$node->language = LANGUAGE_NONE;

//create the node
$node = node_submit($node);
node_save($node);
}
}
}

/**
*
* Retrieve node data from database
*
* @return
* A result set of the targeted nodes.
*/
function users_to_text_file_contents(){
//Use Database db_select API to retrieve nodes.
$queryResult = db_select('users', 'n')
->fields('n')
->condition('access', 0) // Never Access
->orderBy('created', 'DESC') //Most recent first.
->execute();
return $queryResult;
}