diff options
author | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-03-12 23:21:44 +0000 |
---|---|---|
committer | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-03-12 23:21:44 +0000 |
commit | 210b27ec56ce6f5fffc14c89270865932638c779 (patch) | |
tree | cbf27ca702a0661506747a064d30570dace3cea1 | |
parent | 99175d2417bc5d3657cc3e548affe21eda76f648 (diff) | |
download | elgg-210b27ec56ce6f5fffc14c89270865932638c779.tar.gz elgg-210b27ec56ce6f5fffc14c89270865932638c779.tar.bz2 |
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
-rw-r--r-- | engine/classes/ElggUser.php | 13 | ||||
-rw-r--r-- | mod/custom_index/index.php | 4 | ||||
-rw-r--r-- | 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 "<div id=\"widget_friends_list\">"; - - foreach($friends as $friend) { - echo "<div class=\"widget_friends_singlefriend\" >"; - echo elgg_view_entity_icon(get_user($friend->guid), $size); - echo "</div>"; - } +$html = $owner->listFriends('', $num, array( + 'size' => $size, + 'gallery' => true, +)); +if ($html) { + echo $html; +} else { - echo "</div>"; } |