×
K5.1.1 is released (10 Jun 2018)

The Kunena team is pleased to announce Kunena 5.1.1 [K 5.1.1].
Please read the blog post for information:

× This is not a support forum for AlphaUserPoints or its related products. For AlphaUserPoints support you should visit AlphaPlug .

The information given in this category is intended to guide users who want to use AlphaUserPoints with Kunena and, mostly, was written by Kunena users. The information here is not necessarily accurate, up-to-date nor is it intended to replace the support given by the developers of AlphaUserPoints.

If you are having problems then, for your own benefit, it would save us all a lot of time if you would kindly post your configuration report when you ask for help from this forum. If you do not post your configuration report we will not ask you for it but you will probably not get your problem solved, either.

Solved Plugin

More
1 year 9 months ago - 1 year 9 months ago #1 by biinngkai
Plugin was created by biinngkai
Hello Community,
Sorry my English is verry Bad.

I have a Problem with Create a new Plugin,
<?php
 
// Check to ensure this file is included in Joomla!
defined( '_JEXEC' ) or die( 'Restricted access' );
 
 
$api_AUP = JPATH_SITE.DS.'components'.DS.'com_alphauserpoints'.DS.'helper.php'; 
if ( file_exists($api_AUP)) 
{  
	require_once ($api_AUP);
}	
jimport( 'joomla.plugin.plugin' );
 
class plgaup_treuepunkte extends JPlugin
{
 
	public static function treuepunkte( $referrerid='', $userid='' )	
	{
			$today = date("Y-m-d H:i:s");
 
			if ( !$referrerid && !$userid ) return;
 
			if ( $referrerid ) {
				$where = "aup.referreid='$referrerid'";		
			} elseif ( $userid ){		
				$where = "aup.userid='$userid'";
			}	
 
			$db	   = JFactory::getDBO();		
 
			$query = "SELECT aup.userid, aup.referreid, u.registerDate, k.posts FROM #__alpha_userpoints AS aup, #__users AS u, #__kunena_users AS k WHERE $where AND aup.userid=u.id And k.userid=u.id";
			$db->setQuery( $query );
			$userinfo = $db->loadObjectList();
			$userinfodate = array();
			foreach ($userinfo as $userrohdata)
			{
			$userposts = $userrohdata->posts;
 
			$userRegdate = $userrohdata->registerDate;		
				$date1 = date_create($userRegdate);
				$date2 = date_create($today);
				$diff = date_diff($date1,$date2);		
				$userRegJahre = $diff->format("%y");
				$userRegJMD = $diff->format("%yY-%mM-%dD");			
			}
			if ($userRegJahre >= 4 AND $userposts >= 400){
				  $points=4;
				  $keyreference= "Rang4";	
				}elseif ($userRegJahre >= 3 AND $userposts >= 300){
				  $points=3;
				  $keyreference= "Rang3";			  	
				}elseif ($userRegJahre >= 2 AND $userposts >= 200){
				  $points=2;
				  $keyreference= "Rang2";		  	
				}elseif ($userRegJahre >= 1 AND $userposts >= 100){
				  $points=1;
				  $keyreference= "Rang1";
				}
				 $points=0;
				 $keyreference= "Rang0";
	}
		AlphaUserPointsHelper::newpoints( 'plgaup_treuepunkte', '', $keyreference, '', $points);
}
?>
Last edit: 1 year 9 months ago by biinngkai.

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

More
1 year 9 months ago #2 by 810
Replied by 810 on topic Plugin
see the original kunena alphauserpoints plugin
The following user(s) said Thank You: biinngkai

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

More
1 year 9 months ago - 1 year 9 months ago #3 by biinngkai
Replied by biinngkai on topic Plugin
Thank you . Your tip has helped me.
 
<?php
 
// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted access');
jimport('joomla.plugin.plugin');
 
class plgUserplgaup_treuepunkte extends JPlugin
{
 
	public function onUserLogin($user, $options=array())
	{
		$app = JFactory::getApplication();
 
		$db	   = JFactory::getDBO();
 
		jimport('joomla.user.helper');
 
		$instance = new JUser();
		if($id = intval(JUserHelper::getUserId($user['username'])))  {
			$instance->load($id);
		}
 
		// *** Daily login rule available only on frontend ***
		if ( $instance->get('block') == 0 && $app->isSite() ) {
 
			require_once (JPATH_ROOT.DS.'components'.DS.'com_alphauserpoints'.DS.'helper.php');
			// start the user session for AlphaUserpoints
			AlphaUserPointsHelper::getReferreid( intval($instance->get('id')) );
 
			// load language component
			JPlugin::loadLanguage( 'plgaup_treuepunkte', JPATH_SITE );				
 
/*---------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------*/
		$today = date("Y-m-d H:i:s");
 
		$query = "SELECT aup.userid, aup.referreid, u.registerDate, k.posts 
		FROM #__alpha_userpoints AS aup, #__users AS u, #__kunena_users AS k 
		WHERE $id=aup.userid AND aup.userid=u.id And k.userid=u.id";
		$db->setQuery( $query );
		$userreginfo = $db->loadObjectList();
		$userinfodate = array();
		foreach ($userreginfo as $userrohdata){
			$userposts = $userrohdata->posts;
			$userRegdate = $userrohdata->registerDate;
			$referreid = $userrohdata->referreid;
 
			$date1 = date_create($userRegdate);
			$date2 = date_create($today);
			$diff = date_diff($date1,$date2);		
			$userRegJahre = $diff->format("%y");
			$userRegJMD = $diff->format("%yY-%mM-%dD");
		}		
		if ($userRegJahre >= 4 AND $userposts >= 400){ 
				$keyreference = "$referreid|min.4Y_400P";
				$points = 4;
				$datareference = JText::_('TREUE_POINTS_4');
				AlphaUserPointsHelper::userpoints( 'plgaup_treuepunkte','', 0, $keyreference, $datareference, $points );
			}elseif ($userRegJahre >= 3 AND $userposts >= 300){
				$keyreference = "$referreid|min.3Y_300P";
				$points = 3;
				$datareference = JText::_('TREUE_POINTS_3');
				AlphaUserPointsHelper::userpoints( 'plgaup_treuepunkte','', 0, $keyreference, $datareference, $points );				
			}elseif ($userRegJahre >= 2 AND $userposts >= 200){
				$keyreference = "$referreid|min.2Y_200P";
				$points = 2;
				$datareference = JText::_('TREUE_POINTS_2');	
				AlphaUserPointsHelper::userpoints( 'plgaup_treuepunkte','', 0, $keyreference, $datareference, $points );				
			}elseif ($userRegJahre >= 1 AND $userposts >= 100){
				$keyreference = "$referreid|min.1Y_100P";
				$points = 1;
				$datareference = JText::_('TREUE_POINTS_1');	
				AlphaUserPointsHelper::userpoints( 'plgaup_treuepunkte','', 0, $keyreference, $datareference, $points );
			}	
		return null;	
		}			
	}	
}
?>
Last edit: 1 year 9 months ago by biinngkai. Reason: Fehler berichtigt

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