diff --git a/domain_bonus_login_restrict/domain_bonus_login_restrict.module b/domain_bonus_login_restrict/domain_bonus_login_restrict.module
index af3e84e..173997b 100755
--- a/domain_bonus_login_restrict/domain_bonus_login_restrict.module
+++ b/domain_bonus_login_restrict/domain_bonus_login_restrict.module
@@ -71,7 +71,9 @@ function domain_bonus_login_restrict_user($op, &$edit, &$account, $category = NU
       if (!$user_domains[$_domain['domain_id']]) {
         // logout this user
         session_destroy();
-        module_invoke_all('user', 'logout', NULL, $user);
+        // Only variables can be passed by reference workaround.
+        $null = NULL;
+        user_module_invoke('logout', $null, $user);
         // Load the anonymous user
         $user = drupal_anonymous_user();
       }
