×
Kunena 5.1.15 Released (27 Oct 2019)

The Kunena team has announce the arrival of Kunena 5.1.15 [K 5.1.15] 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.1 and issues discovered during the development stages of K 5.1.

Question displaying aupoints in kunena login module

More
7 years 5 months ago #1 by michalis
kunena login module is awesome

displays avatar

link to pms, profile etc

I would to add the points total of users there to, my php is horrible though, anyone care to help me out?

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

More
7 years 5 months ago #2 by Matias
We are already doing it somewhere, just need to find the code.. It's probably either in profile template or view.
The following user(s) said Thank You: michalis

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

More
7 years 5 months ago #3 by michalis
thank you, I was trying to find it but couldnt

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

More
7 years 5 months ago #4 by michalis
is it this code that I have to put?

class KunenaProfileAlphaUserPoints extends KunenaProfile {
public function __construct() {
$aup = JPATH_SITE . '/components/com_alphauserpoints/helper.php';
if (! file_exists ( $aup ))
return;
require_once ($aup);
$this->priority = 60;
}

public function getUserListURL($action = '', $xhtml = true) {
$kunena_config = KunenaFactory::getConfig ();
$my = JFactory::getUser();
if ( $kunena_config->userlist_allowed == 1 && $my->id == 0 ) return false;
if (class_exists('AlphaUserPointsHelper') && method_exists ( 'AlphaUserPointsHelper', 'getAupUsersURL' ))
return AlphaUserPointsHelper::getAupUsersURL ();
else {
// For AUP 1.5.3 etc..
static $AUP_itemid = false;
if ($AUP_itemid === false) {
$db = JFactory::getDBO ();
$query = "SELECT id FROM #__menu WHERE `link`='index.php?option=com_alphauserpoints&view=users' AND `type`='component' AND `published`='1'";
$db->setQuery ( $query );
$AUP_itemid = intval ( $db->loadResult () );
}
return JRoute::_ ( 'index.php?option=com_alphauserpoints&view=users&Itemid=' . $AUP_itemid, $xhtml );
}
}

public function getProfileURL($user, $task = '', $xhtml = true) {
if ($user == 0)
return false;
$user = KunenaFactory::getUser ( $user );
$my = JFactory::getUser ();
if ($user === false)
return false;
$userid = $my->id != $user->userid ? '&userid=' . AlphaUserPointsHelper::getAnyUserReferreID ( $user->userid ) : '';
if (class_exists('AlphaUserPointsHelper') && method_exists ( 'AlphaUserPointsHelper', 'getItemidAupProfil' )) {
$AUP_itemid = AlphaUserPointsHelper::getItemidAupProfil ();
} else {
$db = JFactory::getDBO ();
$query = "SELECT id FROM #__menu WHERE link='index.php?option=com_alphauserpoints&view=account' AND type='component' AND published='1'";
$db->setQuery ( $query );
$AUP_itemid = intval ( $db->loadResult () );
}
return JRoute::_ ( 'index.php?option=com_alphauserpoints&view=account' . $userid . '&Itemid=' . $AUP_itemid, $xhtml );
}

public function getProfileView($PopUserCount = 0) {
$_db = &JFactory::getDBO ();
$_config = KunenaFactory::getConfig ();

$queryName = $_config->username ? "username" : "name";
if (! $PopUserCount)
$PopUserCount = $_config->popusercount;
$query = "SELECT a.profileviews AS hits, u.id AS user_id, u.{$queryName} AS user FROM #__alpha_userpoints AS a
INNER JOIN #__users AS u ON u.id = a.userid
WHERE a.profileviews>'0' ORDER BY a.profileviews DESC";
$_db->setQuery ( $query, 0, $PopUserCount );
$topAUPProfileView = $_db->loadObjectList ();
KunenaError::checkDatabaseError ();

return $topAUPProfileView;
}

public function showProfile($userid, &$msg_params) {
}
}

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

More
7 years 5 months ago - 7 years 5 months ago #5 by Matias
No, you just need to call this and echo the output:
$points = KunenaFactory::getActivityIntegration()->getUserPoints($this->profile->userid);

IMHO it returns NULL if integration isn't enabled.
Last edit: 7 years 5 months ago by Matias.

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

More
7 years 4 months ago - 7 years 4 months ago #6 by michalis
I would like to apologize for taking up your time with my questions and thank your for putting up with me

I am a novice web designer and I am doing my homework but obviously I am still a novice so I will have to ask one more question

you are right I added it and it did nothing, it needs to be intergrated, I have been trying for hours but nothing, what I did was take the code from the alphauserpoints module and add it to kunena module but still nothing, can you recognize my mistake?

in class.php I added
 
function getPoints(&$param) 
	{
 
		$db			      =& JFactory::getDBO();
 
		$points = 0;
 
		$user =& JFactory::getUser();  
		$userid = $user->id;  
 
		if ( $userid ) 
		{
 
			$query = "SELECT points"
				   . " FROM #__alpha_userpoints"
				   . " WHERE userid='".$userid."'"
				   ;
 
			$db->setQuery($query, 0, $count);
			$points = $db->loadResult();
 
		}
 
		return $points;
 
	}

in mod_kunenalogin.php I added
$points = ModKunenaLogin::getPoints($param);

and in horizontal.php I added
<?php 
 
					if ( $points ) 
{	
	$f = $param->get('format', 'h1');	
 
	echo "<p>".JText::_('AUP_MYPOINTS')."</p>";	
 
	echo "<h".$f.">".$points."</h".$f.">";
	}
 
					?>



but I still get nothing


I just realized this is a question I might need to post in aup forums so I'll head over there
Last edit: 7 years 4 months ago by michalis.

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

More
7 years 4 months ago #7 by Matias
AUP has API to do that. But our API should have also worked if you had AUP integration turned on in Kunena.

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

More
6 years 9 months ago #8 by sunnyjey

Matias wrote: No, you just need to call this and echo the output:

$points = KunenaFactory::getActivityIntegration()->getUserPoints($this->profile->userid);

IMHO it returns NULL if integration isn't enabled.


How do I override integration code to display points even when integration/plugin is not enabled ?

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