Index: avatar_selection.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/avatar_selection/avatar_selection.module,v
retrieving revision 1.1.2.22.2.51
diff -u -p -r1.1.2.22.2.51 avatar_selection.module
--- avatar_selection.module	4 Aug 2008 22:43:45 -0000	1.1.2.22.2.51
+++ avatar_selection.module	5 Aug 2008 00:29:13 -0000
@@ -428,14 +428,14 @@ function _avatar_selection_image_list($u
     if (variable_get('avatar_selection_distinctive_avatars', FALSE)) {
       // Organic groups enabled.
       if (module_exists("og") && !empty($user_og)) {
-        $total = db_result(db_query("SELECT count(*) FROM {avatar_selection} avs LEFT JOIN {users} u ON u.picture = concat('%s/', avs.avatar) LEFT JOIN {avatar_selection_roles} avsr ON avs.aid = avsr.aid LEFT JOIN {avatar_selection_og} avso ON avs.aid = avso.aid WHERE u.picture IS NOT NULL AND u.uid <> %d AND (avsr.rid IS NULL OR avsr.rid IN (". db_placeholders($user_roles) .")) AND (avso.ogid IS NULL OR avso.ogid IN (". db_placeholders($user_og) .")) ORDER BY avs.weight, avs.name, avatar", $dir, $user->uid, $user_roles, $user_og));
+        $total = db_result(db_query("SELECT count(*) FROM {avatar_selection} avs LEFT JOIN {users} u ON u.picture = concat('%s/', avs.avatar) LEFT JOIN {avatar_selection_roles} avsr ON avs.aid = avsr.aid LEFT JOIN {avatar_selection_og} avso ON avs.aid = avso.aid WHERE u.picture IS NULL AND (avsr.rid IS NULL OR avsr.rid IN (". db_placeholders($user_roles) .")) AND (avso.ogid IS NULL OR avso.ogid IN (". db_placeholders($user_og) .")) ORDER BY avs.weight, avs.name, avatar", $dir, $user_roles, $user_og));
         if ($count == 0) $count = $total;
-        $result = db_query_range("SELECT DISTINCT avatar, avs.name, avs.weight FROM {avatar_selection} avs LEFT JOIN {users} u ON u.picture = concat('%s/', avs.avatar) LEFT JOIN {avatar_selection_roles} avsr ON avs.aid = avsr.aid LEFT JOIN {avatar_selection_og} avso ON avs.aid = avso.aid WHERE u.picture IS NOT NULL AND u.uid <> %d AND (avsr.rid IS NULL OR avsr.rid IN (". db_placeholders($user_roles) .")) AND (avso.ogid IS NULL OR avso.ogid IN (". db_placeholders($user_og) .")) ORDER BY avs.weight, avs.name, avatar", $dir, $user->uid, $user_roles, $user_og, $from, $count);
+        $result = db_query_range("SELECT DISTINCT avatar, avs.name, avs.weight FROM {avatar_selection} avs LEFT JOIN {users} u ON u.picture = concat('%s/', avs.avatar) LEFT JOIN {avatar_selection_roles} avsr ON avs.aid = avsr.aid LEFT JOIN {avatar_selection_og} avso ON avs.aid = avso.aid WHERE u.picture IS NULL AND (avsr.rid IS NULL OR avsr.rid IN (". db_placeholders($user_roles) .")) AND (avso.ogid IS NULL OR avso.ogid IN (". db_placeholders($user_og) .")) ORDER BY avs.weight, avs.name, avatar", $dir, $user_roles, $user_og, $from, $count);
       }
       else {
-        $total = db_result(db_query("SELECT count(*) FROM {avatar_selection} avs LEFT JOIN {users} u ON u.picture = concat('%s/', avs.avatar) LEFT JOIN {avatar_selection_roles} avsr ON avs.aid = avsr.aid WHERE u.picture IS NOT NULL AND u.uid <> %d AND avsr.rid IS NULL OR avsr.rid IN (". db_placeholders($user_roles) .") ORDER BY avs.weight, avs.name, avatar", $dir, $user->uid, $user_roles));
+        $total = db_result(db_query("SELECT count(*) FROM {avatar_selection} avs LEFT JOIN {users} u ON u.picture = concat('%s/', avs.avatar) LEFT JOIN {avatar_selection_roles} avsr ON avs.aid = avsr.aid WHERE u.picture IS NULL AND avsr.rid IS NULL OR avsr.rid IN (". db_placeholders($user_roles) .") ORDER BY avs.weight, avs.name, avatar", $dir, $user_roles));
         if ($count == 0) $count = $total;
-        $result = db_query_range("SELECT DISTINCT avatar, avs.name, avs.weight FROM {avatar_selection} avs LEFT JOIN {users} u ON u.picture = concat('%s/', avs.avatar) LEFT JOIN {avatar_selection_roles} avsr ON avs.aid = avsr.aid WHERE u.picture IS NOT NULL AND u.uid <> %d AND avsr.rid IS NULL OR avsr.rid IN (". db_placeholders($user_roles) .") ORDER BY avs.weight, avs.name, avatar", $dir, $user->uid, $user_roles, $from, $count);
+        $result = db_query_range("SELECT DISTINCT avatar, avs.name, avs.weight FROM {avatar_selection} avs LEFT JOIN {users} u ON u.picture = concat('%s/', avs.avatar) LEFT JOIN {avatar_selection_roles} avsr ON avs.aid = avsr.aid WHERE u.picture IS NULL AND avsr.rid IS NULL OR avsr.rid IN (". db_placeholders($user_roles) .") ORDER BY avs.weight, avs.name, avatar", $dir, $user_roles, $from, $count);
       }
     }
 
