? og_mandatory_d6port.patch
? og_mandatory_group.module.patch
Index: og_mandatory_group.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/og_mandatory_group/og_mandatory_group.info,v
retrieving revision 1.1
diff -u -p -r1.1 og_mandatory_group.info
--- og_mandatory_group.info	25 Oct 2006 22:24:06 -0000	1.1
+++ og_mandatory_group.info	2 Sep 2008 15:43:03 -0000
@@ -1,5 +1,7 @@
-; $Id: og_mandatory_group.info,v 1.1 2006/10/25 22:24:06 pwolanin Exp $
+; $Id: og_mandatory_group.info,v 1.1 2008/06/12 00:00:00 Exp darren.ferguson $
 name = Organic groups mandatory group
 description = Make one group mandatory for new users and/or require new users to pick a group.
-dependencies = og
+dependencies[] = og
 package = Organic groups
+core = 6.x
+php = 5.1
\ No newline at end of file
Index: og_mandatory_group.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/og_mandatory_group/og_mandatory_group.module,v
retrieving revision 1.10
diff -u -p -r1.10 og_mandatory_group.module
--- og_mandatory_group.module	13 Sep 2007 01:24:00 -0000	1.10
+++ og_mandatory_group.module	2 Sep 2008 15:43:03 -0000
@@ -1,23 +1,26 @@
 <?php
-// $Id: og_mandatory_group.module,v 1.10 2007/09/13 01:24:00 pwolanin Exp $
+// $Id: og_mandatory_group.module,v 1.10 2008/06/12 00:00:00 darren.ferguson Exp $
+
 /**
  * Implementation of hook_help
- * 
+ *
  */
