Index: wymeditor.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/wymeditor/wymeditor.module,v
retrieving revision 1.2.2.8
diff -u -r1.2.2.8 wymeditor.module
--- wymeditor.module	4 Apr 2007 22:15:38 -0000	1.2.2.8
+++ wymeditor.module	27 Apr 2007 18:50:22 -0000
@@ -11,15 +11,14 @@
  */
 function wymeditor_form_alter($form_id, &$form) {
   if(user_access(t('access WYMeditor'))) {
-	  $body_found = FALSE;
-		foreach (element_children($form) as $e) {
-		  // If we find the body textarea, we activate the editor.
-		  if(isset($form[$e]['body']) && $form[$e]['body']['#type'] == 'textarea') {
-        $body_found = TRUE;
-        break;
-      }
+
+		// If we find the body textarea, we activate the editor.
+		if(isset($form['body_filter']['body']) && $form['body_filter']['body']['#type'] == 'textarea') {
+      $body = &$form['body_filter']['body'];
+    } elseif (isset($form['body']) && $form['body']['#type'] == 'textarea') {
+      $body = &$form['body'];
     }
-		if($body_found) {
+		if($body) {
 			// Get the profile settings
       $wym_profiles = _wymeditor_get_profiles();
       $settings = unserialize($wym_profiles[0]['settings']);
@@ -49,11 +48,11 @@
 			$module_path = base_path() . $module_path;
 		
 			// Hide the Drupal's body textarea, set the onkeyup event
-			$form[$e]['body']['#attributes'] = array(
+			$body['#attributes'] = array(
         'onkeyup' => 'setHTML()',
         'style' => 'display: none',
        );
-       $form[$e]['body']['#resizable'] = FALSE ;
+      $body['#resizable'] = FALSE ;
 			
 			// Build the editor html code
 			// Add the onload event and  sets the dialogs'path of WYMeditor
@@ -172,7 +171,7 @@
 			$editor .= $settings['display_link'] == 'enabled' ? '<a href="#wymedit" onclick="wymToggleDisplay();">'.t('Display/Hide WYMeditor').'</a>' : '';
 			
 			// At last, add the editor html code to the form
-			$form[$e]['body']['#suffix'] = $editor;
+			$body['#suffix'] = $editor;
 			
 
 		}

