ISSUE SUMMARY: Member list - adding of profile fields
I want to add some profile fields: e.g. FIELD_GENDER, FIELD_ABOUTME, FIELD_CITY ...
Where can I do this?
Many thanks in advance!
Hermann
Hi, Hermann.
Thank you for contacting us.
Please, read this :)
www.jomsocial.com/forum/profile-universa...tory-listings#166461
Thanks, I did, like you told me:
As described, I put the code;
<?php
// custom field FIELD_POSITION
$cuser = CFactory::getUser($row->user->id);
echo $cuser->getInfo('FIELD_GENDER');
?>
into the file:people.browse.php
The result is:
Anna
COM_COMMUNITY_MALE
1 Freund
What has gone wrong?
The changes were copied in the folder;
/components/com_community/templates/jomsocial/layouts/people.browse.php
because there was no folder to copy this into:
/templates/yoo_monday/html/com_community/layouts/people.browse.php
Thank you, Hermann
HI, Herman.
All is fine, just this particular field contain language constant - it's stored like that in DB :)
So in this case you'll need to wrap it with Joomla! "parsing command":
echo JText::_($cuser->getInfo('FIELD_GENDER'));
Wonderful! Thank you very much!
The result now is:
Sportpartner
Männlich Steiermark 1 Freund
better would be:
Sportpartner
Männlich
Steiermark
1 Freund
I wanted to insert the <br> and a "blank" into the code , but it doesnt work.
The Code now is;
<?php
// custom field FIELD_POSITION
$cuser = CFactory::getUser($row->user->id);
echo JText::_($cuser->getInfo('FIELD_GENDER'));
echo $cuser->getInfo('FIELD_STATE');
?>
On the demo site; demo.jomsocial.com
At the top of this site is a Log-in/sign in bar: is this a module or plugin?
Many thanks in advance.
Hi, Hermann.
You can't add just <br> into php code. If you want them in a list you need to add it like this:
echo JText::_($cuser->getInfo('FIELD_GENDER')) . '<br />';
echo $cuser->getInfo('FIELD_STATE') . '<br />';
Hi, I have a small question about this topic again:
I`ld like to insert the age of the members into the members list, but not the birthday.
I tried something like this:
echo $cuser->getInfo('FIELD_BIRTHDAY') . '<br />'; ==> shows birthday
echo $cuser->getInfo('FIELD_AGE') . '<br />'; ==> shows nothing
How can I do this?
Thank you very much! Hermann
HI, Hermann.
Please, edit your first post here and provide working backend credentials.
I need to see what FIELD_AGE is.
HI, Hermann.
You can't call fields that doesn't exist. :)
Age is calculated basing on birthdate... but this field contains date only.
So you'll need to call birthdate, change exit data into timestamp, then count difference between current date and birth date, change it into full years and display as number. You'll need few php commands to do that.
As much as I'd love to help, providong full solution here is beyond what we're able to do for customers.
Please, post on stackoverflow.com and ask how to turn date in age in php.
Hi, Hermann.
Yes, you may have different output from that filed, just use php date manipulation tags ;)
stackoverflow.com/questions/4529640/get-...m-specified-date-php
Thank you very much, I tried several codes, described at this link, but none worked, I think I made mistakes, because I dont understand it.
Please could you be so nice, and write me the correct code in the following one, I use now:
<?php
// custom field FIELD_POSITION
$cuser = CFactory::getUser($row->user->id);
echo JText::_($cuser->getInfo('FIELD_GENDER')) . '<br />';
echo JText::_($cuser->getInfo('FIELD_ACTIVITIES')) . '<br />';
echo $cuser->getInfo('FIELD_STATE') . '<br />';
?>
Many thanks in advance! Hermann
Hi, Hermann.
Your current code seems to be fine.
I'll prepare a snippet for date in spare time ;)