Listing users based on group
I'm not finding real info on how to edit the page which is already there.
1. Browse to /yoursite/concrete/controllers
2. Copy the file members.php to /yoursite/controllers/ (so it's outside of the core concrete-folder)
3. Open the file for editing
4. Find the line that says:
$userList = new UserList();
5. Beneath it, add this:
$userList = new UserList(); $userList->filterByGroup('Your Group Name for Team Members');
Antti / Mainio
Once I copy the file out do I need to copy. It back? Or will the site just use that version?
Sent from my iPhone
Here's a bit more info about overriding:
So you basically have core folder (never touch files inside it!):
And ALL the same folders that lie in the concrete-folder one level up from there:
If you copy a file from /concrete/anyfolder/anyfile.php TO /anyfolder/anyfile.php, it is automatically overridden.
Antti / Mainio
How would I setup a custom display? would it be hard?
Could I make an html table for example. and drop in where I'd like avatar, name etc. and how would I get it to repeat.
Looking at that. could I have multiple lists on one page?
show group members from team a
show group members from group b
I love this software, need to buy a few books heh.
Again, override the view of the page, so copy this file:
And start forking it.
However, if you need the basic member page, you need to create a new single page to do that. Here's some more info about them:
As I will only have it display the registered members who are on team roster. I could create a single page.
Would just involve me copying the contents of members page to a single page and addig it yes?
Here's the look I was wanting for the member list.
the private options I am not to concerned about.
<table border="0" width="47%" cellspacing="0" cellpadding="0"> <tr> <td width="95" valign="top"> <table border="0" width="100%" cellspacing="1" height="101"> <tr> <td height="21"> <p align="center"><b><font face="Verdana" size="2">$Callsign</font></b></td> </tr> <tr> <td><font face="Verdana" size="2">$Avatar</font></td> </tr> </table> </td> <td width="213" valign="top"> <table border="0" width="100%" cellspacing="1">
How do I pull individual fields. i.e. $callsign and display it where I want? Than make that output display multiple times?
Thank you again for all the help!
- Yes, you can do this. Just follow the guide on how to add single pages.
What I got from your code you need these attributes from user:
You need one extra attribute for the users from Users and Groups => User Attributes. So, just add Text field: Callsign.
User avatar is already there, so nothing you need to do to enable that.
For getting the attributes:
// Assuming you have your User object stored in $user variable $info = UserInfo::getByID($user->getUserID()); // Get callsign $callsign = $info->getAttribute('callsign'); // This is how you can print out the avatar $av = Loader::helper('concrete/avatar'); $avatar = $av->outputUserAvatar($info);
Usually the classes themselves are quite descriptive if you just open the files that does the logic. If you're familiar with MVC coding, you can pretty much guess e.g. from which of these folders you want to look into if you're searching for the User object:
/controllers/ /elements/ /libraries/ /models/
If you don't know, I'll leave that for you as a homework to find out. :)
It took also for me a while to get into concrete5 before I started just searching the things I needed from the files themselves. There's no doubt that the documentation should be better but fortunately I've worked with real-life closed source systems that have had very little or none documentation.
However, I think it's the best way to learn these things is just to get your hands dirty and see what's under the hood.
> could I have multiple lists on one page?
My add-on allows for that.
A future release will, among other things, also allow filtering by user attribute and searching.
I had looked at your ad-on. Sadly we are a non profit. airsoft team. We already plan to drop 50 into the community forum addon. and may need to buy a paypal addon for taking group order payments.
Another 50 for displaying user data is not really within the budget.
Especially Since I'm aware of what I need to do. Basicly retrieve my attribute and display it into the proper location.
Just not sure how to accomplish this yet.
No worries. I do offer a non-profit discount, though, as stated on the add-on's page. If you're interested, just PM me.
As for displaying user attributes, once you have a UserInfo object, just...
$userinfo->getAttribute($ua, 'displaySanitized', 'display');
Check out the code in single_pages/profile/view.php. (The $ua variable is a user attribute key, an object representing a user attribute.)
In any event, good luck with it.
The first thing I actually did when I saw the question was to check for a block that would display the user data stuff. I've not used the user profiling fuctionality on almost any of the concrete5 sites I've done so I was a bit surprised to see that there isn't any block available in the core.
Some basic user profile & user list printing out block should be in the core itself IMO. Maybe I'll look into this issue at some point and create a free MIT licenced add-on for it...
I would like to do it myself but it's not something I'm super good at.
Keep looking/learning I guess :)