- Posts: 48
- Thank you received: 0
Kunena 6.3.6 Released - Security release
The Kunena team has announce the arrival of Kunena 6.3.6 [K 6.3.6] in stable which is now available for download as a native Joomla extension for J! 4.4.x/5.0.x/5.1.x. This version addresses most of the issues that were discovered in K 6.2 / K 6.3 and issues discovered during the last development stages of K 6.3
Note: Please go to the Kunena Dashboard after an upgrade so that the Kunena database tables are also updated.
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
10 years 8 months ago - 10 years 7 months ago #1
by thepiston
Jomsocial hack to show profile fields and gallery link was created 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
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
Code:
<?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='http://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: 10 years 7 months ago by thepiston.
Please Log in or Create an account to join the conversation.
10 years 8 months ago #2
by ChrisK
Replied by ChrisK on topic Jomsocial hack to show profile fields and gallery link
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
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.
10 years 8 months ago - 10 years 8 months ago #3
by thepiston
Replied by thepiston on topic Jomsocial hack to show profile fields and gallery link
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: 10 years 8 months ago by thepiston.
Please Log in or Create an account to join the conversation.
9 years 9 months ago #4
by xamire
Replied by xamire on topic Jomsocial hack to show profile fields and gallery link
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!
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.
Time to create page: 0.362 seconds