-function og_mandatory_group_help($section) {
-  switch ($section) {
+function og_mandatory_group_help($path, $arg) {
+  $output = '';
+  switch ($path) {
     case 'admin/og_settings/og_mandatory_group':
       $output =  '<p>'. t('Choose one group that all new users will be put into. You can chose either an open or a closed group. The user will be auto-approved as member of the group.');
       $output .= '</p><p>'. t('You may also choose to require the new user to join one group in addition to any mandatory group. This setting will only have an effect if there are groups listed in the user registration form.'). '</p>';
-      return $output;
+      break;
    }
+   return $output;
 }
 
 /**
  * Implementation of hook_form_alter
- * 
+ *
  */
-function og_mandatory_group_form_alter($form_id, &$form) {
+function og_mandatory_group_form_alter(&$form, $form_state, $form_id) {
 
   if ($form_id == 'user_register' && isset($form['og_register'])) {
     $form['og_register']['og_mandatory_in_form'] = array('#type' => 'value', '#value' => FALSE,);
@@ -29,16 +32,16 @@ function og_mandatory_group_form_alter($
         $form['og_register']['og_mandatory_in_form'] = array(
           '#type' => 'checkbox',
           '#title' => $title,
-          '#value' => TRUE, 
+          '#value' => TRUE,
           '#attributes' => array('disabled' => 'disabled'),
         );
         unset($form['og_register']['og_register']['#options'][$mandatory_group]);
         $group_count--;
         $form['og_register'] = array_reverse($form['og_register']);
       }
-    } 
+    }
     if ($group_count > 0 && variable_get('og_mandatory_additional_group', FALSE)) {
-      if ($mandatory_group && $mandatory_group_in_form) {    
+      if ($mandatory_group && $mandatory_group_in_form) {
         $form['og_register']['minimum'] = array ('#value' => t('You must join at least one additional (non-mandatory) group.'),);
       }
       else {
@@ -50,10 +53,10 @@ function og_mandatory_group_form_alter($
 
 /**
  * Implementation of hook_user
- * 
+ *
  */
 function og_mandatory_group_user($op, &$edit, &$account, $category = NULL) {
-  
+
   if (!module_exists('og')) {
     return;
   }
@@ -69,7 +72,7 @@ function og_mandatory_group_user($op, &$
           }
         }
       }
-      break;    
+      break;
     case 'insert':
       // Sloppy modules may try to register an account with uid == 0.
       if (($group = variable_get('og_mandatory_group', 0)) != 0 && $account->uid) {
@@ -85,20 +88,20 @@ function og_mandatory_group_user($op, &$
           while ($row = db_fetch_object($result)) {
             if ($edit['og_register'][$row->nid]) {
               switch ($row->selective) {
-          case OG_OPEN:
-            $groups .= check_plain($row->title) .' '. t('(open group)');
-            break;
-          case OG_MODERATED:
-            $groups .= check_plain($row->title) .' '. t('(moderated group)');
-            break;
-          case OG_INVITE_ONLY:
-            $groups .= check_plain($row->title) .' '. t('(invite only group)');
-            break;
-          case OG_CLOSED:
-            $groups .= check_plain($row->title) .' '. t('(closed group)');
-            break;
+                case OG_OPEN:
+                  $groups .= check_plain($row->title) .' '. t('(open group)');
+                  break;
+                case OG_MODERATED:
+                  $groups .= check_plain($row->title) .' '. t('(moderated group)');
+                  break;
+                case OG_INVITE_ONLY:
+                  $groups .= check_plain($row->title) .' '. t('(invite only group)');
+                  break;
+                case OG_CLOSED:
+                  $groups .= check_plain($row->title) .' '. t('(closed group)');
+                  break;
               }
-              $groups .= "\n\t". url("node/$row->nid", NULL, NULL, TRUE) ."\n\n";
+              $groups .= "\n\t". url("node/$row->nid", array('absolute' => TRUE)) ."\n\n";
             }
           }
         }
@@ -106,14 +109,14 @@ function og_mandatory_group_user($op, &$
         $result = db_query($sql, $group);
         while ($row = db_fetch_object($result)) {
           if ($row->mail) {
-            $body = t('You may manage subscribers at @url', array('@url' => url("og/users/$node->nid", NULL, NULL, TRUE)));
+            $body = t('You may manage subscribers at @url', array('@url' => url("og/users/$node->nid", array('absolute' => TRUE))));
             if (strlen($groups)) {
               $body .= "\n". t('The user also subscribed to the following groups:') ."\n\n". $groups;
             }
             if (user_access('administer users', user_load(array('uid' => $row->uid)))) {
-              $body .= "\n". t('You may manage this user at @url', array('@url' => url("user/$account->uid/edit", NULL, NULL, TRUE)));
+              $body .= "\n". t('You may manage this user at @url', array('@url' => url("user/$account->uid/edit", array('absolute' => TRUE))));
             }
-            drupal_mail('og_mandatory_group_register', $row->mail, $subj, $body, $from);
+            drupal_mail('og_mandatory_group_register', 'notify', $row->mail, $subj, $body, $from);
           }
         }
       }
@@ -121,31 +124,24 @@ function og_mandatory_group_user($op, &$
   }
 }
 
-
 /**
  * Implementation of hook_menu
- * 
+ *
  */
-function og_mandatory_group_menu($may_cache) {
-
-  $items = array();
-  
-  if ($may_cache) {  
-    $items[] = array(
-       'path' => 'admin/og/og_mandatory_group',
-       'title' => t('Organic groups mandatory group'),
-       'description' => t('Make one group mandatory for new users and/or require new users to pick a group.'),
-       'callback' => 'drupal_get_form',
-       'callback arguments' => 'og_mandatory_group_settings',
-       'access' => user_access('administer site configuration'), 
-      );
-  }
-  return $items;  
+function og_mandatory_group_menu() {
+  $items['admin/og/og_mandatory_group'] = array(
+    'title'            => t('Organic groups mandatory group'),
+    'description'      => t('Make one group mandatory for new users and/or require new users to pick a group.'),
+    'page callback'    => 'drupal_get_form',
+    'page arguments'   => array('og_mandatory_group_settings'),
+    'access arguments' => array('administer site configuration'),
+  );
+  return $items;
 }
 
 /**
  * menu callback for module settings
- * 
+ *
  */
 function og_mandatory_group_settings() {
   $options[0] = theme('placeholder', t('none'));
@@ -164,24 +160,24 @@ function og_mandatory_group_settings() {
   $form['groups'] = array(
     '#type' => 'fieldset',
     '#title' => t('Choose the mandatory group'),
-  );  
+  );
   $form['groups']['og_mandatory_group'] = array(
-    '#type' => 'radios', 
-    '#options' => $options, 
+    '#type' => 'radios',
+    '#options' => $options,
     '#default_value' => variable_get('og_mandatory_group', 0),
   );
-  
+
   $form['og_mandatory_additional_group'] = array(
-      '#type' => 'checkbox', 
+      '#type' => 'checkbox',
       '#title' => t('Require new users to join at least one group in addition to any mandatory group'),
       '#default_value' => variable_get('og_mandatory_additional_group', FALSE),
   );
-  $form['#validate'] = array('og_mandatory_group_settings_validate' => array());
+  $form['#validate'][] = 'og_mandatory_group_settings_validate';
   return system_settings_form($form);
 }
 
-function og_mandatory_group_settings_validate($form_id, $form_values, $form) {
-  if (!isset($form['groups']['og_mandatory_group']['#options'][$form_values['og_mandatory_group']])) {
+function og_mandatory_group_settings_validate($form, &$form_state) {
+  if (!isset($form['groups']['og_mandatory_group']['#options'][$form_state['values']['og_mandatory_group']])) {
     form_set_error('groups', t('Invalid mandatory group- please choose an option from the list.'));
   }
 }
