×
Kunena 5.2.6 released and Blue eagle 1.6.6 released (25 Jul 2021)

The Kunena team has announce the arrival of Kunena 5.2.6 [K 5.2.6] which is now available for download as a native Joomla extension for J! 3.9.x. This version addresses most of the issues that were discovered in K 5.2 and issues discovered during the development stages of K 5.2.6

Question Missing sex, age and place in the forum whit jomsocial

More
9 years 7 months ago #1 by fugle1984
Hello all.

I have searched a bit, but do not think I can find anything about my question.

But in my Kunena forum lacks all our users what sex they are and how old they are. Me as admin says it all, but not for our users?

We use Jomsocial 2.4 and Kunena forum 1.7.1. Some who know what they are due, as we have chosen in the backend under JomSocial Integration Options. Might be nice to get this to work. ;)

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

More
9 years 6 months ago #2 by Plugje
Hi,
I don't know if you already found a solution, but I used this to solve the problem. It's working with JomSocial 2.2.4 and Kunena 1.7.1.
The original code is coming from this side: www.jonijnm.es
It is in Spanish and Google translation left out some code, so I put my solution below.

Edit /administrator/components/com_kunena/libraries/integration/profile.php, search for:
public function getProfileView($PopUserCount=0) {}
Add before:
// JoniJnm InfoIntegration (S)
	public function getUserInfo($userid) {}

Edit /administrator/components/com_kunena/libraries/integration/jomsocial/profile.php, search for:
public function getProfileURL($userid, $task='', $xhtml = true)
Add before:
// JoniJnm InfoIntegration
	public function getUserInfo($userid) {
		static $users = array();
		if (!isset($users[$userid])) {
			$users[$userid] = new stdclass;
			$kunena_config =& KunenaFactory::getConfig();
			$kunena_db =& JFactory::getDBO();
			if ($kunena_config->ipi_personal_text == 'status') {
				$kunena_db->setQuery("SELECT status FROM #__community_users WHERE userid=".$userid);
				$users[$userid]->personalText = $kunena_db->loadResult();
			}
			$kunena_db->setQuery("SELECT v.field_id,f.fieldcode,v.value,f.options FROM #__community_fields_values AS v LEFT JOIN #__community_fields AS f ON f.id=v.field_id WHERE v.user_id = ".$userid);
			$datos = $kunena_db->loadObjectList();
			foreach ($datos as $dato) {
				if ($dato->fieldcode == $kunena_config->ipi_website) {
					$users[$userid]->websiteurl 	=	substr($dato->value, 0, 7) == "https://" ? substr($dato->value, 7) : $dato->value;
					$users[$userid]->websitename 	=	$dato->value;
				}
				elseif ($dato->fieldcode == $kunena_config->ipi_birthdate) {
					$users[$userid]->birthdate = explode(" ",$dato->value);
					$users[$userid]->birthdate = $users[$userid]->birthdate[0];
				}
 
				elseif ($dato->fieldcode == $kunena_config->ipi_location) {
					$users[$userid]->location = explode(" ",$dato->value);
					$users[$userid]->location = $users[$userid]->location[0];
				}
 
				elseif ($dato->fieldcode == $kunena_config->ipi_gender) {
					$users[$userid]->gender = array_search($dato->value, explode("\n", $dato->options));
					$users[$userid]->gender++;
				}
				elseif ($dato->fieldcode == $kunena_config->ipi_signature)
					$users[$userid]->signature 	=	$dato->value;
				elseif ($dato->fieldcode == $kunena_config->ipi_personal_text)
					$users[$userid]->personalText 	=	$dato->value;
				elseif ($dato->fieldcode == $kunena_config->ipi_facebook)
					$users[$userid]->FACEBOOK 	=	$dato->value;
			}
		}
		return $users[$userid];
	}
// Fin JoniJnm

