Hi, based on member_id and product_id i'd like to manually call the correct amember function to update the amember_payments table with the right information. how is this possible? p.s. i dont want to write a plugin if possible
Hello, You can do something like the following to add a new payment record. PHP: // // Example setting free payment for user. // // Assumes following variables already set. // // $member_id, $product_id, $receipt_id // $product = & get_product($product_id); $payment = array( 'member_id' => $member_id, 'product_id' => $product_id, 'begin_date' => $d = date('Y-m-d'), 'expire_date' => $product->get_expire($d), 'paysys_id' => 'free', 'receipt_id' => $receipt_id, 'amount' => 0.00, 'completed' => 1, ); // // Add payment record // $db->add_payment($payment); If you only want to update a payment record then you could do something like the following: PHP: // // Example updating payment record for user. // // Assumes following variables already set. // // $payment_id // // Fill in xyz with new values, or delete line if no new value needed. // $payment = array( 'product_id' => xyz, 'begin_date' => xyz, 'expire_date' => xyz, 'paysys_id' => xyz, 'receipt_id' => xyz, 'amount' => xyz, 'completed' => xyz, ); // // Update payment record // $db->update_payment($payment_id, $payment); I wrote a plugin that allows someone to configure an additional secondary product that is automatically added to a user when they purchase a primary product. For example if you wanted to give free access to forums or say helpdesk but only to registered users (i.e. the forums/helpdesk is in protected folder) then you can use this plugin so that it would automatically add a payment record (i.e. give them access to protected folder where forums/helpdesk is located) when they purchased a primary product. Basically it sortof automatically registers them for me. I call the plugin auto-product. It can also be used for levels. If you have say a basic membership, and a VIP membership, and someone purchases a VIP membership (i.e. costs more) you can automatically give them access to your basic membership subscription thru this plugin when they purchase the VIP membership. Then if there VIP membership expires they could still have access to the basic membership subscription (as long as it didn't expire also). Sortof like auto downgrade. Works best if the lower level product has lifetime or longer expirartion period than the VIP membership. The usefulness of plugin all depends on how you organize your content and price your products. I use it so that if anybody purchases a product from me that they will be automatically registered to gain access to my support areas which are protected. The forums/helpdesk are free to begin with. This just alleviates them from having to join first. Jimmy
Many thanks for that info.. it seems to be just what I'm after. I'm basically looking at writing my own interface for the DaoPAY EASYPin. so once the user inputs the correct pincode, i can update membership etc. This looks like it could be the missing link for me.
autoproduct plugin Jimmy, would you be willing to share your autoproduct plugin? I am very interested as I think it may help me with a current problem I'm struggling with. glassman