Example #1
0
/**
 * AccessPress Template Tags for displaying front-end content
 *
 * @package AccessPress
 */
function accesspress_checkout_form($args = array())
{
    $args = isset($_POST['accesspress-checkout']) ? $_POST['accesspress-checkout'] : $args;
    $form_submitted = isset($_POST['accesspress-checkout']) || isset($_REQUEST['action']);
    /** If form submitted */
    if ($form_submitted) {
        $checkout_complete = accesspress_checkout($args);
        /** If there was an error in the submission show the error to the user */
        if (is_wp_error($checkout_complete)) {
            printf('<div class="acp-error">%s</div>', $checkout_complete->get_error_message());
        } else {
            /** Show the comlpete message when the transaction is complete */
            if ($checkout_complete) {
                _e('Congratulations! Please check your email for account details.', 'premise');
            }
            /** don't show the checkout form */
            return;
        }
    }
    /** don't show the checkout form unless there is a product or checkout is in progress */
    $product_id = isset($_GET['product_id']) ? $_GET['product_id'] : '';
    if (!$form_submitted && !memberaccess_is_valid_product($product_id)) {
        return;
    }
    echo '<div class="premise-checkout-wrap"><form method="post" action="">';
    printf('<input type="hidden" name="accesspress-checkout[product_id]" value="%s" />', $product_id);
    if (isset($_GET['renew']) && 'true' == $_GET['renew']) {
        echo '<input type="hidden" name="accesspress-checkout[renew]" value="true" />';
    }
    accesspress_checkout_form_account($args);
    accesspress_checkout_form_choose_payment($args);
    accesspress_checkout_form_payment_cc($args);
    printf('<input type="submit" value="%s" class="input-submit" />', is_user_logged_in() ? __('Submit Order', 'premise') : __('Submit Order and Create My Account', 'premise'));
    echo '</form></div>';
}
Example #2
0
 public function optin_extra_fields($type = '')
 {
     global $premise_base, $post;
     $meta = $premise_base->get_premise_meta($post->ID);
     if (empty($meta['member-product'])) {
         return;
     }
     $args = array('heading_text' => false, 'label_separator' => '*', 'wrap_before' => '', 'wrap_after' => '', 'before_item' => '<li>', 'after_item' => '</li>', 'show_email_address' => empty($meta['member-merge-email']), 'show_first_name' => empty($meta['member-merge-first-name']), 'show_last_name' => empty($meta['member-merge-last-name']));
     accesspress_checkout_form_account($args);
     if (!empty($meta['member-product'])) {
         printf('<input type="hidden" name="premise-product-id" value="%d" />', $meta['member-product']);
         printf('<input type="hidden" name="premise-landing-id" value="%d" />', $post->ID);
         printf('<input type="hidden" name="premise-product-key" value="%s" />', wp_create_nonce('premise-product-key-' . $meta['member-product'] . '-' . $post->ID));
     }
 }
Example #3
0
function accesspress_profile_content($atts, $content = '')
{
    add_filter('comments_open', '__return_false');
    if (!is_user_logged_in()) {
        return sprintf(__('Please <a href="%s">Log in</a> to view your account.', 'premise'), memberaccess_login_redirect(get_permalink()));
    }
    $user = wp_get_current_user();
    $args = array('heading_text' => '', 'first-name' => $user->first_name, 'last-name' => $user->last_name, 'show_email_address' => false, 'show_username' => false, 'label_separator' => ':');
    ob_start();
    accesspress_checkout_form_account($args);
    return '<div class="premise-checkout-wrap">' . ob_get_clean() . '</div>';
}
Example #4
0
function accesspress_profile_content($atts, $content = '')
{
    global $post;
    add_filter('comments_open', '__return_false');
    $message = isset($_REQUEST['password-changed']) && $_REQUEST['password-changed'] == 'true' ? '<span class="premise-message">' . __('Password Changed.', 'premise') . '</span> ' : '';
    if (!is_user_logged_in()) {
        return $message . sprintf(__('Please <a href="%s">Log in</a> to view your account.', 'premise'), memberaccess_login_redirect(get_permalink()));
    }
    $user = wp_get_current_user();
    /** Get shortcode $atts */
    $atts = shortcode_atts(array('heading_text' => __('Your Account', 'premise'), 'show_email_address' => false, 'show_username' => false, 'label_separator' => ':'), $atts);
    /** Merge $atts with $args */
    $args = wp_parse_args($atts, array('account_box_heading' => $atts['heading_text'], 'first-name' => $user->first_name, 'last-name' => $user->last_name, 'disabled' => !isset($post->ID) || $post->ID != accesspress_get_option('member_page')));
    $submit = '';
    if (!$args['disabled']) {
        $submit = sprintf('<input type="submit" value="%s" class="input-submit" />', __('Update', 'premise'));
        $args['nonce_key'] = 'premise-member-profile-' . $user->ID;
    }
    ob_start();
    accesspress_checkout_form_account($args);
    return $message . '<form method="post"><div class="premise-checkout-wrap">' . ob_get_clean() . $submit . '</div></form>';
}