? ogrc_5x_update_1.patch
? ogrc_5x_update_2.patch
Index: README.txt
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/og_reg_codes/README.txt,v
retrieving revision 1.1
diff -u -p -r1.1 README.txt
--- README.txt	2 Jan 2007 02:41:43 -0000	1.1
+++ README.txt	13 Feb 2007 01:43:26 -0000
@@ -1,6 +1,6 @@
 README for og_reg_codes.module:
 
-Compatible with Drupal 4.7. Requires the Organic Groups module.
+Compatible with Drupal 5.x. Requires the Organic Groups module.
 
 This module is an add-on for the Organic Groups module designed to help 
 facilitate users in joining a specific group on sites that have a number of 
@@ -27,7 +27,7 @@ It could also be useful, for example, in
 codes at the end of a term/semester.
 
 All the settings may be controled at the settings page at 
-/admin/settings/og_reg_codes.
+/admin/og/og-reg-codes.
 
 ---
 written by Peter (pwolanin@drupal)
Index: og_reg_codes.info
===================================================================
RCS file: og_reg_codes.info
diff -N og_reg_codes.info
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ og_reg_codes.info	13 Feb 2007 01:43:26 -0000
@@ -0,0 +1,6 @@
+; $Id$
+name = Organic groups registration codes
+description = Make group codes available so users can join.
+dependencies = og
+package = Organic groups
+version = VERSION
Index: og_reg_codes.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/og_reg_codes/og_reg_codes.module,v
retrieving revision 1.2
diff -u -p -r1.2 og_reg_codes.module
--- og_reg_codes.module	11 Feb 2007 23:53:25 -0000	1.2
+++ og_reg_codes.module	13 Feb 2007 01:43:26 -0000
@@ -9,13 +9,11 @@ function og_reg_codes_help($section) {
   global $user;
   
   switch ($section) {
-    case 'admin/modules#description':
-      return t('Make group codes available so users can join.');
-    case 'admin/settings/og_reg_codes':
+    case 'admin/og/og-reg-codes':
       $output =  '<p>'. t('Settings for Organic Groups registration codes.  A new user will be auto-approved as member of a group when they supply a group code at registration.  Users may also visit the "join a group" page to join a group using a code.');
       $output .= '</p><p>'. t('You may combine this feature with the usual use of groups in the registration form.'). '</p>';
       return $output;
-    case 'og/use_code':
+    case 'og/use-code':
       $output = '<p>'. t('You may check a group code by entering it below.');
       if ($user->uid) {
         $output .= ' '. t('You may also join a group by submitting its code.');
@@ -35,15 +33,19 @@ function og_reg_codes_menu($may_cache) {
   
   if ($may_cache) {
     $items[] = array(
-      'path' => 'admin/settings/og_reg_codes',
-      'title' => t('og reg. codes'),
-      'callback' => 'og_reg_codes_set',
+      'path' => 'admin/og/og-reg-codes',
+      'title' => t('OG registration codes'),
+      'description' => t('Configure group registration codes.'),
+      'callback' => 'drupal_get_form',
+      'callback arguments' => array('og_reg_codes_set'),
      );  
     $items[] = array(
-      'path' => 'og/use_code',
-      'title' => t('use group code'),
-      'callback' => 'og_reg_codes_join',
-      'type' => MENU_SUGGESTED_ITEM,
+      'path' => 'og/use-code',
+      'title' => t('Use group code'),
+      'callback' => 'drupal_get_form',
+      'callback arguments' => array('og_reg_codes_join'),
+      'weight' => 10,
+      'type' => MENU_LOCAL_TASK,
      );  
   }
 
@@ -58,7 +60,7 @@ function og_reg_codes_form_alter($form_i
 
   if ($form_id == 'og_invite_form') {
     $code = og_reg_codes_get_code($form['gid']['#value']);
-    $form['pmessage']['#default_value'] = t(_og_reg_codes_message(), array('%reg_code' => $code)). "\n\n";
+    $form['pmessage']['#default_value'] .= strtr(_og_reg_codes_message(), array('%reg_code' => $code)). "\n\n";
   }
   elseif ($form_id == 'user_register') {
     if (!isset($form['og_register'])) {
@@ -69,7 +71,7 @@ function og_reg_codes_form_alter($form_i
       '#title' => t('Group registration code'),
       '#required' => variable_get('og_reg_code_required', TRUE),
       '#description' => t('Enter the group registration code that you received from a current group member or site administrator.'),
-      '#suffix' => t('Before registering, you can <a href="%url">check your group code</a>.', array('%url' => url('og/use_code')))
+      '#suffix' => t('Before registering, you can <a href="!url">check your group code</a>.', array('!url' => url('og/use-code')))
     );
   }
 }
@@ -80,7 +82,7 @@ function og_reg_codes_form_alter($form_i
  */
 function og_reg_codes_user($op, &$edit, &$account, $category = NULL) {
   
-  if (!module_exist('og')) {
+  if (!module_exists('og')) {
     return;
   }
   global $user;
@@ -178,10 +180,10 @@ function og_reg_codes_set() {
   $form['reset_salt'] = array(
     '#type' => 'submit', 
     '#value' => t('Reset codes'),
-    '#suffix' => '<p>'.t("All existing codes will be invalidated.  The last date that new codes were initiated was %date", array('%date' => $date)).'</p>',
+    '#suffix' => '<p>'.t("All existing codes will be invalidated.  The last date that new codes were initiated was !date", array('!date' => $date)).'</p>',
   );
 
-  return system_settings_form('og_reg_codes_set', $form);
+  return system_settings_form($form);
 }
 
 function og_reg_codes_set_validate($form_id, $form_values, $form) {
@@ -193,9 +195,8 @@ function og_reg_codes_set_validate($form
 }
 
 function og_reg_codes_set_submit($form_id, $form_values) {
-  $op = isset($_POST['op']) ? $_POST['op'] : ''; 
 
-  if ($op == t('Reset codes')) {
+  if ($form_values['op'] == t('Reset codes')) {
     variable_del('og_reg_codes_salt');
     drupal_set_message(t('All registration codes have been reset and given new values.')); 
   }
@@ -226,7 +227,7 @@ function og_reg_codes_join() {
   if ($user->uid > 0) {
     $form['submit'] = array('#type' => 'submit', '#value' => t('Submit and join') );
   }
-  return drupal_get_form('og_reg_codes_join', $form);
+  return $form;
 }
 
 function og_reg_codes_add_preview($form) {
@@ -279,7 +280,7 @@ function theme_og_reg_codes_join_preview
  */
 
 function _og_reg_codes_message() {
-  return variable_get('og_reg_codes_message', "To join this group, use the registration code %reg_code");
+  return variable_get('og_reg_codes_message', t("To join this group, use the registration code %reg_code"));
 }
 
 /**
