Welcome, Guest
Username Password: Remember me

AUP Rule for YooTheme "Zoo" Component
(1 viewing) (1) Guest

TOPIC: AUP Rule for YooTheme "Zoo" Component

Re: AUP Rule for YooTheme "Zoo" Component 1 year, 4 months ago #17823

  • adithya11
  • OFFLINE
  • Fresh Boarder
  • Get Rich or Die Trying
  • Posts: 13
  • Points: 157
  • Karma: 3
Hello,

If you want to give points only when an item is published by moderator/admin then add the following lines in /administrator/components/com_zoo/controllers/item.php
Just before this line
$this->table->get($id)->setState($state, true);
(Around line 621)

if($state==1){
$userID = $this->table->get($id)->created_by;
$auplink = JRoute::_('index.php?option=com_zoo&task=item&item_id='.$id);
$auphref = '<a href="'.$auplink.'">'.$this->table->get($id)->name.'</a>';
$api_AUP = JPATH_SITE.DS.'components'.DS.'com_alphauserpoints'.DS.'helper.php';
if ( file_exists($api_AUP))
{
require_once ($api_AUP);
$aupid = AlphaUserPointsHelper::getAnyUserReferreID( $userID );
if ( $aupid )  AlphaUserPointsHelper::newpoints( 'plgaup_zoo', $aupid, $id, $auphref);
}
}


I think this should work in the table view in the admin backend but not when you select published and click save in the item edit view. But any way its one and the same. Hope this helps out.

Thanks and Cheers,
Adithya.S
The following user(s) said Thank You: modus

Re: AUP Rule for YooTheme "Zoo" Component 1 year, 4 months ago #17825

  • EWReport
  • OFFLINE
  • Fresh Boarder
  • Posts: 10
  • Points: 87
  • Karma: 0
Thats simply perfect. Thanks so much for your help with everything. Its almost setup perfectly now. Is there any ways I can attach rules to them? Reason I ask is I use the AUP awards system for my site and the only way to hand out awards for the Zoo action is to make it with a rule.

Re: AUP Rule for YooTheme "Zoo" Component 1 year, 4 months ago #17828

  • adithya11
  • OFFLINE
  • Fresh Boarder
  • Get Rich or Die Trying
  • Posts: 13
  • Points: 157
  • Karma: 3
I think I didn't get you. If you want to give different rules for deleting and publishing then just change the name of the plugin in the xml file attached in the first post and install it. Likewise change the name in the PHP code as well in the first parameter in the last line(plgaup_zoo) to whatever you want and configure the points in AUP interface. If you need any help please post a reply.

Thanks and Cheers,
Adithya.S

Re: AUP Rule for YooTheme "Zoo" Component 1 year, 4 months ago #17832

  • modus
  • OFFLINE
  • Fresh Boarder
  • Posts: 3
  • Points: 62
  • Karma: 0
Hello Adithya!
First, thanks for your interesting post dedicated to the Zoo. I would like to give points to user when reading a certain article of the Zoo-Blog or the CookBook. But I do not know where to insert the code. In addition, I want to give points when a user comments a blog article or cookbook. Please, could you suggest me any way?
Last Edit: 1 year, 4 months ago by modus.

Re: AUP Rule for YooTheme "Zoo" Component 1 year, 4 months ago #17834

  • adithya11
  • OFFLINE
  • Fresh Boarder
  • Get Rich or Die Trying
  • Posts: 13
  • Points: 157
  • Karma: 3
Hello Modus,
I didn't understand the term "certain article". Anyway, if you want to give points to user upon reading an item in any app you want just add the following lines of code in
/media/zoo/applications/blog/templates/default/item.php
At the bottom of the file after last </div>

<?php
$userid =& JFactory::getUser();
if($userid != 0){
$auplink = JRoute::_('index.php?option=com_zoo&task=item&item_id='.$this->item->id.'&Itemid='.JRequest::getInt('Itemid', 0));
$auphref = '<a href="'.$auplink.'">'.$this->item->name.'</a>';
$api_AUP = JPATH_SITE.DS.'components'.DS.'com_alphauserpoints'.DS.'helper.php';
if ( file_exists($api_AUP))
{
require_once ($api_AUP);
AlphaUserPointsHelper::newpoints( 'plgaup_zoo', '', $this->item->id, "Reading Item: ".$auphref);
}
               }
?>


To give points in a similar way in other apps also just change the app name in the path provided above and paste the same code at the end of the file. I think this should work(I haven't checked though). Do remember to change the name of the plugin. You can duplicate the one I attached in the first post or alternative add an extra parameter in the last line with suitable points as in my previous posts.

Now for the comments:
Open up /components/com_zoo/controllers/comment.php

After line $table->save($comment);

paste
$userid =& JFactory::getUser();
if($userid != 0){
$auplink = JRoute::_('index.php?option=com_zoo&task=item&item_id='.$item_id.'&Itemid='.JRequest::getInt('Itemid', 0));
$itemname = $this->app->table->item->get($item_id)->name;
$auphref = '<a href="'.$auplink.'">'.$itemname.'</a>';
$api_AUP = JPATH_SITE.DS.'components'.DS.'com_alphauserpoints'.DS.'helper.php';
if ( file_exists($api_AUP))
{
require_once ($api_AUP);
AlphaUserPointsHelper::newpoints( 'plgaup_zoo', '', '', "Commenting on item: ".$auphref);
}}


Here also be careful about the plugin name. Change it to whatever you want(be careful to install it first in AUP rules page) If you want to use the same plugin throughout zoo then just add an extra parameter in the last line on the number of points you want to award under the same plugin name.

I hope this helps.
Thanks and Cheers,
Adithya.S
The following user(s) said Thank You: modus

Re: AUP Rule for YooTheme "Zoo" Component 1 year, 4 months ago #17837

  • EWReport
  • OFFLINE
  • Fresh Boarder
  • Posts: 10
  • Points: 87
  • Karma: 0
very helpful.

Now that we have established how to give points in general. Is there a way to make a rule to give points based on the item type? For example, someone to post's an entire new movie, shouldn't get the same amount of points as someone who simply adds an actor. So the "Movie" type would give say 25pts and the "Actor" type would give say 10. Any way to do this?
Moderators: adroussel, dalekurt, migus, some1new
Time to create page: 0.52 seconds
Goto Top