Index: avatar_selection.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/avatar_selection/avatar_selection.module,v retrieving revision 1.1.2.22.2.49 retrieving revision 1.1.2.22.2.51 diff -u -p -r1.1.2.22.2.49 -r1.1.2.22.2.51 --- avatar_selection.module 20 Jul 2008 14:38:18 -0000 1.1.2.22.2.49 +++ avatar_selection.module 4 Aug 2008 22:43:45 -0000 1.1.2.22.2.51 @@ -120,8 +120,8 @@ function avatar_selection_menu() { 'title' => 'Manage avatars', 'description' => 'Allows the user to modify or delete an avatar from a list.', 'file' => 'avatar_selection.admin.inc', - 'callback' => 'avatar_selection_roles_page', - 'callback arguments' => array('op' => 'og'), + 'page callback' => 'avatar_selection_roles_page', + 'page arguments' => array('op' => 'og'), 'access callback' => 'user_access', 'access arguments' => array('administer avatar selection'), ); @@ -427,7 +427,7 @@ function _avatar_selection_image_list($u // Distinct avatars are enabled. if (variable_get('avatar_selection_distinctive_avatars', FALSE)) { // Organic groups enabled. - if (module_exists("og")) { + 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)); 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); @@ -442,7 +442,7 @@ function _avatar_selection_image_list($u // Not root user, check permissions. elseif ($user->uid != 0) { // Organic groups enabled. - if (module_exists("og")) { + if (module_exists("og") && !empty($user_og)) { $total = db_result(db_query("SELECT count(*) FROM {avatar_selection} avs LEFT JOIN {avatar_selection_roles} avsr ON avs.aid = avsr.aid LEFT JOIN {avatar_selection_og} avso ON avs.aid = avso.aid WHERE (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 weight, name, avatar", $user_roles, $user_og)); if ($count == 0) $count = $total; $result = db_query_range("SELECT DISTINCT avatar, name, weight FROM {avatar_selection} avs LEFT JOIN {avatar_selection_roles} avsr ON avs.aid = avsr.aid LEFT JOIN {avatar_selection_og} avso ON avs.aid = avso.aid WHERE (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 weight, name, avatar", $user_roles, $user_og, $from, $count);