From 210b27ec56ce6f5fffc14c89270865932638c779 Mon Sep 17 00:00:00 2001 From: cash Date: Sat, 12 Mar 2011 23:21:44 +0000 Subject: Fixes #3045 custom index and the friends widget now use the gallery view for user icons git-svn-id: http://code.elgg.org/elgg/trunk@8677 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/classes/ElggUser.php | 13 ++++++++----- mod/custom_index/index.php | 4 ++++ views/default/widgets/friends/content.php | 22 +++++++--------------- 3 files changed, 19 insertions(+), 20 deletions(-) diff --git a/engine/classes/ElggUser.php b/engine/classes/ElggUser.php index cceaacf58..5c65a4d66 100644 --- a/engine/classes/ElggUser.php +++ b/engine/classes/ElggUser.php @@ -360,20 +360,23 @@ class ElggUser extends ElggEntity * * @param string $subtype Optionally, the user subtype (leave blank for all) * @param int $limit The number of users to retrieve - * @param int $offset Indexing offset, if any + * @param array $vars Display variables for the user view * - * @return string + * @return string Rendered list of friends + * @since 1.8.0 */ - function listFriends($subtype = "", $limit = 10, $offset = 0) { - $options = array( + function listFriends($subtype = "", $limit = 10, array $vars = array()) { + $defaults = array( 'type' => 'user', 'relationship' => 'friend', 'relationship_guid' => $this->guid, 'limit' => $limit, - 'offset' => $offset, + 'offset' => get_input('offset', 0), 'full_view' => false, ); + $options = array_merge($defaults, $vars); + if ($subtype) { $options['subtype'] = $subtype; } diff --git a/mod/custom_index/index.php b/mod/custom_index/index.php index 34a24ba38..94a1a16c6 100644 --- a/mod/custom_index/index.php +++ b/mod/custom_index/index.php @@ -33,6 +33,10 @@ $newest_members = elgg_list_entities_from_metadata(array( 'metadata_names' => 'icontime', 'types' => 'user', 'limit' => 10, + 'full_view' => false, + 'pagination' => false, + 'gallery' => true, + 'size' => 'small', )); //newest groups diff --git a/views/default/widgets/friends/content.php b/views/default/widgets/friends/content.php index f20f00194..7e3584b1e 100644 --- a/views/default/widgets/friends/content.php +++ b/views/default/widgets/friends/content.php @@ -18,20 +18,12 @@ $num = (int) $vars['entity']->num_display; // get the correct size $size = $vars['entity']->icon_size; -// Get the user's friends -if ($owner) { - $friends = $owner->getFriends("", $num); -} -// If there are any friends to view, view them -if (is_array($friends) && sizeof($friends) > 0) { - - echo "
"; - - foreach($friends as $friend) { - echo "
"; - echo elgg_view_entity_icon(get_user($friend->guid), $size); - echo "
"; - } +$html = $owner->listFriends('', $num, array( + 'size' => $size, + 'gallery' => true, +)); +if ($html) { + echo $html; +} else { - echo "
"; } -- cgit v1.2.3