×
Blue Eagle 1.5.2 Released (11 Dec 2018)

The Kunena team has announce the arrival of Kunena Blue Eagle 1.5.2 which is now available for download as a native Joomla extension for Kunena 5.1. This version addresses most of the issues that were discovered in K 1.5.1 and issues discovered during the development stages of K 1.5.2.

× 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

More
4 years 10 months ago - 4 years 8 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:
components/com_kunena/template/blue_eagle/html/topic/default_profile_vertical.php
<?php
 
//get important Joomla data and connections
$authorid = $this->profile->userid;
$username = $this->profile->username;
$jspath = JPATH_BASE.DS.'components'.DS.'com_community';
include_once($jspath.DS.'libraries'.DS.'core.php');
$user =& CFactory::getUser($authorid);
$db=JFactory::getDBO();
 
// 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: 4 years 8 months ago by thepiston.

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

More
4 years 9 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

Country: COM_COMMUNITY_LANG_NAME_UNITEDSTATES

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

Thanks a lot for posting this btw

~Chris

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

More
4 years 9 months ago - 4 years 9 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: 4 years 9 months ago by thepiston.

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

More
3 years 10 months ago #4 by xamire
Go to your language override and put this as your constant:

COM_COMMUNITY_LANG_NAME_UNITEDSTATES

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 add attachements.
  • Not Allowed: to edit your message.
Time to create page: 0.438 seconds