Hey Guys,
I wrote my own custom index plugin to display my own html/php homepage. And I wanted to add an avatar listing on my index page but am having a little issue. Below is the snippet of code that appears in the body of my index page. It is code based on the <a href="http://community.elgg.org/pg/plugins/project/384692/developer/jdalsem/avatar-wall"> Avatar Wall</a> plugin that I modified. Would you be so kind as to give it a look and see why nothing appears. I did echo Count($users); and it was the correct number of users, so I am getting all the users, but do you know why don't they display when I echo them?
<?php
// Start engine from original plug, don't need it
/* require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); */
$users_max = 1000;
$onlyWithAvatar = "no";
if(empty($onlyWithAvatar) || $onlyWithAvatar == "no")
{$users = get_entities('user','',null,null,$users_max,0);}
else
{$users = get_entities_from_metadata('icontime', '', 'user', '', 0, $users_max);}
$wallIconSize = "small";
shuffle($users);
foreach($vars['users'] as $user){
echo "<a href='" . $user->getURL() . "'><img class='avatars' alt='" . $user->name . "' src='". $user->getIcon($vars['wallIconSize']) . "'></a>";
}
?>
Thanks for the help guys!
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by Raül Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.
Ok. I'll try with your recommandations tomorrow. It's the night here ;).
Thx for your helps.
So, I work on it but it's hard. I find that the user's default profile fields are called like "admin_defined_profile_1, admin_defined_profile_2, etc ...".
So the first step is to extract the user's avatar and his "admin_defined_profile_1" field.
Is it the good way ?
I don't see how to replace the '?'
@Stéphane Caillaud
You don't need to create something a new ;)
Just copy file views\default\user\default.php into your own theme/plugin and edit it.
See again at $metadata :
It's just return menu's items like banned/location etc by default viewing
You may to skip it.
About 'subtitle'..it's a text that you want to see on follow after user's avatar.
Examples:
Contruction
means a briefdescription from user' profile
And
means a status text from profile
etc
Ok. I'll work on it. I hope that this will lead.
Argh! I'm missing one or two concepts to understand how it works. I'm stuck and it's frustrating!
So I want to include a bloc with a special grid member in my new homepage. The bloc is called like this:
So I copy the "default.php" code in my "member.php" page. If I do it with no change an I display it: I have a blank page. I think it is normal but I can see why ... Could you tell me why?
I have a question: why not use the "members/index.php" page?
So I code two pages:
- one "member.php" page,
- one "grid.php" page.
Code of the "member.php" page:
Code of the "grid.php" page:
Is it the good way?
So I want to populate this code with the users's list:
@Stéphane Caillaud Do you like a headache ? :)
I said about copy views\default\user\default.php into your own theme/plugin BUT not about creating a new file.
Copy this file and put it like as:
This file is displays a user by default. Overriding it you can create your own view for user.
So, now you need make your own page for showing the users' list. By default, this is a file members/page/index.php.
Override it with your own page handler e.g.:
Now create the path with folders: pages/members
And put into 2 your own files: index.php and search.php
Copy them from default plugin members
File index.php is your own customizing viewing of members' list. Edit it and add your code.
I've created 2 example files for U try it:
default.php - http://z.wzm.me/?5b7ebe84962fa029#yQzLmztXIbhn2JA7ShLTk4ElAbKM86tlwUyohspAL3M=
index.php - http://z.wzm.me/?f46f922367866c55#T9y0P+39ypx/Eog3efqYnjNHV8K4tnfuOApOhi5uj5A=
Remember: you need CSS customizing also.
Best regards!
- Previous
- 1
- 2
- 3
- 4
- 5
- Next
You must log in to post replies.