Index: campaignmonitor.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/campaignmonitor/campaignmonitor.install,v
retrieving revision 1.1.2.1
diff -u -r1.1.2.1 campaignmonitor.install
--- campaignmonitor.install	9 Oct 2008 11:17:45 -0000	1.1.2.1
+++ campaignmonitor.install	27 Mar 2009 17:08:36 -0000
@@ -10,6 +10,10 @@
   variable_del('campaignmonitor_api_key');
 	variable_del('campaignmonitor_pastcampaignurl');
   variable_del('campaignmonitor_connection_timeout');
+  variable_del('campaignmonitor_block_show_name');
+  variable_del('campaignmonitor_block_show_mail');
+  variable_del('campaignmonitor_block_show_unsub');
+  variable_del('campaignmonitor_block_show_alink');
 	
 	cache_clear_all('*', 'cache', TRUE);
   cache_clear_all('*', 'cache_filter', TRUE);
Index: campaignmonitor.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/campaignmonitor/campaignmonitor.module,v
retrieving revision 1.3.2.3.2.1
diff -u -r1.3.2.3.2.1 campaignmonitor.module
--- campaignmonitor.module	20 Dec 2008 06:01:03 -0000	1.3.2.3.2.1
+++ campaignmonitor.module	27 Mar 2009 17:07:33 -0000
@@ -90,22 +90,67 @@
     return $blocks;
   }
   else if ($op == 'configure' && $delta == 0) {
+    $form = array();
     /* $form['items'] = array(
       '#type' => 'select',
       '#title' => t('Number of items'),
       '#default_value' => variable_get('XXX_block_items', 0),
       '#options' => array('1', '2', '3'),
-    );
-    return $form;*/
+    ); /* */
+
+    $form['campaignmonitor'] = array(
+        '#type' => 'fieldset',
+        '#title' => t('Campaign Monitor'),    
+        '#description' => t('Select which fields should be visible in the block. These settings only affect logged in (authenticated) users.'),
+        '#collapsible' => TRUE,
+        '#collapsed' => FALSE,
+      );
+
+    $form['campaignmonitor']['show_name'] = array(
+        '#type' => 'checkbox',
+        '#title' => t('Name'),
+        '#default_value' => variable_get('campaignmonitor_block_show_name', TRUE),
+        );
+
+    $form['campaignmonitor']['show_mail'] = array(
+        '#type' => 'checkbox',
+        '#title' => t('Email address'),
+        '#default_value' => variable_get('campaignmonitor_block_show_mail', TRUE),
+        );
+
+    $form['campaignmonitor']['show_unsub'] = array(
+        '#type' => 'checkbox',
+        '#title' => t('Unsubscribe box'),
+        '#default_value' => variable_get('campaignmonitor_block_show_unsub', TRUE),
+        );
+
+    $form['campaignmonitor']['show_alink'] = array(
+        '#type' => 'checkbox',
+        '#title' => t('Archive link'),
+        '#default_value' => variable_get('campaignmonitor_block_show_alink', TRUE),
+        '#description' => t('If you enable the menu entry, you might want to disable this. This shows regardless of the sign in status.'),
+        );
+
+    return $form;
   }
   else if ($op == 'save' && $delta == 0) {
-    /* variable_set('XXX_block_items', $edit['items']);*/
+    variable_set('campaignmonitor_block_show_name', $edit['show_name']);
+    variable_set('campaignmonitor_block_show_mail', $edit['show_mail']);
+    variable_set('campaignmonitor_block_show_unsub', $edit['show_unsub']);
+    variable_set('campaignmonitor_block_show_alink', $edit['show_alink']);
   }
