Custom Points/Rewards system

Discussion in 'Customization & add-ons' started by primitive_soul, May 7, 2013.

  1. primitive_soul

    primitive_soul New Member

    Joined:
    Oct 11, 2010
    Messages:
    14
    I'm trying to create a Points/Rewards system and have run into a snag. On my "rewards" page where you can purchase rewards with points (a modification of the credits module). I have created a seperate php script located in my public_html/private/ folder so it's not in the amember folder. This is my script:
    PHP:
    <?php
    include '../members/bootstrap.php';
    if (isset(
    $_POST["submit"])) {
    $name $_POST["nm"];
    $cost $_POST["cst"];
    $balance Am_Di::getInstance()->plugins_misc->loadGet('points')->balance();
    $xml simplexml_load_file('../members/rwds.xml');
    $avail;
    echo 
    "ok";
    $user Am_Di::getInstance()->authUser->getUser();
    echo 
    "not okay";
    foreach (
    $xml->reward as $reward){
    if(
    $reward['name'] == $name){
    $avail $reward->avail;
    }
    }
    if (
    $cost <= $balance){
    Am_Di::getInstance()->plugins_misc->loadGet('points')->debit($cost$name);
    $currentrewards $user->data()->get('rewards');
    $newlist $currentrewards.$name.",";
    $user->data()->set('rewards'$newlist)->update();
    header'Location: http://www.primitivesoultattoo.com/members/Artists-Page',TRUE,303 );
    }else{
    header'Location: http://www.primitivesoultattoo.com/members/Artists-Page',TRUE,303 );
    }
    }
    ?>
    I put a couple of echo statements in there and found it hangs up at
    I've tried to build this into my main rewards page but have concluded that keeping it separate and posting to it is probably best. I'm trying to debit the points system and update a custom field in the user record in which I'm storing a CSV list of their purchased rewards.

Share This Page