Edit /administrator/components/com_kunena/libraries/integration/communitybuilder/profile.php, search for:
public function getUserListURL($action='')
Add before:
// JoniJnm InfoIntegration
	public function getUserInfo($userid) {
		static $users = array();
		if (!isset($users[$userid])) {
			$users[$userid] = new stdclass;
			$kunena_config =& KunenaFactory::getConfig();
			$kunena_db =& JFactory::getDBO();
			$kunena_db->setQuery("SELECT * FROM #__comprofiler WHERE user_id = ".$userid);
			$datos = $kunena_db->loadObject();
			$dato = $kunena_config->ipi_website;
			if (isset($datos->$dato)) {
				$users[$userid]->websiteurl = substr($datos->$dato, 0, 7) == "https://" ? substr($datos->$dato, 7) : $datos->$dato;
				$users[$userid]->websitename = $datos->$dato;
			}
			$dato = $kunena_config->ipi_birthdate;
			if (isset($datos->$dato))
				$users[$userid]->birthdate = $datos->$dato;
			$dato = $kunena_config->ipi_gender;
			if (isset($datos->$dato) && $datos->$dato) {
				$kunena_db->setQuery("SELECT v.fieldtitle FROM #__comprofiler_fields AS f LEFT JOIN #__comprofiler_field_values AS v ON v.fieldid=f.fieldid WHERE f.name='".$dato."' ORDER BY v.ordering");
				$list = $kunena_db->loadResultArray();
				$users[$userid]->gender = array_search($datos->$dato, $list);
				$users[$userid]->gender++;
			}
			$dato = $kunena_config->ipi_signature;
			if (isset($datos->$dato))
				$users[$userid]->signature = $datos->$dato;
			$dato = $kunena_config->ipi_personal_text;
			if (isset($datos->$dato))
				$users[$userid]->personalText = $datos->$dato;
			$dato = $kunena_config->ipi_facebook;
			if (isset($datos->$dato))
				$users[$userid]->FACEBOOK = $datos->$dato;
		}
		return $users[$userid];
	}
	// Fin JoniJnm

