--- og_invite_link.module.original	2011-12-16 16:01:00.000000000 -0200
+++ og_invite_link.module	2011-12-22 15:14:00.000000000 -0200
@@ -144,27 +144,43 @@
  * Alter the OG admin settings form
  */
 function og_invite_link_form_og_admin_settings_alter(&$form, &$form_state) {
+  // Add Realname variable if available
+  $description = 'The subject of the message sent to group admins whenever a user sends out a group invitation. Available variables: @group, @site, @description, !group_url, @body, @sent-to, @sent-by.';
+  if (module_exists('realname')) {
+    $description = 'The subject of the message sent to group admins whenever a user sends out a group invitation. Available variables: @group, @site, @description, !group_url, @body, @sent-to, @sent-to-realname, @sent-by, @sent-by-realname.';
+  }
   // Add a message template for notifying group admins of sent invitations
   $form['og_settings']['notifications']['og_invite_admin_subject'] = array(
     '#type' => 'textfield',
     '#title' => t('Group admin invite notification subject'),
-    '#description' => t('The subject of the message sent to group admins whenever a user sends out a group invitation. Available variables: @group, @site, @description, !group_url, @body, @sent-to, @sent-by.'),
+    '#description' => $description,
     '#default_value' => _og_invite_link_mail_text('og_invite_admin_subject'),
     '#weight' => 19,
   );
+  // Add Realname variable if available
+  $description = 'The body of the message sent to group admins whenever a user sends out a group invitation. Available variables: @group, @site, @description, !group_url, @body, @sent-to, @sent-by.';
+  if (module_exists('realname')) {
+    $description = 'The body of the message sent to group admins whenever a user sends out a group invitation. Available variables: @group, @site, @description, !group_url, @body, @sent-to, @sent-to-realname, @sent-by, @sent-by-realname.';
+  }
   $form['og_settings']['notifications']['og_invite_admin_body'] = array(
     '#type' => 'textarea',
     '#title' => t('Group admin invite notification body'),
-    '#description' => t('The body of the message sent to group admins whenever a user sends out a group invitation. Available variables: @group, @site, @description, !group_url, @body, @sent-to, @sent-by.'),
+    '#description' => t($description),
     '#default_value' => _og_invite_link_mail_text('og_invite_admin_body'),
     '#weight' => 20,
   );
   // Weigh the other invite widgets with these
   $form['og_settings']['notifications']['og_invite_user_subject']['#weight'] = 17;
   $form['og_settings']['notifications']['og_invite_user_body']['#weight'] = 18;
+  
+  // Add Realname variable if available
+  $description = t(', @sent-to, @sent-by.');
+  if (module_exists('realname')) {
+    $description = t(', @sent-to, @sent-to-realname, @sent-by, $sent-by-realname.');
+  }
   // Add additional variables
-  $form['og_settings']['notifications']['og_invite_user_subject']['#description'] .= t(', @sent-to, @sent-by.');
-  $form['og_settings']['notifications']['og_invite_user_body']['#description'] .= t(', @sent-to, @sent-by.');
+  $form['og_settings']['notifications']['og_invite_user_subject']['#description'] .= $description;
+  $form['og_settings']['notifications']['og_invite_user_body']['#description'] .= $description;
 }
 
 /**
@@ -326,6 +342,10 @@
         '@sent-by' => $sent_by->name,
         '!group_url' => $invite_url,
       );
+      // Add Realname variable if available
+      if (module_exists('realname')) {
+        $variables['@sent-by-realname'] = $sent_by->realname;
+        $variables['@sent-to-realname'] = $sent_to->realname;
+      }
 
       // Set the message subject and body
       $message['subject'] = _og_invite_link_mail_text('og_invite_user_subject', $variables, $message['language']);
@@ -795,5 +815,4 @@
         return t("A group member has sent out an invitation for the group, '@group'.\n\nSent to: @sent-to\nSent by: @sent-by\n\nAdditional message:\n@body", $variables, $langcode);
     }
   }
-}
-
+}
\ No newline at end of file
