diff --git a/linkchecker.module b/linkchecker.module
index dc88513..1efd737 100644
--- a/linkchecker.module
+++ b/linkchecker.module
@@ -642,28 +642,33 @@ function linkchecker_form_alter(&$form, &$form_state, $form_id) {
     // Catch the custom block add/configure form and add custom submit handler.
     case 'block_add_block_form':
       // Add custom submit handler to custom block add form.
-      $form['#submit'][] = 'linkchecker_block_custom_add_form_submit';
+      if (variable_get('linkchecker_scan_blocks', 0)) {
+        $form['#submit'][] = 'linkchecker_block_custom_add_form_submit';
+      }
       break;
 
     case 'block_admin_configure':
       // When displaying the form, show the broken links warning.
-      if (empty($form_state['input']) && is_numeric(arg(5))) {
-        // Show a message on custom block edit page if a link check failed once
-        // or more often.
-        $ignore_response_codes = preg_split('/(\r\n?|\n)/', variable_get('linkchecker_ignore_response_codes', "200\n206\n302\n304\n401\n403"));
-        $links = db_query('SELECT url, code, fail_count FROM {linkchecker_block_custom} lb INNER JOIN {linkchecker_link} ll ON lb.lid = ll.lid WHERE lb.bid = :bid AND ll.fail_count > :fail_count AND ll.status = :status AND ll.code NOT IN (:codes)', array(':bid' => arg(5), ':fail_count' => 0, ':status' => 1, ':codes' => $ignore_response_codes));
-        foreach ($links as $link) {
-          drupal_set_message(format_plural($link->fail_count, 'Link check of <a href="@url">@url</a> failed once (status code: @code).', 'Link check of <a href="@url">@url</a> failed @count times (status code: @code).', array('@url' => $link->url, '@code' => $link->code)), 'warning', FALSE);
+      if (variable_get('linkchecker_scan_blocks', 0)) {
+        if (empty($form_state['input']) && is_numeric(arg(5))) {
+          // Show a message on custom block edit page if a link check failed once
+          // or more often.
+          $ignore_response_codes = preg_split('/(\r\n?|\n)/', variable_get('linkchecker_ignore_response_codes', "200\n206\n302\n304\n401\n403"));
+          $links = db_query('SELECT url, code, fail_count FROM {linkchecker_block_custom} lb INNER JOIN {linkchecker_link} ll ON lb.lid = ll.lid WHERE lb.bid = :bid AND ll.fail_count > :fail_count AND ll.status = :status AND ll.code NOT IN (:codes)', array(':bid' => arg(5), ':fail_count' => 0, ':status' => 1, ':codes' => $ignore_response_codes));
+          foreach ($links as $link) {
+            drupal_set_message(format_plural($link->fail_count, 'Link check of <a href="@url">@url</a> failed once (status code: @code).', 'Link check of <a href="@url">@url</a> failed @count times (status code: @code).', array('@url' => $link->url, '@code' => $link->code)), 'warning', FALSE);
+          }
         }
+        // Add custom submit handler to custom block configuration form.
+        $form['#submit'][] = 'linkchecker_block_custom_configure_form_submit';
       }
-
-      // Add custom submit handler to custom block configuration form.
-      $form['#submit'][] = 'linkchecker_block_custom_configure_form_submit';
       break;
 
     case 'block_custom_block_delete':
       // Add custom submit handler to custom block delete form.
-      $form['#submit'][] = 'linkchecker_block_custom_delete_form_submit';
+      if (variable_get('linkchecker_scan_blocks', 0)) {
+        $form['#submit'][] = 'linkchecker_block_custom_delete_form_submit';
+      }
       break;
 
     case 'comment_form':
