Drupal 7 – Legal module error – Undefined index: legal_accept in legal_user_update()

If you meet the following error after login,
Notice: Undefined index: legal_accept in legal_user_update()…
 

The following patch should help.

diff --git a/legal.module b/legal.module
index 4707331..6de47e3 100644
--- a/legal.module
+++ b/legal.module
@@ -461,13 +461,18 @@ function legal_user_update(&$edit, $account, $category) {
   global $user;
   global $language;
 
+  // We only care about the account category.
+  if ($category != 'account') {
+    return;
+  }
+
   $conditions = legal_get_conditions($language->language);
   if (empty($conditions['conditions'])) {
     return;
   }
 
   // Record the accepted state before removing legal_accept from $edit.
-  $accepted = $edit['legal_accept'];
+  $accepted = isset($edit['legal_accept']) ? $edit['legal_accept'] : FALSE;
   $edit['legal_accept'] = NULL;
   $edit['conditions'] = NULL;

 

Reference:

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.