/** * Initialize AccessPress. * * Include the libraries, define global variables, instantiate the classes. * * @since 0.1.0 */ function accesspress_init() { global $memberaccess_products_object; define('MEMBER_ACCESS_SETTINGS_FIELD', 'member-access-settings'); /** Includes */ require_once PREMISE_MEMBER_INCLUDES_DIR . 'class-admin.php'; require_once PREMISE_MEMBER_INCLUDES_DIR . 'class-api.php'; require_once PREMISE_MEMBER_INCLUDES_DIR . 'class-products.php'; require_once PREMISE_MEMBER_INCLUDES_DIR . 'class-orders.php'; require_once PREMISE_MEMBER_INCLUDES_DIR . 'functions.php'; require_once PREMISE_MEMBER_INCLUDES_DIR . 'members.php'; require_once PREMISE_MEMBER_INCLUDES_DIR . 'admin/settings.php'; require_once PREMISE_MEMBER_INCLUDES_DIR . 'admin/link-manager.php'; require_once PREMISE_MEMBER_INCLUDES_DIR . 'admin/post-access-metabox.php'; require_once PREMISE_MEMBER_INCLUDES_DIR . 'admin/report.php'; require_once PREMISE_MEMBER_INCLUDES_DIR . 'views/template-tags.php'; require_once PREMISE_MEMBER_INCLUDES_DIR . 'views/shortcodes.php'; $memberaccess_products_object = new AccessPress_Products(); new AccessPress_Orders(); // for mailchimp as payment new AccessPress_Optin_Gateway(); // for recurring processing if (accesspress_get_option('authorize_net_recurring') == '1') { require_once PREMISE_LIB_DIR . 'cron/recurring-payments.php'; } // for vBulletin if (memberaccess_is_vbulletin_enabled()) { require_once PREMISE_MEMBER_INCLUDES_DIR . 'class-vbulletinbridge.php'; new Premise_vBulletin_Bridge(); } }
/** * Initialize the payment gateway. * * @since 0.1.0 */ public function configure() { $api_login = accesspress_get_option('authorize_net_id'); $transaction_key = accesspress_get_option('authorize_net_key'); // we need both an id & key to use the gateway if (empty($api_login) || empty($transaction_key)) { return false; } $this->_gateway_uri = 'https://' . ('1' == $this->mode('gateway_live_mode_authorize_net') ? 'api' : 'apitest') . '.authorize.net/xml/v1/request.api'; // $this->_gateway_mode = '<validationMode>' . ( '1' == accesspress_get_option( 'gateway_live_mode' ) ? 'live' : 'test' ) . 'Mode</validationMode>'; $this->_gateway_mode = '<validationMode>testMode</validationMode>'; $this->_merchant_login = sprintf('<merchantAuthentication><name>%s</name><transactionKey>%s</transactionKey></merchantAuthentication>', $api_login, $transaction_key); return true; }
function add_member_to_group($member, $order_details, $renewal) { if ($renewal || is_wp_error($member) || !$member) { return; } if (!empty($order_details['_acp_order_product_id'])) { $member_group = get_post_meta($order_details['_acp_order_product_id'], '_acp_product_vbulletin_group', true); } if (empty($member_group)) { $member_group = accesspress_get_option('vbulletin_group'); } if (!$member_group) { return; } $vb_user_id = get_user_meta($member, 'vbulletin_user_id', true); if (empty($vb_user_id)) { return; } // get the vBulletin user $vb_user_data = datamanager_init('User', $GLOBALS['vbulletin'], ERRTYPE_ARRAY); $user_info = fetch_userinfo($vb_user_id); $vb_user_data->set_existing($user_info); // check for existing user $vb_primary_group = $vb_user_data->fetch_field('usergroupid'); if (empty($vb_primary_group) || !is_numeric($vb_primary_group)) { $vb_user_data->set('usergroupid', $member_group); // user already has this primary group } elseif ($vb_primary_group == $member_group) { return; // add to secondary group } else { $secondary_groups = array($member_group); $groups = $vb_user_data->fetch_field('membergroupids'); if (!empty($groups)) { $secondary_groups = explode(',', $groups); if (in_array($member_group, $secondary_groups)) { return; } $secondary_groups[] = $member_group; sort($secondary_groups); } $vb_user_data->set('membergroupids', implode(',', $secondary_groups)); } $vb_user_data->pre_save(); if (empty($vb_user_data->errors)) { $vb_user_id = $vb_user_data->save(); } }
/** * Initialize the payment gateway. * * @since 0.1.0 */ public function configure() { $api_username = urlencode(trim(accesspress_get_option('paypal_express_username'))); $api_password = urlencode(trim(accesspress_get_option('paypal_express_password'))); $api_signature = urlencode(trim(accesspress_get_option('paypal_express_signature'))); // we need all three to use the gateway if (empty($api_username) || empty($api_password) || empty($api_signature)) { return false; } $api_server = '1' == $this->mode('gateway_live_mode_paypal') ? '' : '.sandbox'; $this->_gateway_uri = 'https://api-3t' . $api_server . '.paypal.com/nvp'; $this->_customer_uri = 'https://www' . $api_server . '.paypal.com/webscr&cmd=_express-checkout&token='; $this->_validation_uri = 'https://www' . $api_server . '.paypal.com/cgi-bin/webscr'; $this->_merchant_login = sprintf('&USER=%s&PWD=%s&SIGNATURE=%s', $api_username, $api_password, $api_signature); $this->_gateway_version = '&VERSION=' . urlencode('65.1'); return true; }
/** * Initialize AccessPress. * * Include the libraries, define global variables, instantiate the classes. * * @since 0.1.0 */ function memberaccess_init() { global $memberaccess_products_object; define('MEMBER_ACCESS_SETTINGS_FIELD', 'member-access-settings'); /** Includes */ require_once PREMISE_MEMBER_INCLUDES_DIR . 'class-api.php'; require_once PREMISE_MEMBER_INCLUDES_DIR . 'class-authorize-net.php'; require_once PREMISE_MEMBER_INCLUDES_DIR . 'class-express-checkout.php'; require_once PREMISE_MEMBER_INCLUDES_DIR . 'class-mailchimp-optin-gateway.php'; require_once PREMISE_MEMBER_INCLUDES_DIR . 'class-aweber-optin-gateway.php'; require_once PREMISE_MEMBER_INCLUDES_DIR . 'class-free-product.php'; require_once PREMISE_MEMBER_INCLUDES_DIR . 'class-products.php'; require_once PREMISE_MEMBER_INCLUDES_DIR . 'class-coupons.php'; require_once PREMISE_MEMBER_INCLUDES_DIR . 'class-orders.php'; require_once PREMISE_MEMBER_INCLUDES_DIR . 'class-link-manager.php'; require_once PREMISE_MEMBER_INCLUDES_DIR . 'functions.php'; require_once PREMISE_MEMBER_INCLUDES_DIR . 'members.php'; require_once PREMISE_MEMBER_INCLUDES_DIR . 'admin/settings.php'; require_once PREMISE_MEMBER_INCLUDES_DIR . 'admin/post-access-metabox.php'; if (is_admin()) { require_once PREMISE_MEMBER_INCLUDES_DIR . 'admin/report.php'; require_once PREMISE_MEMBER_INCLUDES_DIR . 'admin/user-management.php'; } require_once PREMISE_MEMBER_INCLUDES_DIR . 'views/template-tags.php'; require_once PREMISE_MEMBER_INCLUDES_DIR . 'views/shortcodes.php'; $memberaccess_products_object = new AccessPress_Products(); new MemberAccess_Coupons(); new AccessPress_Orders(); new Premise_Member_Access_Links(); // for recurring processing if (accesspress_get_option('authorize_net_recurring') == '1') { require_once PREMISE_LIB_DIR . 'cron/recurring-payments.php'; } // for vBulletin if (memberaccess_is_vbulletin_enabled()) { require_once PREMISE_MEMBER_INCLUDES_DIR . 'class-vbulletinbridge.php'; new Premise_vBulletin_Bridge(); } do_action('memberaccess_setup'); }
function premise_recurring_payment_notification($message) { // bundle the message into an email $email_from = memberaccess_get_email_receipt_address(); $from_description = accesspress_get_option('email_receipt_name'); $email_subject = sprintf(__('Premise scheduled payment settlement (%s)', 'premise'), date(get_option('date_format'), time())); wp_mail($email_from, $email_subject, $message, "From: \"{$from_description}\" <{$email_from}>"); die; }
function admin_page() { global $wpdb; $args = $this->parse_args(); ?> <div class="wrap"> <form method="post" action="<?php menu_page_url('premise-reports'); ?> "> <?php wp_nonce_field($this->settings_field); screen_icon($this->settings_field); ?> <h2> <?php echo esc_html(get_admin_page_title()); submit_button(__('Submit', 'premise'), 'button-primary accesspress-h2-button', 'premise-report[submit]', false); submit_button(__('Download', 'premise'), 'button-primary accesspress-h2-button', 'premise-report[export]', false); ?> </h2> <div class="premise-date-range"> <label for="premise-report[start]"><?php _e('Start Date:', 'premise'); ?> </label> <input type="text" name="premise-report[start]" id="premise-report[start]" value="<?php echo esc_attr($args['start']); ?> " /> <br /> <label for="premise-report[end]"><?php _e('End Date:', 'premise'); ?> </label> <input type="text" name="premise-report[end]" id="premise-report[end]" value="<?php echo esc_attr($args['end']); ?> " /> <script type="text/javascript"> //<!-- jQuery(document).ready(function(){ jQuery('#premise-report\\[start\\], #premise-report\\[end\\]').datepicker(); }); //--> </script> <?php if (accesspress_get_option('authorize_net_recurring')) { ?> <br /><br /> <strong><?php _e('Report', 'premise'); ?> :</strong> <br /> <label for="premise-report-type"><?php _e('Select Report:', 'premise'); ?> </label> <select name="premise-report[type]" id="premise-report-type"> <?php foreach (array('sales' => __('Sales', 'premise'), 'subscription' => __('Subscription Renewals', 'premise')) as $type => $desc) { printf('<option value="%s" %s>%s</option>', $type, selected($type, $args['type'], false), $desc); } ?> </select> <?php } else { echo '<input type="hidden" name="premise-report[type]" value="sales" />'; } ?> <br /><br /> <strong><?php _e('Product', 'premise'); ?> :</strong> <?php $product_query = new WP_Query(array('post_type' => 'acp-products', 'post_status' => 'publish', 'posts_per_page' => -1)); if ($product_query->have_posts()) { ?> <br /> <label for="premise-report[product]"><?php _e('Select Product:', 'premise'); ?> </label> <select name="premise-report[product]" id="premise-report[product]"> <option value=""><?php _e('-- Product --', 'premise'); ?> </option> <?php while ($product_query->have_posts()) { $product_query->the_post(); $title = get_the_title(); if (empty($title)) { continue; } printf('<option value="%d" %s>%s</option>', get_the_ID(), selected(get_the_ID(), $args['product'], false), $title); } wp_reset_query(); ?> </select> <?php } ?> <br /> <?php $coupon_query = new WP_Query(array('post_type' => 'acp-coupons', 'post_status' => 'publish', 'posts_per_page' => -1)); if ($coupon_query->have_posts()) { ?> <br /> <strong><?php _e('Coupon', 'premise'); ?> :</strong> <br /> <label for="premise-report[coupon]"><?php _e('Select Coupon:', 'premise'); ?> </label> <select name="premise-report[coupon]" id="premise-report[coupon]"> <option value=""><?php _e('-- Coupon --', 'premise'); ?> </option> <?php while ($coupon_query->have_posts()) { $coupon_query->the_post(); $title = get_the_title(); if (empty($title)) { continue; } printf('<option value="%d" %s>%s</option>', get_the_ID(), selected(get_the_ID(), $args['coupon'], false), $title); } wp_reset_query(); ?> </select> <?php } ?> </div> </form> <hr /> <?php if (!empty($_POST) && wp_verify_nonce($_POST['_wpnonce'], $this->settings_field)) { $end_date_ts = strtotime($args['end']) + 86400; $start_date_ts = strtotime($args['start']); $end_date = date('Y-m-d', $end_date_ts); $start_date = date('Y-m-d', $start_date_ts); if ($args['type'] == 'subscription') { $order_rows = $this->build_renewal_table($start_date_ts, $end_date_ts, $args['product'], $args['coupon'], false); } else { $order_rows = $this->build_order_table($start_date, $end_date, $args['product'], $args['coupon'], false); } echo '<table class="premise-report-table">'; if (!empty($order_rows)) { $alt = 0; foreach ($order_rows as $key => $order) { $class = ''; if (!is_numeric($key)) { $class = 'class="total"'; } else { if ($alt % 2) { $class = 'class="alt"'; } $title = array_shift($order); array_unshift($order, sprintf('<a href="%s">%s</a>', add_query_arg(array('post' => $key, 'action' => 'edit'), admin_url('post.php')), $title)); } printf('<tr %s><td>%s</td><tr>', $class, implode('</td><td>', $order)); $alt++; } } else { printf('<tr><td>%s</td></tr>', __('No Orders matched the criteria.', 'premise')); } echo '</table>'; } ?> </div> <?php }
function admin_page() { global $wpdb; $args = empty($_POST) ? array() : $_POST['premise-report']; $default_end = time(); $default_start = $default_end - 86400 * 7; $args = wp_parse_args($args, array('start-day' => date('j', $default_start), 'start-month' => date('n', $default_start), 'start-year' => date('Y', $default_start), 'end-day' => date('j', $default_end), 'end-month' => date('n', $default_end), 'end-year' => date('Y', $default_end), 'type' => 'sales')); ?> <div class="wrap"> <form method="post" action="<?php menu_page_url('premise-reports'); ?> "> <?php wp_nonce_field($this->settings_field); screen_icon($this->settings_field); ?> <h2> <?php echo esc_html(get_admin_page_title()); submit_button(__('Submit', 'premise'), 'button-primary accesspress-h2-button', 'submit', false); ?> </h2> <div class="premise-date-range"> <label for="premise-report-start-day"><?php _e('Start Date:', 'premise'); ?> </label> <input type="text" name="premise-report[start-day]" id="premise-report-start-day" size="2" value="<?php echo $args['start-day']; ?> " /> <select name="premise-report[start-month]" id="premise-report-start-month"> <?php foreach (range(1, 12) as $month) { printf('<option value="%d" %s>%d</option>', $month, selected($month, $args['start-month'], false), $month); } ?> </select> <select name="premise-report[start-year]" id="premise-report-start-year"> <?php $thisyear = (int) date('Y'); foreach (range($args['start-year'] - 2, $args['end-year']) as $year) { printf('<option value="%d" %s>%d</option>', $year, selected($year, $args['start-year'], false), $year); } ?> </select> <br /> <label for="premise-report-end-day"><?php _e('End Date:', 'premise'); ?> </label> <input type="text" name="premise-report[end-day]" id="premise-report-end-day" size="2" value="<?php echo $args['end-day']; ?> " /> <select name="premise-report[end-month]" id="premise-report-end-month"> <?php foreach (range(1, 12) as $month) { printf('<option value="%d" %s>%d</option>', $month, selected($month, $args['end-month'], false), $month); } ?> </select> <select name="premise-report[end-year]" id="premise-report-end-year"> <?php $thisyear = (int) date('Y'); foreach (range($args['start-year'] - 2, $args['end-year']) as $year) { printf('<option value="%d" %s>%d</option>', $year, selected($year, $args['end-year'], false), $year); } ?> </select> <?php if (accesspress_get_option('authorize_net_recurring')) { ?> <br /><br /> <label for="premise-report-type"><?php _e('Select Report:', 'premise'); ?> </label> <select name="premise-report[type]" id="premise-report-type"> <?php foreach (array('sales' => __('Sales', 'premise'), 'subscription' => __('Subscription Renewals', 'premise')) as $type => $desc) { printf('<option value="%s" %s>%s</option>', $type, selected($type, $args['type'], false), $desc); } ?> </select> <?php } else { echo '<input type="hidden" name="premise-report[type]" value="sales" />'; } ?> </div> </form> <hr /> <?php if (!empty($_POST) && wp_verify_nonce($_POST['_wpnonce'], $this->settings_field)) { $end_date_ts = strtotime($args['end-year'] . '-' . $args['end-month'] . '-' . $args['end-day']) + 1; $start_date_ts = strtotime($args['start-year'] . '-' . $args['start-month'] . '-' . $args['start-day']); $end_date = date('Y-m-d', $end_date_ts); $start_date = $args['start-year'] . '-' . $args['start-month'] . '-' . $args['start-day']; if ($args['type'] == 'subscription') { $order_rows = $this->build_renewal_table($start_date_ts, $end_date_ts); } else { $order_rows = $this->build_order_table($start_date, $end_date); } if (!empty($order_rows)) { echo '<table class="premise-report-table">'; foreach ($order_rows as $key => $order) { $class = ''; if (!is_numeric($key)) { $class = 'class="total"'; } elseif ($key % 2) { $class = 'class="alt"'; } printf('<tr %s><td>%s</td><tr>', $class, implode('</td><td>', $order)); } echo '</table>'; } } ?> </div> <?php }
function process_coupon() { if (is_admin() || !is_singular('acp-coupons')) { return; } // check for authorization $object = get_queried_object(); $product_id = str_replace('/', '', get_query_var('attachment')); if (!accesspress_get_custom_field('_acp_coupon_auth_key') || !accesspress_get_custom_field('_acp_coupon_auth_key_base') || isset($_REQUEST['auth']) && $this->get_authorization_key($object->ID, $product_id) == $_REQUEST['auth']) { $coupon_products = accesspress_get_custom_field('_acp_coupon_products'); $cookie_name = 'premise-coupon-' . $object->ID . ($product_id && !empty($coupon_products) ? '-' . $product_id : ''); $value = isset($_REQUEST['auth']) ? $_REQUEST['auth'] : md5($cookie_name); $now = time(); $expiry = accesspress_get_custom_field('_acp_coupon_lifetime') > 0 ? $now + accesspress_get_custom_field('_acp_coupon_lifetime') * 86400 : 0; // clear conflicting coupons foreach ($this->get_member_coupons() as $key => $coupon) { if ($key != $cookie_name && (empty($coupon_products) || !isset($coupon[2]) || $coupon[2] == $product_id)) { setcookie($key, '', $now, COOKIEPATH, COOKIE_DOMAIN); } } // store the coupon in a cookie setcookie($cookie_name, $value, $expiry, COOKIEPATH, COOKIE_DOMAIN); } if (isset($_REQUEST['redir'])) { wp_redirect(urldecode($_REQUEST['redir'])); exit; } $checkout_page = accesspress_get_option('checkout_page'); if (!$product_id || !$checkout_page) { if (accesspress_get_custom_field('_acp_coupon_redirect')) { wp_redirect(accesspress_get_custom_field('_acp_coupon_redirect')); } else { wp_safe_redirect(home_url('/')); } exit; } wp_safe_redirect(add_query_arg(array('product_id' => $product_id), get_permalink($checkout_page))); exit; }
function memberaccess_ssl_upload_dir($uploads) { $ssl_checkout = accesspress_get_option('ssl_checkout') && memberaccess_is_page(accesspress_get_option('checkout_page')); if (!$ssl_checkout && !accesspress_get_option('ssl_everywhere')) { return $uploads; } foreach (array('url', 'baseurl') as $key) { $uploads[$key] = preg_replace('|^http://|', 'https://', $uploads[$key]); } return $uploads; }
/** * Get the gateway mode. * * Default is Premise 2.0 mode setting * * @since 2.1.0 */ public function mode($mode) { $gateway_mode = accesspress_get_option($mode); if (!strlen($gateway_mode)) { $gateway_mode = accesspress_get_option('gateway_live_mode'); } return $gateway_mode; }
function memberaccess_member_products_content($atts, $content = '') { add_filter('comments_open', '__return_false'); if (!is_user_logged_in()) { return ''; } $user = wp_get_current_user(); /** Pull all the orders the member has ever made */ $orders = get_user_option('acp_orders', $user->ID); if (empty($orders)) { return ''; } /** check for cancel requests */ if (!empty($_GET['cancel']) && !empty($_GET['order_id']) && !empty($_GET['_wpnonce']) && $_GET['cancel'] == 'true' && wp_verify_nonce($_GET['_wpnonce'], 'cancel-subscription-' . $_GET['order_id'])) { memberaccess_cancel_subscription($_GET['order_id']); } $output = ''; $date_format = get_option('date_format'); $order_format = '<li><span class="premise-member-product">%s</span> - <span class="premise-member-product-expiry">%s</span> <span class="premise-member-product-cancel">%s</span></li>'; /** Cycle through $orders looking for active (non-expired) subscriptions */ foreach ($orders as $order) { // get product $product = (int) get_post_meta($order, '_acp_order_product_id', true); $product_post = get_post($product); if (!$product_post) { continue; } // get expiry time $expiration = memberaccess_get_order_expiry($order, $product, 0, true); if (0 == $expiration) { $output .= sprintf($order_format, esc_html($product_post->post_title), __('Lifetime', 'premise'), ''); continue; } $payment_profile = get_user_option('memberaccess_cc_payment_' . $product); if ($payment_profile) { $output .= sprintf($order_format, esc_html($product_post->post_title), date($date_format, $expiration), ''); continue; } $renew_url = add_query_arg(array('renew' => 'true', 'product_id' => $product), get_permalink(accesspress_get_option('checkout_page'))); $cancel_url = ''; $cancel_status = __('cancel', 'premise'); $renewal_time = get_post_meta($order, '_acp_order_renewal_time', true); $status = get_post_meta($order, '_acp_order_status', true); if ($payment_profile && $renewal_time > time() - 172800 && $status != $cancel_status) { $cancel_url = sprintf(__('<a href="%s" %s>Cancel</a>', 'premise'), wp_nonce_url(add_query_arg(array('cancel' => 'true', 'order_id' => $order), get_permalink(accesspress_get_option('member_page'))), 'cancel-subscription-' . $order), ''); } $output .= sprintf($order_format, esc_html($product_post->post_title), date($date_format, $expiration) . ' - ' . sprintf(__('<a href="%s" %s>Renew</a>', 'premise'), $renew_url, ''), $cancel_url); } return '<ul class="premise-member-products">' . $output . '</ul>'; }
/** * Helper function that returns a setting value from this form's settings * field for use in form fields. * * @since 0.1.0 * * @param string $key Field key * @return string Field value */ protected function get_field_value($key) { return accesspress_get_option($key, $this->settings_field); }
function addPageToReadingStaticPageDropdown($page_html) { $is_page_on_front = 'page_on_front' == substr($page_html, 14, 13); $is_member_access_settings = 'member-access-settings' == substr($page_html, 14, 22); if (!$is_page_on_front && !$is_member_access_settings) { return $page_html; } $selected = false; $page_html = str_replace('</select>', '', $page_html); $selected = 0; if ($is_page_on_front) { $selected = get_option('page_on_front'); } elseif (preg_match('|member-access-settings\\[([a-z_]+)\\]|', $page_html, $m)) { $selected = accesspress_get_option($m[1]); } $landings = get_posts(array('post_type' => $this->_type_LandingPage, 'nopaging' => true, 'post_status' => 'publish')); foreach ($landings as $landing) { $page_html .= sprintf('<option %s class="level-0" value="%d">%s</option>%s', $selected == $landing->ID ? 'selected="selected"' : '', $landing->ID, apply_filters('the_title', $landing->post_title), "\n"); } $page_html .= '</select>'; return $page_html; }
function email_purchase_notification($member, $order_details) { global $product_post, $product_member; if (empty($order_details['_acp_order_product_id']) || !get_post_meta($order_details['_acp_order_product_id'], '_acp_product_email_enabled', true)) { return; } $product_member = get_user_by('id', $member); if (!$product_member || !is_email($product_member->user_email)) { return; } $product_post = get_post($order_details['_acp_order_product_id']); if (empty($product_post)) { return; } $email_subject = get_post_meta($product_post->ID, '_acp_product_email_receipt_subject', true); if (!empty($email_subject)) { $email_subject = do_shortcode($email_subject); } $email_body = get_post_meta($product_post->ID, '_acp_product_email_receipt_intro', true); if (!empty($email_body)) { $email_body = do_shortcode($email_body); } $email_from = memberaccess_get_email_receipt_address(); $from_description = accesspress_get_option('email_receipt_name'); wp_mail($product_member->user_email, $email_subject, $email_body, "From: \"{$from_description}\" <{$email_from}>"); }
_e('Filename', 'premise'); ?> </label></th> <td> <input name="edit_link[filename]" id="edit_link[filename]" type="text" value="<?php echo esc_attr($info['filename']); ?> " size="40" /> <p class="description"> <?php _e('Type the filename you wish to link to.', 'premise'); ?> <br /> <?php $uploads = wp_upload_dir(); printf(__('File must exist in the %s directory.', 'premise'), $uploads['basedir'] . '/' . accesspress_get_option('uploads_dir')); ?> </p> </td> </tr> <tr class="form-field"> <th scope="row" valign="top"><label for="edit_link[delay]"><?php _e('Delay Access', 'premise'); ?> </label></th> <td><input name="edit_link[delay]" id="edit_link[delay]" type="text" value="<?php echo esc_attr(absint($info['delay'])); ?> " size="5" style="width: auto;" /> <?php _e('Days', 'premise');
function memberaccess_location_check() { $checkout_page = accesspress_get_option('checkout_page'); /** check for ssl */ if (!is_ssl()) { if (accesspress_get_option('ssl_everywhere')) { memberaccess_ssl_redirect(); } if ($checkout_page && accesspress_get_option('ssl_checkout') && is_page($checkout_page)) { memberaccess_ssl_redirect(); } $login_page = accesspress_get_option('login_page'); if ($login_page && force_ssl_login() && is_page($login_page)) { memberaccess_ssl_redirect(); } } $member_page = accesspress_get_option('member_page'); if (($checkout_page || $member_page) && is_page(array($checkout_page, $member_page))) { add_action('wp_head', 'memberaccess_checkout_css', 99); } }
function memberaccess_login_redirect($redirect_to = '') { $login_page = accesspress_get_option('login_page'); if ($login_page) { $login_url = get_permalink($login_page); } else { $login_url = home_url('wp-login.php'); } return add_query_arg(array('redirect_to' => $redirect_to), $login_url); }
function email_purchase_notification($member, $order_details, $skip_email = false, $order_id = 0) { global $product_post, $product_member, $checkout_order; if (empty($order_details['_acp_order_product_id']) || $skip_email || !accesspress_get_custom_field('_acp_product_email_enabled', '', $order_details['_acp_order_product_id'])) { return; } $product_member = get_user_by('id', $member); if (!$product_member || !is_email($product_member->user_email)) { return; } $product_post = get_post($order_details['_acp_order_product_id']); if (empty($product_post)) { return; } $checkout_order = get_post($order_id); $email_subject = get_post_meta($product_post->ID, '_acp_product_email_receipt_subject', true); $email_subject = apply_filters('premise_purchase_notification_subject', $email_subject, $order_details); if (!empty($email_subject)) { $email_subject = do_shortcode($email_subject); } $email_body = get_post_meta($product_post->ID, '_acp_product_email_receipt_intro', true); $email_body = apply_filters('premise_purchase_notification_body', $email_body, $order_details); if (!empty($email_body)) { $email_body = do_shortcode($email_body); } if ($skip_email) { return compact('email_subject', 'email_body'); } $email_from = memberaccess_get_email_receipt_address(); $from_description = accesspress_get_option('email_receipt_name'); wp_mail($product_member->user_email, $email_subject, $email_body, "From: \"{$from_description}\" <{$email_from}>"); }