Hi All,
Does anyone know how i can make it so that when a member is logged in they can edit there own members page that is displayed in a "members section" container page on the main site. would all need to be done in the front end and not in manager!
Cheers,
Sam
Hi Uncle68,
Thanks for that, I had found the members section on rtfm and have done some searching. What I’m stuck on isn’t creating the members section but what I want to do is make it so that each member has there own page on the website and so that they can change the information on that page! The members pages need to be on the main site but all in one container, also each member only wants to be able to edit there own page!
Does that make sense?
Cheers
With Login.Profile and Login.Updateprofile you could both display (any) user(s) specific data and also let the user edit (only) their own data. That together with the extended fields I think would be a pretty good solution for most cases.
There is also another snippet (don’t remember it’s name) that can show lists of users, perhaps those could be link to the specific users profile.
You could also perhaps use the extended fields for setting things like special css, chunk names or what ever that you would want to make specific for a user or users. That could of course be done in other ways too.
If I’m totally misunderstanding you, perhaps you could tell what would not work with the solution above.
All this is of course for Revolution, but for Evo there are similar solutions.
Does anyone know of the name of the snippet to display a list of all of your users and or user info? Can you use getResources?
Cheers
is there a way to sort search user extended field data - say for instance i have an extended field for users favourite color - is there a way to search for all the the users that favourite color is blue? - and if so what is the best way to approach this and where can i read up on how to achieve this?
thanks in advance.
Quote from: monsterwatt at Feb 16, 2011, 04:50 PM
is there a way to sort search user extended field data - say for instance i have an extended field for users favourite color - is there a way to search for all the the users that favourite color is blue? - and if so what is the best way to approach this and where can i read up on how to achieve this?
thanks in advance.
I assume you mean for Revolution. In that case this would be one way to do it (change zip to color):
<?php
$zip = '55147';
$zipUsers = array();
/* get all active users */
$users = $modx->getCollection('modUser',array('active' => '1'));
foreach ($users as $user) {
/* get the user's profile */
$profile = $user->getOne('Profile');
/* get the user's zip code */
$userZip = $profile->get('zip');
/* if the user has the zip code, add them to the array */
if ($userZip == $zip) {
$zipUsers[] = $user->get('username');
}
}
foreach($zipUsers as $zipUser) {
$output .= '<p>User: ' . $zipUser->get('username') . '</p>';
}
return $output;
There’s a more efficient way to do it, probably with getCollectionGraph(), and/or an innerJoin, but I’m too tired to work it out.
hi bob thanks, yes im using revolution.
ive tried to implement your code but cannot get it to work, i created the snippet MySearch and placed the code you provided in it and then called the snippet [[MySearch]] from within my resource but it’s not outputting anything.
What i would like to be able to do it have this running in conjuction with a form, with drop down menus so you can filter the users by the data they had already input to their profile in the extended fields, for example;
do you like cake? = y/n
do you like chips = y/n
do you like apples = y/n
i would like to have a form where i can search for users that like apples & chips but not cake...
Need to get learning PHP!
thanks, t.
Sorry, I forgot that your data is in an extended field. I think this would do it:
<?php
/* same code up to here */
$profile = $user->getOne('Profile');
$extendedFields = $profile->get('extended');
/* get the user's zip code */
$userZip = $extendedFields->get('zip');
/* same code after here */