diff --git a/www/user_defs.php b/www/user_defs.php
index 4d31854ba03dc2b700facefb2181212db8559d37..453ca6aa3a43c5bc2d8bd9f238eb8914b82aad16 100644
--- a/www/user_defs.php
+++ b/www/user_defs.php
@@ -718,7 +718,7 @@ class User
 			 "left join group_membership as authed on ".
 			 "     g.pid_idx=authed.pid_idx and ".
 			 "     g.gid_idx=authed.gid_idx and ".
-			 "     g.uid_idx='$uid_idx' ".
+			 "     g.uid_idx='$this_idx' ".
 			 "where authed.uid_idx='$auth_idx' and ".
 			 "      (authed.trust='group_root' or ".
 			 "       authed.trust='project_root')");