$pages = get_pages(); if ($pages) { ?> <select id="edd-page" name="page"> <option><?php _e('Select page', 'edd-csr'); ?> </option> <?php foreach ($pages as $page) { ?> <option value="<?php echo $page->ID; ?> " <?php selected(edd_csr_get_redirect_page_id($redirect_id), $page->ID); ?> ><?php echo $page->post_title; ?> </option> <?php } ?> </select> <?php } ?> <p class="description"><?php
/** * Redirects customer to set page * * @since 1.0 * @param int $payment_id ID of payment */ function redirect($payment_id) { // get cart items from payment ID $cart_items = edd_get_payment_meta_cart_details($payment_id); // get the download ID from cart items array if ($cart_items) { foreach ($cart_items as $download) { $download_id = $download['id']; } } // return if more than one item exists in cart. The default purchase confirmation will be used if (count($cart_items) > 1) { return; } // check if the redirect is active if (edd_csr_is_redirect_active(edd_csr_get_redirect_id($download_id))) { // get redirect post ID from the download ID $redirect_id = edd_csr_get_redirect_id($download_id); // get the page ID from the redirect ID $redirect = edd_csr_get_redirect_page_id($redirect_id); // get the permalink from the redirect ID $redirect = get_permalink($redirect); $obj = new EDD_Conditional_Success_Redirects_Success_URI(); $obj->uri = $redirect; add_filter('edd_get_success_page_uri', array($obj, 'uri')); } }