Notice

The forum is in read only mode.

Support Forum

Welcome! Support Forums have been reactivated
Welcome the Technical Support section. Help us in assisting you by providing us with a concise and descriptive elaboration of your issues. Be specific and if possible, provide us with a step-by-step instruction in replicating your problem.

getting access to the fields at pepole.browse

8 years 6 months ago
Licenses:
JomSocial Active

ISSUE SUMMARY:

I want extend the search result at people.browse.php, I want to display the country and the age of the user (the birthdayfield is configured for showing the age) - so I used the follwoing code:

<?php echo JText::_($row->user->getInfo('FIELD_COUNTRY')); ?> 
// result = COM_COMMUNITY_LANG_NAME_GERMANY -> expected = Germany

<?php echo JText::_($row->user->getInfo('FIELD_BIRTHDATE')); ?> 
// result = 1995-1-1 23:59:59 -> expected = 20

as result I get the raw database values, not translated or converted to the values shown at the profile page. I have seen there are Classes which can show the right value CFieldsCountry::getFieldData($field) and CFieldsBirthdate::getFieldData($field), can you provide an example how I can use this classes in a foreach-loop of $row->user ...

Thank you

wilderland





STEPS TO REPLICATE:
as described above

RESULT

raw database data

EXPECTED RESULT

correct values

BROWSER
does not matter

8 years 6 months ago
Licenses:

Hi,

please put this code before "foreach"

$lang = JFactory::getLanguage();
$lang->load( 'com_community.country',JPATH_ROOT);

$dateNow = new DateTime();

and here the fields
<?php 
    $dateBirth = new DateTime($row->user->getInfo('FIELD_BIRTHDATE'));
    $dateIntervall = $dateNow->diff($dateBirth);

    echo $dateIntervall->y;
?> 
<?php echo JText::_($row->user->getInfo('FIELD_COUNTRY')); ?> 

Regards

The following user(s) said Thank You: Sarah
Moderators: Piotr Garasiński
Powered by Kunena Forum

Join 180,000 websites creating Amazing communities

JomSocial is the most complete, easy-to-use addon that turns Joomla CMS into a
full -fledged, social networking site

TRY NOW BUY NOW