How can I send a user back to the page that sent them to member.php after they have made payment? My site requires all users to sign up for a free member account then they purchase products as and when they need them. When a member requires a product I send them to member.php with the price group set to the product they want to purchase. Each product has a unique price group value. They make the purchase ok but aMember then sends them to a page with a 'Login' link that takes them back to member.php. I want to send the member back to the page that sent them to member.php in the first place so that they can do what it is that they've just paid for. Members can purchase multiple instances of a product and I count how many times that they have purchased by querying the amember_products table in the database. I use this to determine how many times the member can perform the action. If there is a better way to do this please let me know. Steve
You can do that with custom PHP code. For example, set PHP: session_start();$_SESSION['_amember_redirect_after_order'] = 'someurlwhich you know'; before sending customer to member.php then edit amember/thanks.php and instead of PHP: $t->display('thanks.html'); add PHP: if ($url = $_SESSION['_amember_redirect_after_order']){ header("Location: $url"); exit();} else { $t->display('thanks.html');}
Hi! This is the secondtime it is happening. I just thought of a problem i.e. a question to ask in this forum and found that someone had JUST asked before and Alex did already answer. This nice and funny that I did not even have to wait for 24 hours. Further, I just thought that it would be nice to capture URL by REMOTEHOST from Browser location, carry it forward and send back when finished. I do not know if this is possible. However, I think following could be possible: The redirect URL sub_routines are already in the scripts, like http://www.aMember.com/members/memb...ct_url=http://www.aMember.com/forum/index.php (the above will NOT work... This is just an example..) aMember is generally used for integration. So when an aMember session starts, the sending URL could be stored in the table and then when user finishes the function, he could be sent back... So there would be no need to write custom code mentioned above. Also there could be registered Product URLs that could be stored in the DB. If the incoming URL comes from one of the registered URL in the database, then aMember could be sensitive to that and send the user back to where he was or any other desired URL. Hence a URL Redirect table registry would be required...
draj, good suggestion! Unfortunately, not all browsers are sending Referrer URL, and not always peoples should be returning to the same page they came from. But we will keep this as nice option to implement.