We would like to charge credits for ANY reply to a Dirty Dozen topic regardless of whether an avatar is used or not. We would like to charge two (2) credits per reply, but if they would like an avatar it will still cost them an additional four (4) credits.
to indicate the user that he has insufficient credits to make a post, we use the following code in the file :
/home/webmaster/public_html/mod/groups/actions/forums/addpost.php
[code]
/* ds start - 11.02.2010 -> to check for the user credits */
$avid = intval(get_input('cavid'));
$user = get_loggedin_user();
if($user["credits"] < $avCost)
{
register_error(elgg_echo("You have insufficient Credits to make a post. Please purchase Credits"),"errors");
forward("http://dirtdisser.com/mod/cubet_membership/upgradecredits.php");
}
else if($user["credits"] > $avCost)
{
if($avid > 0)
{
$avCost = $avCost * 6;
}
else
{
$avCost = $avCost * 2;
}
global $CONFIG;
mysql_connect($CONFIG->dbhost, $CONFIG->dbuser, $CONFIG->dbpass);
mysql_select_db($CONFIG->dbname);
$tbl_prefix = $CONFIG->dbprefix;
$tableName = $tbl_prefix."users_entity";
$newBalance = $user["credits"] - $avCost;
$updateCreditsQuery = "UPDATE $tableName SET credits = $newBalance WHERE guid = {$user["guid"]}";
$updateResult = mysql_query($updateCreditsQuery);
$msg = "Your New Credit Balance is : ".$newBalance;
system_message(elgg_echo($msg));
}
/* ds ends - 11.02.2010 */
[/code]
to indicate the user that he has insufficient credits to make a post, we use the following code in the file :
/home/webmaster/public_html/mod/groups/actions/forums/addpost.php
[code]
/* ds start - 11.02.2010 -> to check for the user credits */
$avid = intval(get_input('cavid'));
$user = get_loggedin_user();
if($user["credits"] < $avCost)
{
register_error(elgg_echo("You have insufficient Credits to make a post. Please purchase Credits"),"errors");
forward("http://dirtdisser.com/mod/cubet_membership/upgradecredits.php");
}
else if($user["credits"] > $avCost)
{
if($avid > 0)
{
$avCost = $avCost * 6;
}
else
{
$avCost = $avCost * 2;
}
global $CONFIG;
mysql_connect($CONFIG->dbhost, $CONFIG->dbuser, $CONFIG->dbpass);
mysql_select_db($CONFIG->dbname);
$tbl_prefix = $CONFIG->dbprefix;
$tableName = $tbl_prefix."users_entity";
$newBalance = $user["credits"] - $avCost;
$updateCreditsQuery = "UPDATE $tableName SET credits = $newBalance WHERE guid = {$user["guid"]}";
$updateResult = mysql_query($updateCreditsQuery);
$msg = "Your New Credit Balance is : ".$newBalance;
system_message(elgg_echo($msg));
}
/* ds ends - 11.02.2010 */
[/code]
Comments
Post a Comment