+
   else if ($op == 'view') {
     switch ($delta) {
       case 0:
-        $block = array('subject' => t('Join Newsletter'),
-          'content' => campaignmonitor_signup_block());
+        $show = variable_get('campaignmonitor_block_show_name', TRUE)
+          || variable_get('campaignmonitor_block_show_mail', TRUE)
+          || variable_get('campaignmonitor_block_show_unsub', TRUE)
+          || variable_get('campaignmonitor_block_show_alink', TRUE);
+        if ($show) {
+          $block = array('subject' => t('Join Newsletter'),
+            'content' => campaignmonitor_signup_block());
+        }
         break;
       /* case 1:
         $block = array('subject' => t('Title of block #2'),
@@ -206,9 +251,8 @@
 
 function campaignmonitor_signup_block() {
   global $user;
-  $content = '';
-	$content .= drupal_get_form('campaignmonitor_general_form');
-  if (user_access('access archive')) {
+	$content = drupal_get_form('campaignmonitor_general_form');
+  if (user_access('access archive') && variable_get('campaignmonitor_block_show_alink', TRUE)) {
     $content .= l('Newsletter Archive', 'newsletter_archive');
   }
   return $content;
@@ -261,7 +305,7 @@
   global $user;
   // Check if the profile module is installed. If it is, use the name element of the profile
 	if (module_exists("profile")) {
-  	profile_load_profile($user->uid);
+  	profile_load_profile($user);
 		$profile_name = $user->profile_name;
 	}
   // Replace api_key and list_id with your own details
@@ -284,14 +328,17 @@
 
 function campaignmonitor_general_form() {
   global $user;
+  $form = array();
 	$name = '';
 	$email = '';
 	$default = false;
-	
+  $show_name = variable_get('campaignmonitor_block_show_name', TRUE) && $user->uid;
+  $show_mail = variable_get('campaignmonitor_block_show_mail', TRUE) && $user->uid;
+  $show_unsub = variable_get('campaignmonitor_block_show_unsub', TRUE) && $user->uid;
+
 	// Check if the profile module is installed. If it is, use the name element of the profile
 	if (module_exists("profile")) {
-  	profile_load_profile($user->uid);
-		$name = $user->profile_name;
+  	profile_load_profile($user);
 	}
   if ($user->uid != 0) {
     $email = $user->mail;
@@ -305,34 +352,43 @@
     }
     else {
       $default = false;
-    }
-  
+    }  
+  }
+
+  if ($show_name) {
+    $form['name'] = array(
+      '#type'          => 'textfield',
+      '#title'         => t('Name'),
+      '#size'          => 20,
+      '#maxlength'     => 50,
+      '#required'      => TRUE,
+  		'#default_value' => $name,
+      );
+  }
+
+  if ($show_mail) {
+    $form['email'] = array(
+      '#type'          => 'textfield',
+      '#title'         => t('Email'),
+      '#size'          => 20,
+      '#maxlength'     => 100,
+      '#required'      => TRUE,
+  		'#default_value' => $email,
+      );
+  }
+
+  if ($show_unsub) {
+    $form['unsubscribe_newsletter'] = array(
+      '#type'          => 'checkbox',
+      '#title'         => t('Unsubscribe'),
+      '#default_value' => $default,
+      );
+  }
+
+  if (($show_name && $show_mail)) {
+    $form['submit'] = array('#type' => 'submit', '#value' => t('Submit'));
   }
-	
-  $form['name'] = array(
-    '#type'          => 'textfield',
-    '#title'         => t('Name'),
-    '#size'          => 20,
-    '#maxlength'     => 50,
-    '#required'      => TRUE,
-		'#default_value' => $name,
-  );
-  $form['email'] = array(
-    '#type'          => 'textfield',
-    '#title'         => t('Email'),
-    '#size'          => 20,
-    '#maxlength'     => 100,
-    '#required'      => TRUE,
-		'#default_value' => $email,
-  );
-  
-  $form['unsubscribe_newsletter'] = array(
-    '#type'          => 'checkbox',
-    '#title'         => t('Unsubscribe'),
-    '#default_value' => $default,
-  );
 
-  $form['submit'] = array('#type' => 'submit', '#value' => t('Submit'));
   return $form;
 }
 

