PDA

View Full Version : Is That Possible To Add Data Update Upon Payment


nyksjqi
06-05-2003, 05:54 PM
Hello, Alex

We need to add an extra column in both membmembers table and membproducts table. It's an additional feature of the product: "max_search". If user choose different product, they are given a different number of search.

Is that possible to add a function to update the max_search column upon successful payment?

Thank you.

alex-adm
06-06-2003, 02:00 PM
Here is example of code you requested:

file amember/site.inc.php (create if not exists):
<?

add_member_field('max_search', 'Max Search', 'text', '');
add_product_field('max_search', 'Max Search', 'text', '');

function ums($payment_id){
global $db;
$p = $db->get_payment($payment_id);
$c = 0;
foreach ($db->get_user_payments($p['member_id'], 1) as $p){
$pr = $db->get_product($p['product_id']);
$c += $pr['max_search'];
}
$u = $db->get_user($p['member_id']);
$u['data']['max_search'] = $c;
$db->update_user($u['member_id'], $u);
}

setup_plugin_hook('finish_waiting_payment', 'ums');

?>

something like that...

nyksjqi
06-10-2003, 09:15 PM
I'll try that. Alex, your support is premium.