K2 deliver points to author for clicks

  • Topic Author
  • Visitor
  • Visitor
8 years 1 month ago #32415 by
Hi Adrien,

I cannot "upgrade" to AltaUserPoints at this moment, because I need the JFBConnect-Plugin, which only works with AlphaUserPoints so far. So I modified the "Spend Points To Read"-Plugin so that it works with AlphaUserPoints.

How do I modify this now, so that it gives points to the author? Points shall not come by the reader: meaning it should not cost to read an article but only reward the author.

Cheers,
Max

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

More
8 years 1 month ago #32416 by nordmograph
Actually a query may not be required to get the author user id.
Soemthing like
$row->author should do.

- Need help? Post the URL of the related page (eventualy as confidential info), it will help solve your issue faster.
- An error, notice or warning? report the exact message including the line number
- If you get a white page , enable error reporting and / or check your server error logs.

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

  • Topic Author
  • Visitor
  • Visitor
8 years 1 month ago #32417 by
Sorry, I didn't get what you meant. Can you please explain more detailled what to change in which file? That would be great. :-)
If this works you should create an official AUP bundle of it and sell it. ;-)

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

  • Topic Author
  • Visitor
  • Visitor
8 years 6 days ago #33132 by
Hi Adrien,

I'd like to set up that rule to allocate points to the author for every click on the K2 article.
I bought the spend points to read plugin.
Do you have an exact description how to modify that points are spent to the author for every read? Would be great!

Thanks, max

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

More
8 years 6 days ago #33138 by nordmograph
You can try this
Code:
<?php /** * @package Joomla.Plugin * @subpackage System.SpendPoints_ToRead * @copyright Copyright (C) 2010 - 2016 Nordmograph.com/extensions. All rights reserved. * @license GNU General Public License version 3 or later; see LICENSE.txt */ defined('_JEXEC') or die; class PlgSystemSpendpoints_Toread extends JPlugin { public function __construct(& $subject, $config) { parent::__construct($subject, $config); $this->loadLanguage(); } public function onBeforeRender() { if (JFactory::getApplication()->isAdmin()) return true; $pointsys = $this->params->get('pointsys','aup'); $contentsys = $this->params->get('contentsys','com_content'); $excludecatids = $this->params->get('excludecatids'); $onlycatids = $this->params->get('onlycatids'); $banned_cats = explode(',',$excludecatids); $prefered_cats = explode(',',$onlycatids); $jusergroups = $this->params->get('jusergroups'); $pointsperpage = $this->params->get('pointsperpage','1'); $nopoints_url = $this->params->get('nopoints_url','index.php'); $app = JFactory::getApplication(); $jinput = $app->input; $option = $jinput->getCmd('option'); $view = $jinput->getCmd('view'); $id_index = 'id'; if($contentsys =='com_content') $view_index= 'article'; elseif($contentsys =='com_easyblog') $view_index= 'entry'; elseif($contentsys =='com_k2') $view_index= 'item'; $id = $jinput->getInt( $id_index ); if($option != $contentsys || $view != $view_index || $id=='') return true; $db = JFactory::getDBO(); $q = "SELECT title, catid, created_by FROM #__k2_items WHERE id='".$id."' "; $db->setQuery($q); $article = $db->loadObject(); if($excludecatids!='' && in_array( $article->catid , $banned_cats) ) return true; if($onlycatids!='' && !in_array( $article->catid , $prefered_cats) ) return true; PlgSystemSpendpoints_Toread::RewardAuthor( $pointsperpage, $contentsys, $view, $id_index, $id, $article->title, $article->created_by); } static function RewardAuthor($pointsperpage,$contentsys,$view,$id_index,$id,$article_title, $author) { $app = JFactory::getApplication(); $user = JFactory::getUser(); $uri = JFactory::getURI(); $contenturl = $uri->toString(); $api_AUP = JPATH_SITE.'/components/com_altauserpoints/helper.php'; if ( file_exists($api_AUP)) { require_once $api_AUP; AltaUserPointsHelper::newpoints( 'plgaup_spendpoints_toread' , AltaUserPointsHelper::getAnyUserReferreID( $author ), '' , //$contentsys.'-'.$id sprintf( JText::_('PLG_SPTR_READPAGEID'), $contenturl, $article_title) , $pointsperpage ); } } }

- Need help? Post the URL of the related page (eventualy as confidential info), it will help solve your issue faster.
- An error, notice or warning? report the exact message including the line number
- If you get a white page , enable error reporting and / or check your server error logs.
The following user(s) said Thank You:

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

  • Topic Author
  • Visitor
  • Visitor
8 years 6 days ago #33149 by
hmmm...did not work - unfortunately....
do you think a rule like this should work in general?
Attachments:

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

Time to create page: 0.349 seconds
Powered by Kunena Forum
Disclaimer: Nordmograph is not affiliated with or endorsed by The Joomla! Project™. Any products and services provided through this site are not supported or warrantied by The Joomla! Project or Open Source Matters, Inc. Use of the Joomla!® name, symbol, logo and related trademarks is permitted under a limited license granted by Open Source Matters, Inc.