/** * * Give Show Purchase Form * * Renders the Donation Form, hooks are provided to add to the checkout form. * The default Purchase Form rendered displays a list of the enabled payment * gateways, a user registration form (if enable) and a credit card info form * if credit cards are enabled * * @since 1.0 * * @param int $form_id ID of the Give Form * * @global $give_options Array of all the Give options * @return string */ function give_show_purchase_form($form_id) { $payment_mode = give_get_chosen_gateway($form_id); if (!isset($form_id) && isset($_POST['give_form_id'])) { $form_id = $_POST['give_form_id']; } do_action('give_purchase_form_top'); if (give_can_checkout() && isset($form_id)) { do_action('give_purchase_form_before_register_login', $form_id); $show_register_form = apply_filters('give_show_register_form', get_post_meta($form_id, '_give_show_register_form', true)); if (($show_register_form === 'registration' || $show_register_form === 'both' && !isset($_GET['login'])) && !is_user_logged_in()) { ?> <div id="give_checkout_login_register"> <?php do_action('give_purchase_form_register_fields', $form_id); ?> </div> <?php } elseif (($show_register_form === 'login' || $show_register_form === 'both' && isset($_GET['login'])) && !is_user_logged_in()) { ?> <div id="give_checkout_login_register"> <?php do_action('give_purchase_form_login_fields', $form_id); ?> </div> <?php } ?> <?php if (!isset($_GET['login']) && is_user_logged_in() || !isset($show_register_form) || 'none' === $show_register_form) { do_action('give_purchase_form_after_user_info', $form_id); } do_action('give_purchase_form_before_cc_form', $form_id); // Load the credit card form and allow gateways to load their own if they wish if (has_action('give_' . $payment_mode . '_cc_form')) { do_action('give_' . $payment_mode . '_cc_form', $form_id); } else { do_action('give_cc_form', $form_id); } do_action('give_purchase_form_after_cc_form', $form_id); } else { // Can't checkout do_action('give_purchase_form_no_access'); } do_action('give_purchase_form_bottom'); }
/** * * Give Show Purchase Form * * Renders the Donation Form, hooks are provided to add to the checkout form. * The default Donation Form rendered displays a list of the enabled payment * gateways, a user registration form (if enable) and a credit card info form * if credit cards are enabled * * @since 1.0 * * @param int $form_id ID of the Give Form * * @return string */ function give_show_purchase_form($form_id) { $payment_mode = give_get_chosen_gateway($form_id); if (!isset($form_id) && isset($_POST['give_form_id'])) { $form_id = $_POST['give_form_id']; } do_action('give_purchase_form_top', $form_id); if (give_can_checkout() && isset($form_id)) { do_action('give_purchase_form_before_register_login', $form_id); do_action('give_purchase_form_register_login_fields', $form_id); do_action('give_purchase_form_before_cc_form', $form_id); // Load the credit card form and allow gateways to load their own if they wish if (has_action('give_' . $payment_mode . '_cc_form')) { do_action('give_' . $payment_mode . '_cc_form', $form_id); } else { do_action('give_cc_form', $form_id); } do_action('give_purchase_form_after_cc_form', $form_id); } else { // Can't checkout do_action('give_purchase_form_no_access', $form_id); } do_action('give_purchase_form_bottom', $form_id); }