Kunena 5.2 Beta 1 Released (24 Sep 2020)

The Kunena team is thrilled to announce the first public beta release of Kunena 5.2, a native Joomla extension for Joomla 3.9. This is a development release and should be only be used for testing; this version is not recommended for live websites at this stage.

The purpose of this release is to encourage testing by downloading, installing and identifying any problems or shortcomings that people may discover. K 5.2.0 B1 is stable and we are aware that people will discover defects. We encourage you to use the forum to report defects, as soon as they are discovered, so that the development team can work through the problems before the release of K 5.1 as a stable product. Reporting defects does not mean that the problems can or will be fixed. The Kunena team is looking forward to hearing your feedback on how well we have achieved our design goals.

× Please note: The Kunena project team takes NO responsibility for maintaining nor supporting anything in this category.

Question Jomsocial hack to show profile fields and gallery link

6 years 7 months ago - 6 years 6 months ago #1 by thepiston
Thought I'd share this. You can adjust it for your needs.

It shows age in years, gender, link to gallery if it exists, etc.

I put this after line 56 in this file:
//get important Joomla data and connections
$authorid = $this->profile->userid;
$username = $this->profile->username;
$jspath = JPATH_BASE.DS.'components'.DS.'com_community';
$user =& CFactory::getUser($authorid);
// write profile fields you want to retrieve here, find the name of the field on Jomsocial profile field area
$country = $user->getInfo('FIELD_COUNTRY');
$haller = $user->getInfo('FIELD_HALLER');
$gender = $user->getInfo('FIELD_GENDER');
$date_of_birth = $user->getInfo('FIELD_BIRTHDATE');
$condition = $user->getInfo('contition');
$sx_status = $user->getInfo('sx_status');
//figure out age in years
$DateOfBirth      = strtotime($date_of_birth);
$DateDifference   = time() - $DateOfBirth;
$AgeInYears       = $DateDifference /(60*60*24*365);
$AgeInYears  = floor($AgeInYears);
//figure out if gallery exists, if photos are in gallery, and gallery set to public or members
//0=public, 20=members, 30=friends, 40=me only
$query = "SELECT a.`creator`
from `jos_community_photos_albums` a, `jos_community_photos` b
where a.`creator` = $authorid
and a.`permissions` IN (0, 20)
and a.`id` = b.`albumid`";
$db->setQuery( $query ); 
$gallery = $db->loadResult(); 
//show gender and age if available
if (isset($gender, $date_of_birth)) {
echo "$gender, $AgeInYears<br />";
//show link to gallery if there is one
if ($gallery) {
echo "<a href='https://www.YOUR.DOMAIN/my-photos/$authorid-$username'>My Gallery</a><br />";
//these last 2 are specific to my page, but you can do something similar with your custom fields
//show condition and status if they exist
if ((isset($condition, $sx_status)) && ($condition!= "None")) {
echo "$condition<br />$sx_status<br />";
//show haller if it exists
if ($haller) {
echo "Haller: $haller";
Last edit: 6 years 6 months ago by thepiston.

Please Log in or Create an account to join the conversation.

6 years 7 months ago #2 by ChrisK
I'm currently running Joomla 2.5 / JomSocial 3.1.x / Kunena 3.x

I have been trying to get JomSocial Custom Profile Fields to show up on Kunena templates for a while now.

I tried the code you provided, specifically focusing on the JomSocial Custom Profile Fields. Unfortunately though there seems to be an issue with the way the field values are generated, a problem with the Language File.

Instead of

Country: United States

I'm Getting


Just wondering if you might have an idea on how I can go about fixing this up.

Thanks a lot for posting this btw


Please Log in or Create an account to join the conversation.

6 years 7 months ago - 6 years 7 months ago #3 by thepiston
yep, did same ting for me so I canned Country field. I think there's a problem with Jomsocial. You can find a thread about it on their forum somewhere.
Last edit: 6 years 7 months ago by thepiston.

Please Log in or Create an account to join the conversation.

5 years 7 months ago #4 by xamire
Go to your language override and put this as your constant:


and then whatever you want that to say (Obviously United States) and then the language file will always have that!

Please Log in or Create an account to join the conversation.

  • Not Allowed: to create new topic.
  • Not Allowed: to reply.
  • Not Allowed: to edit your message.
Time to create page: 0.090 seconds