Views Bulk Operations & Actions (plus configurable secondary page) in Drupal 5

Here's a quick example of writing an Action (5.x-2.x, which is a backport of 6.x's API style) for Views Bulk Operations. It allows you to assign selected users from a view (Usernode) and assign them to selected Organic Groups from a secondary page.

<?php
/**
* Implementation of hook_action_info().
*/
function go_views_bulk_ops_action_info() {
  return array(
   
'go_views_bulk_ops_action' => array(
     
'description' => t('Add Selected Users to OG'),
     
'type' => 'node',
     
'configurable' => TRUE,
      ),
  );
}

function
go_views_bulk_ops_action_form($context) {
 
$ogs = og_all_groups_options();
 
$form['ogs'] = array(
   
'#title' => t('Groups'),
   
'#type' => 'checkboxes',
   
'#options' => $ogs,
   
'#description' => t('Select which Groups the selected users will join'),
  );
  return
$form;
}

function
go_views_bulk_ops_action_validate($form_id, $form_values) {}

function
go_views_bulk_ops_action_submit($form_id, $form_values) {
  return array(
'ogs' => $form_values['ogs']);
}

function
go_views_bulk_ops_action(&$node, $context) {
   
$uid = db_result(db_query("select uid from {usernode} where nid=%d", $node->nid));
    foreach(
$context['ogs'] as $gid){
        if(
$gid)
           
og_save_subscription($gid, $uid, array('is_active' => 1));
    }
}
?>