Incentive plugin

15 years 11 months ago #62640 by TungstenX
Incentive plugin was created by TungstenX
Good day,

I have an idea that I would like to implement. The plug-in provides an incentive mechanism for a site's users. That is, a user gain points for, e.g., referring people to the site, uploading images, or posting on the message boards.

The plug-in will also show a ranking list.
These points might be exchanged for stuff. Or the web master / moderator(s) might have a draw at the end of a week / month / year, from the top x point holders for that period.

Any and all inputs are welcome

Please Log in to join the conversation.

15 years 11 months ago #62644 by Terp
Replied by Terp on topic Re:Incentive plugin
Great idea; sign me up! ;)

I thought I saw a plug-in that gave x amount of karma for each refer-a-friend sent, but that's about all I have seen along these lines.

Post edited by: Terp, at: 2008/05/09 17:05

Please Log in to join the conversation.

15 years 11 months ago #62761 by TungstenX
Replied by TungstenX on topic Re:Incentive plugin
Thank you. B)
I've done something like this for a web site but I hacked some of Joomla's code and tables. I would like to make a proper plugin for CB, this time :)

Please Log in to join the conversation.

15 years 11 months ago #62767 by TungstenX
Replied by TungstenX on topic Re:Incentive plugin
Do I just add my updates to my project here?

Please Log in to join the conversation.

15 years 11 months ago #63416 by TungstenX
Replied by TungstenX on topic Re:Incentive plugin
Good day,

I need some help concerning:
$_PLUGINS->registerFunction('onAfterUserRegistration'...

How do I know if this function gets called?

Please Log in to join the conversation.

15 years 11 months ago #63521 by TungstenX
Replied by TungstenX on topic Re:Incentive plugin
I don't find this learning curve nice. I may just have an off day today, but it seems that I can't get any thing to work or to understand.

So here goes; I've looked on the forum, in the doc and some code:
1. Why does my onAfterLogin not work? (See code snippet 1 below - the onUserActive works)
2. How do I do a form that will set my own values in the database (not using CB fields) - (See code snippet 2 below) - The question here is what should the name of the input field be?

Code snippet 1:
[code:1]$_PLUGINS->registerFunction('onUserActive', 'myUserActivated', 'getSugarCubesTab' );
$_PLUGINS->registerFunction('onAfterLogin', 'myAfterLogin', 'getSugarCubesTab' );

class getSugarCubesTab extends cbTabHandler
{
//--->8-- Snip --8<---
function myAfterLogin($user, $success)
{
//Not sure if all of these globals are needed
global $ueConfig, $mosConfig_absolute_path, $mosConfig_uniquemail, $database;
/**ReportToTest BEGIN**/
$str = "myAfterLogin";
$qa = "INSERT INTO `#__sugarcubes_test` VALUES(NULL,'";
$qa .= $str;
$qa .= "')";
$database->setQuery($qa);
$database->query();
/**ReportToTest END**/
}
//--->8-- Snip --8<---
}
[/code:1]

Code snippet 2 (Same file as above code snippet):
[code:1]
class getSugarCubesManagementTab extends cbTabHandler
{
//--->8-- Snip --8<---
function getDisplayTab($tab,$user,$ui)
{
global $my,$mainframe,$mosConfig_lang;
global $database;
//$this->_getLanguageFile();
//$tabparams=$this->_pgGetTabParameters($user);

$htmltext1 = "";
//if (!$tabparams["pgmanagementtabenabled"]) return $htmltext1;
// Is user a moderator?
$isModerator=isModerator($my->id);
if(!$isModerator) return $htmltext1;

$htmltext1 = "<H1>Edit points for:</H1>";
$base_url = $this->_getAbsURLwithParam(array());
//$pgitemtitle = $_POST[$this->_getPagingParamName("pgitemtitle"«»)];
$htmltext1 .= "<form action=\"$base_url\" method=\"GET\" >";
$htmltext1 .= "<TABLE BORDER=1><TR><TD><B>#</B></TD><TD><B>Point name</B></TD><TD><B>Description</B></TD><TD><B>Points per action</B></TD></TR>";
$q = "SELECT * from `#__sugarcubes_points_config`";
$database->setQuery($q);
$rs = $database->loadAssocList();
foreach($rs as $r)
{
$htmltext1 .= '<TR><TD>'. $r. '</TD><TD>' . $r . '</TD><TD>' . $r . '</TD><TD ALIGN=RIGHT><INPUT SIZE="5" TYPE="text" NAME="SUGARCUBEPOINTID_'. $r . '" VALUE="' . $r . '"></TD></TR>';
}
$htmltext1 .= "</TABLE>";
$htmltext1 .= "<input type=\"submit\" value=\"Update\" class=\"button\" />";
$htmltext1 .= "</form>";
return $htmltext1;
}
//--->8-- Snip --8<---
}
[/code:1]

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.274 seconds

Facebook Twitter LinkedIn