Edit /administrator/components/com_kunena/libraries/integration/alphauserpoints/profile.php, search for:
public function getUserListURL($action = '', $xhtml = true) {
Add before:
// JoniJnm InfoIntegration
	public function getUserInfo($userid) {
		static $users = array();
		if (!isset($users[$userid])) {
			$users[$userid] = new stdclass;
			$kunena_config =& KunenaFactory::getConfig();
			$kunena_db =& JFactory::getDBO();
			$kunena_db->setQuery("SELECT * FROM #__alpha_userpoints WHERE userid = ".$userid);
			$datos = $kunena_db->loadObject();
			$dato = $kunena_config->ipi_website;
			if (isset($datos->$dato)) {
				$users[$userid]->websiteurl = substr($datos->website, 0, 7) == "https://" ? substr($datos->website, 7) : $datos->website;
				$users[$userid]->websitename = $datos->website;
			}
			$users[$userid]->birthdate = $datos->birthdate;
			$users[$userid]->gender = $datos->gender;
			$users[$userid]->location = $datos->country;
			$users[$userid]->FACEBOOK = $datos->facebook;
			$users[$userid]->TWITTER = $datos->twitter;
			$users[$userid]->ICQ = $datos->icq;
			$users[$userid]->AIM = $datos->aim;
			$users[$userid]->YIM = $datos->yim;
			$users[$userid]->MSN = $datos->msn;
			$users[$userid]->SKYPE = $datos->skype;
			$users[$userid]->GTALK = $datos->gtalk;
		}
		return $users[$userid];
	}
// Fin JoniJnm

Edit /administrator/components/com_kunena/libraries/user.php, search for:
function save($updateOnly = false) {
Add before:
// JoniJnm InfoIntegration
	function addInfo($id) {
		$kunena_config =& KunenaFactory::getConfig();
		if ($id && $kunena_config->integration_profile_info) {
			static $integration;
			if (!isset($integration)) {
				$integration = $kunena_config->integration_profile;
				if ($integration == 'auto')
					$integration = KunenaIntegration::detectIntegration('profile', true);
			}
			$call = array("KunenaProfile".$integration, 'getUserInfo');
			if (is_callable($call)) {
				$info = call_user_func($call, $id);
				if (is_object($info)) {
					foreach ($info as $param=>$value) {
						if ($value) $this->$param = $value;
					}
				}
			}
		}
	}
// Fin JoniJnm

Edit /administrator/components/com_kunena/libraries/user.php, search for:
$this->setProperties ( $table->getProperties () );
Add after:
// JoniJnm InfoIntegration
		if ($this->_exists && JRequest::getCmd('func') == 'view') 
			$this->addInfo($id);
		// Fin JoniJnm
 

Edit /administrator/components/com_kunena/libraries/user.php, search for:
$instance->bind ( $user, true );
Add after:
// JoniJnm InfoIntegration
			if (JRequest::getCmd('func') == 'view') 
				$instance->addInfo($instance->userid);
		// Fin JoniJnm

Edit /administrator/components/com_kunena/admin.kunena.php, search for:
kimport('integration.integration');
Add before:
// JoniJnm InfoIntegration
	//New for 1.6: get user info from profile integrator
	$lists['integration_profile_info'] = JHTML::_('select.genericlist', $yesno, 'cfg_integration_profile_info', 'class="inputbox" size="1"', 'value', 'text', $kunena_config->integration_profile_info);
	// Fin JoniJnm

Edit /administrator/components/com_kunena/admin.kunena.html.php, search for:
<fieldset>
					<legend><?php echo JText::_('COM_KUNENA_AUP_ALPHAUSERPOINTS'); ?></legend>
Add before:
<fieldset>
					<legend><?php echo JText::_('COM_KUNENA_INTEGRATION_PROFILE_INFO'); ?></legend>
					<table cellpadding="4" cellspacing="0" border="0" width="100%" class="kadmin-adminform">
						<tr align="center" valign="middle">
							<td align="left" valign="top" width="25%"><?php echo JText::_('COM_KUNENA_IPI_ENEABE'); ?></td>
							<td align="left" valign="top" width="25%"><?php echo $lists ['integration_profile_info']; ?></td>
							<td align="left" valign="top"><?php echo JText::_('COM_KUNENA_IPI_ENEABE_DESC'); ?></td>
						</tr>
						<tr align="center" valign="middle">
							<td align="left" valign="top" width="25%"><?php echo JText::_('COM_KUNENA_IPI_PERSONAL_TEXT'); ?></td>
							<td align="left" valign="top" width="25%"><input type="text"
								name="cfg_ipi_personal_text"
								value="<?php echo kescape($kunena_config->ipi_personal_text); ?>" /></td>
							<td align="left" valign="top"><?php echo JText::_('COM_KUNENA_IPI_PERSONAL_TEXT_DESC'); ?></td>
						</tr>
						<tr align="center" valign="middle">
							<td align="left" valign="top" width="25%"><?php echo JText::_('COM_KUNENA_IPI_WEBSITE'); ?></td>
							<td align="left" valign="top" width="25%"><input type="text"
								name="cfg_ipi_website"
								value="<?php echo kescape($kunena_config->ipi_website); ?>" /></td>
							<td align="left" valign="top"><?php echo JText::_('COM_KUNENA_IPI_WEBSITE_DESC'); ?></td>
						</tr>
						<tr align="center" valign="middle">
							<td align="left" valign="top" width="25%"><?php echo JText::_('COM_KUNENA_IPI_BIRTHDATE'); ?></td>
							<td align="left" valign="top" width="25%"><input type="text"
								name="cfg_ipi_birthdate"
								value="<?php echo kescape($kunena_config->ipi_birthdate); ?>" /></td>
							<td align="left" valign="top"><?php echo JText::_('COM_KUNENA_IPI_BIRTHDATE_DESC'); ?></td>
						</tr>
 
						<tr align="center" valign="middle">
							<td align="left" valign="top" width="25%"><?php echo JText::_('COM_KUNENA_IPI_LOCATION'); ?></td>
							<td align="left" valign="top" width="25%"><input type="text"
								name="cfg_ipi_location"
								value="<?php echo kescape($kunena_config->ipi_location); ?>" /></td>
							<td align="left" valign="top"><?php echo JText::_('COM_KUNENA_IPI_LOCATION_DESC'); ?></td>
						</tr>
 
						<tr align="center" valign="middle">
							<td align="left" valign="top" width="25%"><?php echo JText::_('COM_KUNENA_IPI_GENDER'); ?></td>
							<td align="left" valign="top" width="25%"><input type="text"
								name="cfg_ipi_gender"
								value="<?php echo kescape($kunena_config->ipi_gender); ?>" /></td>
							<td align="left" valign="top"><?php echo JText::_('COM_KUNENA_IPI_GENDER_DESC'); ?></td>
						</tr>
						<tr align="center" valign="middle">
							<td align="left" valign="top" width="25%"><?php echo JText::_('COM_KUNENA_IPI_SIGNATURE'); ?></td>
							<td align="left" valign="top" width="25%"><input type="text"
								name="cfg_ipi_signature"
								value="<?php echo kescape($kunena_config->ipi_signature); ?>" /></td>
							<td align="left" valign="top"><?php echo JText::_('COM_KUNENA_IPI_SIGNATURE_DESC'); ?></td>
						</tr>
						<tr align="center" valign="middle">
							<td align="left" valign="top" width="25%"><?php echo JText::_('COM_KUNENA_IPI_FACEBOOK'); ?></td>
							<td align="left" valign="top" width="25%"><input type="text"
								name="cfg_ipi_facebook"
								value="<?php echo kescape($kunena_config->ipi_facebook); ?>" /></td>
							<td align="left" valign="top"><?php echo JText::_('COM_KUNENA_IPI_FACEBOOK_DESC'); ?></td>
						</tr>
					</table>
				</fieldset>

Edit /components/com_kunena/lib/kunena.config.class.php, search for:
public function __construct($userinfo = null) {
Add before:
// JoniJnm InfoIntegration
	//New for 1.6: get user info from profile integrator
	var $integration_profile_info = 0;
	var $ipi_personal_text = '';
	var $ipi_website = '';
	var $ipi_birthdate = '';
 
	var $ipi_location = '';
 
	var $ipi_gender = '';
	var $ipi_signature = '';
	var $ipi_facebook = '';
	// Fin JoniJnm
 

Edit /administrator/language/en-GB/en-GB.com_kunena.ini, add at the end:
; JoniJnm InfoIntegration
COM_KUNENA_INTEGRATION_PROFILE_INFO="Profile info"
COM_KUNENA_IPI_ENEABE="Eneable load info"
COM_KUNENA_IPI_ENEABE_DESC="With this feature you can load user's info from others componentes. You need set the 'Field Code' of the info if you use Community Builder or Jomsocial. With AlphaUserPoints is auto"
COM_KUNENA_IPI_PERSONAL_TEXT="Personal text"
COM_KUNENA_IPI_PERSONAL_TEXT_DESC="Default in Jomsocial: status"
COM_KUNENA_IPI_WEBSITE="Website"
COM_KUNENA_IPI_WEBSITE_DESC="Default in Jomsocial: FIELD_WEBSITE"
COM_KUNENA_IPI_BIRTHDATE="Birthdate"
COM_KUNENA_IPI_BIRTHDATE_DESC="Default in Jomsocial: FIELD_BIRTHDAY"
 
COM_KUNENA_IPI_LOCATION="Location"
COM_KUNENA_IPI_LOCATION_DESC="Default in Jomsocial: FIELD_CITY"
 
COM_KUNENA_IPI_GENDER="Gender"
COM_KUNENA_IPI_GENDER_DESC="Default in Jomsocial: FIELD_GENDER<br />In Community builder, the field type must be 'Radio buttons'"
COM_KUNENA_IPI_SIGNATURE="Signature"
COM_KUNENA_IPI_SIGNATURE_DESC="Default in Community Builder: forumsignature"
COM_KUNENA_IPI_FACEBOOK="Facebook"
COM_KUNENA_IPI_FACEBOOK_DESC=""
; Fin JoniJnm

Hope this help other people :)

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.297 seconds