Changeset 2370819
- Timestamp:
- 08/28/2020 04:10:57 AM (6 years ago)
- Location:
- subscribility
- Files:
-
- 4 deleted
- 20 edited
- 8 copied
-
tags/2.9.19.5 (copied) (copied from subscribility/trunk)
-
tags/2.9.19.5/includes (copied) (copied from subscribility/trunk/includes)
-
tags/2.9.19.5/includes/Bootstrap (deleted)
-
tags/2.9.19.5/includes/admin/assets/css/wp99234-admin.css (modified) (1 diff)
-
tags/2.9.19.5/includes/bootstrap (copied) (copied from subscribility/trunk/includes/bootstrap)
-
tags/2.9.19.5/includes/common/InfoDump.php (deleted)
-
tags/2.9.19.5/includes/frontend/assets/css/wp99234_frontend.css (modified) (5 diffs)
-
tags/2.9.19.5/includes/frontend/assets/js/wp99234_frontend.js (modified) (1 diff)
-
tags/2.9.19.5/includes/frontend/controllers/CustomerController.php (deleted)
-
tags/2.9.19.5/includes/frontend/controllers/OrderController.php (deleted)
-
tags/2.9.19.5/includes/frontend/controllers/class-wp99234-forms.php (modified) (2 diffs)
-
tags/2.9.19.5/includes/frontend/controllers/class-wp99234-order-controller.php (modified) (2 diffs)
-
tags/2.9.19.5/includes/frontend/controllers/class-wp99234-template.php (copied) (copied from subscribility/trunk/includes/frontend/controllers/class-wp99234-template.php)
-
tags/2.9.19.5/includes/frontend/controllers/class-wp99234-wc-filter.php (modified) (9 diffs)
-
tags/2.9.19.5/includes/frontend/controllers/class-wp99234-wc-payment-gateway.php (modified) (2 diffs)
-
tags/2.9.19.5/includes/frontend/views/newsletter_form.php (modified) (1 diff)
-
tags/2.9.19.5/includes/frontend/views/registration_form.php (modified) (4 diffs)
-
tags/2.9.19.5/readme.txt (copied) (copied from subscribility/trunk/readme.txt) (2 diffs)
-
tags/2.9.19.5/vendor/cloudinary/cloudinary_php/src/Cloudinary.php (copied) (copied from subscribility/trunk/vendor/cloudinary/cloudinary_php/src/Cloudinary.php)
-
tags/2.9.19.5/vendor/inacho/php-credit-card-validator/src/CreditCard.php (copied) (copied from subscribility/trunk/vendor/inacho/php-credit-card-validator/src/CreditCard.php)
-
tags/2.9.19.5/wp99234.php (copied) (copied from subscribility/trunk/wp99234.php) (2 diffs)
-
trunk/includes/admin/assets/css/wp99234-admin.css (modified) (1 diff)
-
trunk/includes/frontend/assets/css/wp99234_frontend.css (modified) (5 diffs)
-
trunk/includes/frontend/assets/js/wp99234_frontend.js (modified) (1 diff)
-
trunk/includes/frontend/controllers/class-wp99234-forms.php (modified) (2 diffs)
-
trunk/includes/frontend/controllers/class-wp99234-order-controller.php (modified) (2 diffs)
-
trunk/includes/frontend/controllers/class-wp99234-wc-filter.php (modified) (9 diffs)
-
trunk/includes/frontend/controllers/class-wp99234-wc-payment-gateway.php (modified) (2 diffs)
-
trunk/includes/frontend/views/newsletter_form.php (modified) (1 diff)
-
trunk/includes/frontend/views/registration_form.php (modified) (4 diffs)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/wp99234.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
subscribility/tags/2.9.19.5/includes/admin/assets/css/wp99234-admin.css
r2333850 r2370819 479 479 } 480 480 .troly_log_table td span { 481 width: 80px;481 width: 90px; 482 482 height: 25px; 483 483 display: inline-block; -
subscribility/tags/2.9.19.5/includes/frontend/assets/css/wp99234_frontend.css
r2319969 r2370819 137 137 } 138 138 .woocommerce .woocommerce-form .password-input .show-password-input { 139 position: absolute;140 right: .7em;141 top: 0;142 139 cursor: pointer; 143 140 text-decoration: none; … … 164 161 } 165 162 163 #wp99234_membership_options { 164 display: grid; 165 grid-template-columns: repeat(2, 1fr); 166 } 167 #wp99234_membership_options .wp99234-membership_option { 168 list-style: none; 169 border:1px solid transparent; 170 padding:20px; 171 width: 100%; 172 margin: 0; 173 } 174 #wp99234_membership_options .wp99234-membership_option.selected { 175 border-color: #CCC; 176 } 177 #wp99234_membership_options .wp99234-membership_option.inactive { 178 opacity: 0.6; 179 } 180 166 181 /* @todo: Dumped styling from Patina. Needs to be amended. */ 167 #wp99234_member_registration_form .wp99234-membership_option {168 width: 44% !important;169 }170 171 #wp99234_member_registration_form .wp99234-membership_option:nth-child(2n) {172 margin-left: 2% !important;173 }174 175 #wp99234_member_registration_form .wp99234-membership_option_title {176 color: inherit;177 }178 179 #wp99234_member_registration_form .wp99234-input_field_text,180 #wp99234_member_registration_form #subs_birthday,181 #wp99234_member_registration_form .cc_details input,182 #wp99234_member_registration_form .wp99234-input_field_password {183 border: none !important;184 padding: 15px 13px;185 }186 187 #wp99234_member_registration_form .wp99234-section_title {188 color: inherit !important;189 text-align: left !important;190 }191 192 #wp99234_member_registration_form p.form-row {193 text-align: left !important;194 padding-top: 5px;195 padding-bottom: 5px;196 }197 198 182 #wp99234_member_registration_form .wp99234-section.chosen-preferences { 199 183 padding-bottom: 15px; … … 215 199 } 216 200 217 #wp99234_member_registration_form #wp99234_member_submit,218 .wp99234-selected_membership {219 color: #ffffff;220 font-family: 'Raleway', sans-serif;221 font-size: 11px;222 height: 45px;223 font-style: normal;224 font-weight: 700;225 background-color: #a05f42;226 -webkit-border-radius: 1px;227 letter-spacing: 1px;228 text-transform: uppercase;229 border-width: 0px;230 }231 232 #wp99234-registration_shipping_instructions {233 border: none !important;234 }235 236 201 #wp99234_member_registration_form .form-submit.form-row { 237 202 text-align: center !important; 238 203 } 239 204 240 .form-row.shipping_instructions { 241 width: 105% !important; 205 #wp99234_member_registration_form .select2-container--default .select2-selection--single { 206 height: 48px !important; 207 } 208 #wp99234_member_registration_form .select2-container--default .select2-selection--single .select2-selection__rendered { 209 line-height: 48px; 210 } 211 #wp99234_member_registration_form .select2-container--default .select2-selection--single .select2-selection__arrow { 212 height: 46px; 242 213 } 243 214 … … 247 218 } 248 219 249 #wp99234-registration_shipping_instructions {250 height: 115px;251 }252 253 220 #order_review table.shop_table.woocommerce-checkout-review-order-table-bak { 254 221 width: 50% !important; … … 256 223 } 257 224 258 #wc-wp99234_payment_gateway-cc-form input.input-text { 259 width: 98%; 260 } 261 262 263 #wp99234_member_registration_form .wp99234-membership_option:nth-child(2n) { 264 margin-bottom: 30px; 265 } 266 267 @media (min-width: 320px) { 268 #wp99234_member_registration_form .wp99234-membership_option { 269 width: 90% !important; 270 margin-left: 0; 271 } 272 273 #wp99234_member_registration_form .wp99234-membership_option:nth-child(2n) { 274 margin-left: 0 !important; 275 } 276 } 277 278 @media (min-width: 992px) { 279 #wp99234_member_registration_form .wp99234-membership_option { 280 width: 44% !important; 281 } 282 283 #wp99234_member_registration_form .wp99234-membership_option:nth-child(2n) { 284 margin-left: 15px !important; 285 } 286 } 225 .wp99234-input_field_text.input-text { 226 width: 100%; 227 font-size: 1.6rem; 228 padding: 1.5rem 1.8rem; 229 } -
subscribility/tags/2.9.19.5/includes/frontend/assets/js/wp99234_frontend.js
r2319969 r2370819 97 97 $("#hidden_cc_form :input").attr('required', '1'); 98 98 } 99 }); 99 }); 100 101 /** 102 * Hide shipping calculator, shipping form if local pickup is pre-selected. 103 */ 104 if ( $( 'input[type=radio].shipping_method:checked' ).length > 0 && $( 'input[type=radio].shipping_method:checked' ).val().indexOf( 'local_pickup' ) >= 0 ) { 105 $( '.woocommerce-shipping-destination, .woocommerce-shipping-calculator, .woocommerce-shipping-fields, #order_comments_field' ).hide() 106 } 107 108 /** 109 * Hide shipping calculator, shipping form if local pickup is selected. 110 */ 111 $( 'body' ).on( 'click', 'input[type=radio].shipping_method', function() { 112 const method = $(this).val() 113 114 // Only trigger it once all the AJAX has stopped. 115 $( document ).ajaxStop( function() { 116 if ( method.indexOf( 'local_pickup' ) >= 0 ) { 117 $( '.woocommerce-shipping-destination, .woocommerce-shipping-calculator, .woocommerce-shipping-fields, #order_comments_field' ).hide() 118 } else { 119 $( '.woocommerce-shipping-destination, .woocommerce-shipping-calculator, .woocommerce-shipping-fields, #order_comments_field' ).show() 120 } 121 }); 122 }) 100 123 }); -
subscribility/tags/2.9.19.5/includes/frontend/controllers/class-wp99234-forms.php
r2333850 r2370819 143 143 function display_field($key, $field, $css_class = null) { 144 144 $type = (isset($field['type']))?$field['type']:'text'; 145 $isRequired = isset( $field['attributes']['required'] ) ?? false; 145 146 146 147 ?> 147 148 <p class="form-row <?php echo $key . ' ' . $css_class;?>"> 148 149 <?php /*if ( isset( $this->errors[ $key ] ) ): ?>150 <p class="error">151 <?php echo esc_html( $this->errors[ $key ] ); ?>152 </p>153 <?php endif;*/?>154 149 155 150 <?php … … 166 161 <label for="<?php echo $key;?>"> 167 162 <?php echo $field['label'];?> 163 <?php echo $isRequired ? '<abbr class="required" title="required">*</abbr>' : ''; ?> 168 164 </label> 169 165 <?php -
subscribility/tags/2.9.19.5/includes/frontend/controllers/class-wp99234-order-controller.php
r2333875 r2370819 26 26 $this->_orderData[ 'order' ] = [ 27 27 'source' => 'web', 28 'status' => ' draft', // Why are these draft orders?28 'status' => 'confirmed', 29 29 'fname' => $this->_order->get_billing_first_name(), 30 30 'lname' => $this->_order->get_billing_last_name(), … … 106 106 'shipment' => [ 107 107 'name' => $this->_order->get_shipping_first_name() . ' ' . $this->_order->get_shipping_last_name(), 108 'delivery_address' => $this->_order->get_shipping_address_1(), 109 'delivery_suburb' => $this->_order->get_shipping_city(), 110 'delivery_postcode' => $this->_order->get_shipping_postcode(), 111 'delivery_state' => $this->_order->get_shipping_state(), 112 'delivery_country' => WC()->countries->countries[ $this->_order->get_shipping_country() ], 113 'same_billing' => false, 108 114 ] 109 ] );110 111 WP99234()->_customer->updateCustomerData( [112 'delivery_address' => $this->_order->get_shipping_address_1(),113 'delivery_suburb' => $this->_order->get_shipping_city(),114 'delivery_postcode' => $this->_order->get_shipping_postcode(),115 'delivery_state' => $this->_order->get_shipping_state(),116 'delivery_country' => WC()->countries->countries[ $this->_order->get_shipping_country() ],117 'same_billing' => false,118 115 ] ); 119 116 -
subscribility/tags/2.9.19.5/includes/frontend/controllers/class-wp99234-wc-filter.php
r2333850 r2370819 98 98 add_action( 'woocommerce_check_cart_items', [$this, 'wp99234_enforce_minimum_quantity'], 10 ); 99 99 add_action( 'woocommerce_cart_calculate_fees', [$this, 'wp99234_add_cart_fees'], 10, 1 ); 100 add_action( 'troly_order_status_check', [$this, 'check_wp99234_payment_status' ], 10, 1 );101 add_action( 'woocommerce_order_status_cancelled' , [$this, 'removeOrderStatusCheckCRON'], 10 );100 //add_action( 'troly_order_status_check', [$this, 'check_wp99234_payment_status' ], 10, 1 ); 101 //add_action( 'woocommerce_order_status_cancelled' , [$this, 'removeOrderStatusCheckCRON'], 10 ); 102 102 add_filter( 'woocommerce_is_purchasable', [$this, 'restrictMembersOnlyProducts'], 20, 2 ); 103 103 add_filter( 'woocommerce_post_class', [$this, 'addMembersOnlyClass'], 20, 2 ); 104 104 add_filter( 'woocommerce_login_redirect', [$this, 'trolySourceRedirect'], 10, 2 ); 105 add_action( 'woocommerce_order_status_processing', [$this, 'exportPaymentToSubs' ], 10, 1 ); 106 } 107 108 /** 109 * Send payment information to Troly once an order is paid or refunded 110 * in WordPress that does not use the Troly gateway. 111 * 112 * @param int $orderID 113 * @return void 114 */ 115 public function exportPaymentToSubs( $orderID ) { 116 WP99234()->_woocommerce->export_payment( $orderID ); 105 117 } 106 118 … … 134 146 public function addMembersOnlyClass( $classes, $product ) 135 147 { 136 if ( has_term( ' visible-to-members-only', 'product_tag', $product->get_id() ) ) {148 if ( has_term( 'purchase-by-members-only', 'product_tag', $product->get_id() ) ) { 137 149 $classes[] = 'membersonly'; 138 150 } … … 180 192 public function restrictMembersOnlyProducts( $isPurchaseable, $product ) 181 193 { 182 if ( has_term( ' visible-to-members-only', 'product_tag', $product->get_id() ) ) {194 if ( has_term( 'purchase-by-members-only', 'product_tag', $product->get_id() ) ) { 183 195 184 196 if ( is_user_logged_in() ) { … … 1466 1478 * @todo Using this here but not certain. Triggering the callback cron for Troly. 1467 1479 */ 1468 if ( ! wp_next_scheduled( 'troly_order_status_check' ) ) {1469 wp_schedule_event( time(), '15_seconds', 'troly_order_status_check', [ $order_id ] );1470 }1480 //if ( ! wp_next_scheduled( 'troly_order_status_check' ) ) { 1481 // wp_schedule_event( time(), '15_seconds', 'troly_order_status_check', [ $order_id ] ); 1482 //} 1471 1483 1472 1484 if ( isset( $response->id ) ) { … … 1594 1606 * @throws Exception 1595 1607 */ 1596 public function export_payment( $order_id ) { 1597 1598 $order = wc_get_order($order_id); 1599 1600 $subs_id = get_post_meta( $order_id, 'subs_id', true ); 1601 $trx_id = $order->get_transaction_id(); 1602 1603 WP99234()->logger->notice("Processing $subs_id"); 1604 1605 $mtype = $order->get_payment_method(); 1606 WP99234()->logger->notice("Attempting to export a payment for $order_id (Troly ID $subs_id) with $mtype (TRXID $trx_id) as payment"); 1607 1608 switch($mtype){ 1609 case 'cod': 1610 $mtype = 'cash'; 1611 break; 1612 case 'bacs': 1613 $mtype = 'transfer'; 1614 break; 1615 default: 1616 $mtype = $mtype; 1617 break; 1618 } 1619 1620 # We set rrn to allow Stream objects to show reference 1621 # This will also be set on the Payment object as well 1622 $pay_data = array( 1623 'order' => array ( 1624 'id' => $subs_id, 1625 // 'payment_type' => 'offline', 1626 'payment_meth' => 'website', 1627 'payment_src' => $mtype, 1628 'status' => 'confirmed' , 1629 'rrn' => $trx_id 1630 ), 1631 'id' => $subs_id 1632 ); 1633 1634 $response = WP99234()->_api->_call( $this->payment_api_endpoint.$subs_id, $pay_data, 'PUT' ); 1635 1636 if( isset( $response->channel ) ){ 1637 $order->add_order_note( 'Exported payment information to Troly' ); 1638 WP99234()->logger->notice("Succeeded exporting payment for $order_id (Troly ID $subs_id) with $mtype as payment"); 1639 return true; 1640 } else { 1641 $order->add_order_note( 'Could not export payment information to Troly' ); 1642 WP99234()->logger->notice("Failed exporting payment for $order_id (Troly ID $subs_id) with $mtype as payment"); 1643 throw new \Exception( __( 'An error has occurred. Please get in touch with us as soon as possible.', 'wp99234' ) ); 1608 public function export_payment( $order_id ) 1609 { 1610 $order = wc_get_order($order_id); 1611 $subs_id = get_post_meta( $order_id, 'subs_id', true ); 1612 $trx_id = $order->get_transaction_id(); 1613 $mtype = $order->get_payment_method(); 1614 1615 // Do not trigger this for Troly payment gateway. 1616 if ( 'wp99234_payment_gateway' !== $mtype ) { 1617 WP99234()->logger->notice("Processing $subs_id"); 1618 WP99234()->logger->notice("Attempting to export a payment for $order_id (Troly ID $subs_id) with $mtype (TRXID $trx_id) as payment"); 1619 1620 switch($mtype){ 1621 case 'bacs': 1622 $mtype = 'transfer'; 1623 break; 1624 default: 1625 $mtype = $mtype; 1626 break; 1627 } 1628 1629 # We set rrn to allow Stream objects to show reference 1630 # This will also be set on the Payment object as well 1631 $pay_data = [ 1632 'order' => [ 1633 'id' => $subs_id, 1634 'payment_type' => 'offline', 1635 'payment_meth' => 'website', 1636 'payment_src' => $mtype, 1637 'status' => 'confirmed' , 1638 'rrn' => $trx_id 1639 ], 1640 'id' => $subs_id 1641 ]; 1642 1643 $response = WP99234()->_api->_call( $this->payment_api_endpoint.$subs_id, $pay_data, 'PUT' ); 1644 1645 if ( isset( $response->channel ) ) { 1646 $order->add_order_note( 'Exported payment information to Troly' ); 1647 WP99234()->logger->notice("Succeeded exporting payment for $order_id (Troly ID $subs_id) with $mtype as payment"); 1648 return true; 1649 } else { 1650 $order->add_order_note( 'Could not export payment information to Troly' ); 1651 WP99234()->logger->notice("Failed exporting payment for $order_id (Troly ID $subs_id) with $mtype as payment"); 1652 throw new \Exception( __( 'An error has occurred. Please get in touch with us as soon as possible.', 'wp99234' ) ); 1653 } 1644 1654 } 1645 1655 } … … 1660 1670 1661 1671 $order = new WC_Order( $order_id ); 1672 $rrn = $order->get_transaction_id(); 1662 1673 $order_status = $order->get_status() !== 'failed' ? 'in-progress' : false; 1663 1674 … … 1670 1681 $data = array( 1671 1682 'status' => 'confirmed', // $order_status 1672 'id' => $subs_id, 1683 'id' => $subs_id, // maybe remove this 1673 1684 'order' => array( 1674 1685 'status' => 'confirmed', 1675 'payment_type' => $payment_type 1686 'payment_type' => $payment_type, 1687 'payment_meth' => 'website', 1688 'payment_src' => 'wp99234_payment_gateway', 1689 'rrn' => $rrn, 1676 1690 ) 1677 1691 ); … … 1748 1762 * 1749 1763 * @param int|string $orderID 1750 * @todo fix this1764 * @todo removing this since the status of orders placed via Troly gateway are begin updated already 1751 1765 * @return void 1752 1766 */ 1753 public function check_wp99234_payment_status( $orderID ) {1754 1755 if ( ! $orderID ) return;1756 $order = wc_get_order( $orderID );1757 if ( ! $order ) return;1758 1759 $trolyOrderID = get_post_meta( $order->get_id(), 'subs_id', true );1760 1761 if ( ! $trolyOrderID || empty( $trolyOrderID) ) return;1762 1763 $endpoint = sprintf( "%sorders/%s.json", WP99234_Api::$endpoint, $trolyOrderID );1764 $response = WP99234()->_api->_call( $endpoint );1765 1766 // Just taking in the case of "success" for now.1767 if ( $response && is_object( $response ) && ( $response->payment_status === 'auth'1768 || $response->payment_status === 'paid' ) ) {1769 $order->update_status( 'processing' );1770 1771 // Removing the specific CRON after order status has been updated.1772 wp_clear_scheduled_hook( 'troly_order_status_check', [ $orderID ] );1773 }1774 1775 exit;1776 }1767 //public function check_wp99234_payment_status( $orderID ) { 1768 1769 // if ( ! $orderID ) return; 1770 // $order = wc_get_order( $orderID ); 1771 // if ( ! $order ) return; 1772 1773 // $trolyOrderID = get_post_meta( $order->get_id(), 'subs_id', true ); 1774 1775 // if ( ! $trolyOrderID || empty( $trolyOrderID) ) return; 1776 1777 // $endpoint = sprintf( "%sorders/%s.json", WP99234_Api::$endpoint, $trolyOrderID ); 1778 // $response = WP99234()->_api->_call( $endpoint ); 1779 1780 // // Just taking in the case of "success" for now. 1781 // if ( $response && is_object( $response ) && ( $response->payment_status === 'auth' 1782 // || $response->payment_status === 'paid' ) ) { 1783 // $order->update_status( 'processing' ); 1784 1785 // // Removing the specific CRON after order status has been updated. 1786 // wp_clear_scheduled_hook( 'troly_order_status_check', [ $orderID ] ); 1787 // } 1788 1789 // exit; 1790 //} 1777 1791 1778 1792 /** … … 1783 1797 * @return void 1784 1798 */ 1785 public function removeOrderStatusCheckCRON( $orderID )1786 {1787 wp_clear_scheduled_hook( 'troly_order_status_check', [ $orderID ] );1788 }1799 //public function removeOrderStatusCheckCRON( $orderID ) 1800 //{ 1801 // wp_clear_scheduled_hook( 'troly_order_status_check', [ $orderID ] ); 1802 //} 1789 1803 1790 1804 /** -
subscribility/tags/2.9.19.5/includes/frontend/controllers/class-wp99234-wc-payment-gateway.php
r2319969 r2370819 38 38 39 39 add_action( 'woocommerce_after_checkout_form', array($this, 'add_cc_field_toggle_js'), 6); 40 add_action( 'woocommerce_payment_complete', [ $this, 'exportPaymentToSubs' ], 10, 2);41 }42 43 /**44 * Send payment information to Troly once an order is paid or refunded45 * in WordPress that does not use the Troly gateway46 *47 * @param int $order_id48 * @param array $posted_data49 * @return void50 */51 public function exportPaymentToSubs( $order_id, $posted_data ) {52 WP99234()->_woocommerce->export_payment( $order_id );53 40 } 54 41 … … 110 97 $return_url = $this->get_return_url( $order ); 111 98 112 if( $websocket_channel ){ 113 $return_url = esc_url_raw( add_query_arg( 'ws_channel', $websocket_channel, $return_url ) ); 114 } 99 if ( $websocket_channel ) { 100 $order->update_status( 'processing' ); 101 $return_url = esc_url_raw( add_query_arg( 'ws_channel', $websocket_channel, $return_url ) ); 102 } 115 103 116 104 // Return thankyou redirect -
subscribility/tags/2.9.19.5/includes/frontend/views/newsletter_form.php
r2319969 r2370819 22 22 </style> 23 23 24 <form id="newsletter_registration_form" action="#newsletter_registration_form" method="POST"> 24 <div class="woocommerce"> 25 <form id="newsletter_registration_form" action="#newsletter_registration_form" method="POST"> 25 26 26 <div class="woocommerce">27 <?php if ( !is_admin() ) { if ( function_exists('wc_print_notices') ) { wc_print_notices(); } } ?>28 </div>27 <div class="woocommerce"> 28 <?php if ( !is_admin() ) { if ( function_exists('wc_print_notices') ) { wc_print_notices(); } } ?> 29 </div> 29 30 30 <div class="cfix">31 <div class="cfix"> 31 32 32 <?php $fields = array( 33 'first_name' => array( 34 (get_option('wp99234_newsletter_use_placeholders') == 'yes' ? 'placeholder' : 'label') => __( 'First Name', 'wp99234' ), 35 'default' => '', 36 ), 37 'reg_email' => array( 38 (get_option('wp99234_newsletter_use_placeholders') == 'yes' ? 'placeholder' : 'label') => __( 'Email', 'wp99234' ), 39 'default' => '', 40 ), 41 ); 33 <?php $fields = array( 34 'first_name' => array( 35 (get_option('wp99234_newsletter_use_placeholders') == 'yes' ? 'placeholder' : 'label') => __( 'First Name', 'wp99234' ), 36 'default' => '', 37 'attributes' => [ 38 'class' => 'input-text', 39 ], 40 ), 41 'reg_email' => array( 42 (get_option('wp99234_newsletter_use_placeholders') == 'yes' ? 'placeholder' : 'label') => __( 'Email', 'wp99234' ), 43 'default' => '', 44 'attributes' => [ 45 'class' => 'input-text', 46 ], 47 ), 48 ); 42 49 43 if ( get_option('wp99234_newsletter_collect_mobile') == 'yes' ) { 44 $fields['mobile'] = array( 45 ( get_option( 'wp99234_newsletter_use_placeholders' ) == 'yes' ? 'placeholder' : 'label' ) => __( 'Mobile', 'wp99234' ), 46 'default' => '', 47 ); 48 } 50 if ( get_option('wp99234_newsletter_collect_mobile') == 'yes' ) { 51 $fields['mobile'] = array( 52 ( get_option( 'wp99234_newsletter_use_placeholders' ) == 'yes' ? 'placeholder' : 'label' ) => __( 'Mobile', 'wp99234' ), 53 'default' => '', 54 'attributes' => [ 55 'class' => 'input-text', 56 ], 57 ); 58 } 49 59 50 // Only show Postcode if not 'hidden'51 if ( get_option('wp99234_newsletter_collect_postcode') != 'hidden' ) {52 $fields['postcode'] = array(53 ( get_option( 'wp99234_newsletter_use_placeholders' ) == 'yes' ? 'placeholder' : 'label' ) => __( 'Postcode', 'wp99234' ),54 'default' => '',55 );56 }60 // Only show Postcode if not 'hidden' 61 if ( get_option('wp99234_newsletter_collect_postcode') != 'hidden' ) { 62 $fields['postcode'] = array( 63 ( get_option( 'wp99234_newsletter_use_placeholders' ) == 'yes' ? 'placeholder' : 'label' ) => __( 'Postcode', 'wp99234' ), 64 'default' => '', 65 ); 66 } 57 67 58 ?>68 ?> 59 69 60 <?php foreach( $fields as $key => $field ){61 WP99234()->_newsletter->display_field( $key, $field );62 } ?>70 <?php foreach( $fields as $key => $field ){ 71 WP99234()->_newsletter->display_field( $key, $field ); 72 } ?> 63 73 64 <p class="form-submit form-row">65 <input type="hidden" name="<?php echo WP99234()->_newsletter->nonce_name; ?>" value="<?php echo wp_create_nonce( WP99234()->_newsletter->nonce_action ); ?>" />66 <input type="submit" name="<?php echo WP99234()->_newsletter->submit_name; ?>" value="<?php _e( 'Sign Up Now', 'wp99234' ); ?>" class="wp99234-newsletter-signup-button" />67 </p>74 <p class="form-submit form-row"> 75 <input type="hidden" name="<?php echo WP99234()->_newsletter->nonce_name; ?>" value="<?php echo wp_create_nonce( WP99234()->_newsletter->nonce_action ); ?>" /> 76 <input type="submit" name="<?php echo WP99234()->_newsletter->submit_name; ?>" value="<?php _e( 'Sign Up Now', 'wp99234' ); ?>" class="wp99234-newsletter-signup-button" /> 77 </p> 68 78 69 </div>79 </div> 70 80 71 </form> 81 </form> 82 </div> -
subscribility/tags/2.9.19.5/includes/frontend/views/registration_form.php
r2333850 r2370819 19 19 $current_membership_id = 'null'; 20 20 21 // Enqueue credit card validator logics. 21 22 wp_enqueue_script( 'jquery-payment-troly' ); 22 23 23 24 echo "\n\n".'<script type="text/javascript">window.troly_current_membership_id = '.$current_membership_id.';</script>'."\n\n"; 24 25 26 // Enqueue WooCommerce styling and functions for dropdown elements. 27 wp_enqueue_style( 'select2' ); 28 wp_enqueue_script( 'selectWoo' ); 25 29 get_header(); 26 30 ?> 27 31 <style type="text/css"> 28 .membership_variation.hide { display:none; } 29 30 /* clearfix hack class */ 31 .wp99234-cfix:after { content: ""; display: table; clear: both; } 32 33 li.wp99234-membership_option { 34 list-style:none; 35 border:1px solid transparent; 36 float:left; 37 padding:20px; 38 margin-bottom:4%; 39 width: 100%; 40 position: relative; 41 } 42 43 .wp99234-membership_option p { 44 padding: 10px 5px; 45 } 46 47 /* Emphasize input fields to inverse background */ 48 .wp99234-input_field_text, #subs_birthday, 49 .wp99234-input_field_password, 50 .wp99234-input_field_textfield, 51 .wp99234-section.cc_details input[type="text"], 52 .wp99234-section.cc_details input[type="tel"] { 53 border-bottom: 1px solid gray; 54 } 55 56 .wp99234-section.chosen-preferences .tags { 57 margin-top: 5px; 58 } 59 .wp99234-section.chosen-preferences .tag, .wp99234-section.chosen-preferences .tag-editable { 60 position: relative; 61 display: inline-block; 62 } 63 64 .wp99234-section.chosen-preferences .tag-selected button:before, 65 .wp99234-membership_option.selected button:before { 66 content:'\2713\00a0\00a0'; /* Add check icon to selected tag */ 67 white-space: pre; 68 } 69 70 .wp99234-membership_option:nth-child(2n+1){ clear:both; } 71 72 .wp99234-membership_option.selected{ 73 border: 1px solid #CCC; 74 } 75 76 .wp99234-selected_membership, 77 .wp99234-restricted_membership { 78 /*margin-top: 1.313em;*/ 79 } 80 81 .wp99234-section.cc_details { 82 padding-top: 15px; 83 } 84 85 #wp99234-create_password_section { 86 padding-top: 15px; 87 } 88 89 #wp99234_member_submit { 90 padding: 5px; 91 height: auto; 92 } 93 94 @media screen and (min-width: 700px) { 95 96 .wp99234-membership_option:nth-child(2n){ 97 margin-left:4%; 98 } 99 .wp99234-membership_option{ 100 width:46%; 101 float:left; 102 } 103 } 104 105 .wp99234_delivery_area { 106 display: block; 107 width: 100%; 108 min-height: 150px; 109 } 110 111 /* User details, CC details and delivery sections */ 112 .wp99234-section.user_details, 113 .wp99234-section.cc_details, 114 .wp99234-section.delivery_details, 115 .wp99234-input_field_textfield { 116 width: 100%; 117 box-sizing: border-box; 118 } 119 @media screen and (min-width: 700px) { 120 121 .wp99234-section.user_details, 122 .wp99234-section.cc_details { 123 float: left; 124 width: 50%; 125 padding-right: 20px; 126 } 127 .wp99234-section.delivery_details { 128 float: right; 129 width: 50%; 130 padding-left: 20px; 131 } 132 } 133 134 .wp99234-section.user_details label, 135 .wp99234-section.cc_details label, 136 .wp99234-section.delivery_details label, 137 .wp99234-section.user_details input, 138 .wp99234-section.cc_details input, 139 .wp99234-section.delivery_details input { 140 width: 100%; 141 } 142 143 @media screen and (max-width: 700px) { 144 .wp99234-section.delivery_details { 145 padding-top: 15px; 146 } 147 } 148 149 #wp99234_use_existing_card{ 150 width:auto; 151 } 152 153 /* Form button */ 154 #wp99234_member_registration_form p.form-submit { 155 text-align: right; 156 } 157 #wp99234_member_registration_form p.form-submit input { 158 width: 260px; 159 text-align: center; 160 padding: 5px; 161 } 32 .membership_variation.hide { display:none; } 33 34 /* clearfix hack class */ 35 .wp99234-cfix:after { content: ""; display: table; clear: both; } 36 37 .wp99234-membership_option p { 38 padding: 10px 5px; 39 } 40 41 .wp99234-section.chosen-preferences .tag, .wp99234-section.chosen-preferences .tag-editable { 42 position: relative; 43 display: inline-block; 44 } 45 46 .wp99234-section.chosen-preferences .tag-selected button:before, 47 .wp99234-membership_option.selected button:before { 48 content:'\2713\00a0\00a0'; /* Add check icon to selected tag */ 49 white-space: pre; 50 } 51 52 .wp99234-membership_option:nth-child(2n+1){ clear:both; } 53 54 .wp99234-selected_membership, 55 .wp99234-restricted_membership { 56 /*margin-top: 1.313em;*/ 57 } 58 59 .wp99234-section.cc_details { 60 padding-top: 15px; 61 } 62 63 #wp99234-create_password_section { 64 padding-top: 15px; 65 } 66 67 .wp99234_delivery_area { 68 display: block; 69 width: 100%; 70 min-height: 150px; 71 } 72 73 /* User details, CC details and delivery sections */ 74 .wp99234-section.user_details, 75 .wp99234-section.cc_details, 76 .wp99234-section.delivery_details, 77 .wp99234-input_field_textfield { 78 width: 100%; 79 box-sizing: border-box; 80 } 81 @media screen and (min-width: 700px) { 82 83 .wp99234-section.user_details, 84 .wp99234-section.cc_details { 85 float: left; 86 width: 50%; 87 padding-right: 20px; 88 } 89 .wp99234-section.delivery_details { 90 float: right; 91 width: 50%; 92 padding-left: 20px; 93 } 94 } 95 96 @media screen and (max-width: 700px) { 97 .wp99234-section.delivery_details { 98 padding-top: 15px; 99 } 100 } 101 102 #wp99234_use_existing_card{ 103 width:auto; 104 } 162 105 163 106 #wp99234_membership_options .restricted { 164 font-style: italic;165 margin-top: 1.313em;107 font-style: italic; 108 margin-top: 1.313em; 166 109 } 167 110 168 /* membership variation dropdown */169 .membership_variation {170 height: 43px;171 border: 1px solid #CCC;172 }173 174 #wp99234-registration_shipping_instructions {175 width: 100%;176 }111 /* membership variation dropdown */ 112 .membership_variation { 113 height: 43px; 114 border: 1px solid #CCC; 115 } 116 117 #wp99234-registration_shipping_instructions { 118 width: 100%; 119 } 177 120 178 121 </style> 179 122 180 <form id="wp99234_member_registration_form" class="woocommerce" action="" method="POST"> 123 <div class="woocommerce"> 124 <form id="wp99234_member_registration_form" action="" method="POST"> 181 125 182 126 <div class="woocommerce wp99234_registration_notices"> … … 184 128 </div> 185 129 186 <div class="wp99234-cfix"> 187 188 <ul id="wp99234_membership_options" class="wp99234-cfix"> 130 <div class="wp99234-cfix"> 131 132 <ul id="wp99234_membership_options" class="wp99234-cfix"> 133 134 <?php 135 $idx = 0; foreach ( apply_filters( 'wp99234_rego_form_membership_options', $membership_options ) as $membership_option ): ?> 136 137 <?php 138 /* Any membership not available to the broader public is not rendered. 139 Public: anyone can sign up 140 Restricted: invite-only 141 */ 142 if( isset( $membership_option->visibility ) && !in_array( $membership_option->visibility, [ 'public', 'restricted' ] ) ) continue; 143 ?> 144 145 <li class="wp99234-membership_option 146 <?php echo $current_membership_id == $membership_option->id ? 'selected' : 'inactive'; ?>" 147 id="wp99234-club_<?php echo str_replace(' ', '_', strtolower($membership_option->name));?>"> 148 149 <h5 class="wp99234-membership_option_title"><?php echo esc_html( $membership_option->name ); ?></h5> 150 151 <div class="wp99234-membership_option_details"> 152 153 <?php if ( !empty( $membership_option->description )) { ?> 154 <p class="wp99234-membership-description"><?php echo $membership_option->description; ?></p> 155 <?php } ?> 156 157 <?php if ( !empty( $membership_option->benefits )) { ?> 158 <p><a href="#" class="subs-toggle-member-benefits wp99234-membership_benefits_show">Additional benefits</a></p> 159 <div class="wp99234-membership_benefits"> 160 <h6 class="wp99234-membership_option_member_benefits_title">Member Benefits</h6> 161 <ul><li><?php echo implode("</li><li>",explode("\n",$membership_option->benefits)); ?></li></ul> 162 </div> 163 <?php } ?> 164 </div> 165 166 <?php 167 if($current_membership_id == $membership_option->id) { 168 echo '<div class="restricted wp99234_current_membership">You are currently a member of this club.</div>'; 169 } 170 if( isset( $membership_option->visibility) && $membership_option->visibility == 'public') { ?> 171 172 <input type="radio" class="selected_membership_radio" name="selected_membership" value="<?php echo $membership_option->id; ?>" <?php if($current_membership_id == $membership_option->id){echo 'checked="checked"';}?> /> 173 174 <button class="wp99234-selected_membership button" data-original_text="<?php _e( 'Select', 'wp99234' ); ?>" data-selected_text="<?php _e( 'Selected', 'wp99234' ); ?>" data-membership_option_id="<?php echo $membership_option->id; ?>" > 175 <?php if($current_membership_id == $membership_option->id){ _e( 'Selected', 'wp99234' );}else{ _e( 'Select', 'wp99234' );}?> 176 </button> 177 178 <!-- enable membership variations for variation membership only --> 179 <?php if( isset($membership_option->is_variation_membership) && $membership_option->is_variation_membership ): ?> 180 <!-- only selected variation will be set name to 'variation_id'. It will be passed to Troly for creating membership during submission --> 181 <select id="membership_option_<?php echo $membership_option->id ?>" class="membership_variation hide" name=""> 182 <option value='' disabled>Membership option</option> 183 <?php 184 foreach($membership_option->variations as $v_id => $v_name) { 185 echo "<option value=".$v_id.">".$v_name."</option>"; 186 } 187 ?> 188 </select> 189 <?php endif; ?> 190 191 <?php } else if ( isset( $membership_option->visibility ) && $membership_option->visibility == 'restricted' && $current_membership_id != $membership_option->id) { ?> 192 193 <div class="restricted">You cannot currently sign up for this membership. Please contact us for further information.</div> 194 195 <?php } ?> 196 197 </li> 198 199 <?php endforeach; ?> 200 201 </ul> 202 203 <h3 class="wp99234-section_title">Membership Details</h3> 189 204 190 205 <?php 191 $idx = 0; foreach ( apply_filters( 'wp99234_rego_form_membership_options', $membership_options ) as $membership_option ): ?> 192 193 <?php 194 /* Any membership not available to the broader public is not rendered. 195 Public: anyone can sign up 196 Restricted: invite-only 197 */ 198 if( isset( $membership_option->visibility ) && !in_array( $membership_option->visibility, [ 'public', 'restricted' ] ) ) continue; 199 ?> 200 201 <li class="wp99234-membership_option <?php if($current_membership_id == $membership_option->id){ echo 'selected'; } elseif(isset($current_membership_id)){ echo 'inactive';}?>" id="wp99234-club_<?php echo str_replace(' ', '_', strtolower($membership_option->name));?>"> 202 203 <h5 class="wp99234-membership_option_title"><?php echo esc_html( $membership_option->name ); ?></h5> 204 205 <div class="wp99234-membership_option_details"> 206 207 <?php if ( !empty( $membership_option->description )) { ?> 208 <p class="wp99234-membership-description"><?php echo $membership_option->description; ?></p> 209 <?php } ?> 210 211 <?php if ( !empty( $membership_option->benefits )) { ?> 212 <p><a href="#" class="subs-toggle-member-benefits wp99234-membership_benefits_show">Additional benefits</a></p> 213 <div class="wp99234-membership_benefits"> 214 <h6 class="wp99234-membership_option_member_benefits_title">Member Benefits</h6> 215 <ul><li><?php echo implode("</li><li>",explode("\n",$membership_option->benefits)); ?></li></ul> 216 </div> 217 <?php } ?> 218 </div> 219 220 <?php 221 if($current_membership_id == $membership_option->id) { 222 echo '<div class="restricted wp99234_current_membership">You are currently a member of this club.</div>'; 223 } 224 if( isset( $membership_option->visibility) && $membership_option->visibility == 'public') { ?> 225 226 <input type="radio" class="selected_membership_radio" name="selected_membership" value="<?php echo $membership_option->id; ?>" <?php if($current_membership_id == $membership_option->id){echo 'checked="checked"';}?> /> 227 228 <button class="wp99234-selected_membership button" data-original_text="<?php _e( 'Select', 'wp99234' ); ?>" data-selected_text="<?php _e( 'Selected', 'wp99234' ); ?>" data-membership_option_id="<?php echo $membership_option->id; ?>" > 229 <?php if($current_membership_id == $membership_option->id){ _e( 'Selected', 'wp99234' );}else{ _e( 'Select', 'wp99234' );}?> 230 </button> 231 232 <!-- enable membership variations for variation membership only --> 233 <?php if( isset($membership_option->is_variation_membership) && $membership_option->is_variation_membership ): ?> 234 <!-- only selected variation will be set name to 'variation_id'. It will be passed to Troly for creating membership during submission --> 235 <select id="membership_option_<?php echo $membership_option->id ?>" class="membership_variation hide" name=""> 236 <option value='' disabled>Membership option</option> 237 <?php 238 foreach($membership_option->variations as $v_id => $v_name) { 239 echo "<option value=".$v_id.">".$v_name."</option>"; 240 } 241 ?> 242 </select> 243 <?php endif; ?> 244 245 <?php } else if ( isset( $membership_option->visibility ) && $membership_option->visibility == 'restricted' && $current_membership_id != $membership_option->id) { ?> 246 247 <div class="restricted">You cannot currently sign up for this membership. Please contact us for further information.</div> 248 249 <?php } ?> 250 251 </li> 252 253 <?php endforeach; ?> 254 255 </ul> 256 257 <h3 class="wp99234-section_title">Membership Details</h3> 258 259 <?php 260 $customer_tags = get_option('troly_customer_tags'); 261 $tag_ids_str = get_user_meta( $current_user->ID , 'tag_ids', true); 262 $tag_ids = explode(',', $tag_ids_str); 263 foreach($customer_tags as $id=>$tag) { 264 if (!$tag->is_public) { 265 unset($customer_tags[$id]); 266 } 267 } 268 if (!empty($customer_tags)): 269 ?> 270 <div class="wp99234-section chosen-preferences"> 271 <h4>Tell us about you</h4> 272 <ul class="tags"> 273 <?php foreach($customer_tags as $tag): ?> 274 <li class="tag <?= in_array($tag->id, $tag_ids) ? 'tag-selected' : ''; ?>" customer-tag="<?= $tag->id; ?>"> 275 <button class="button"><?= $tag->name; ?></button> 276 </li> 277 <?php endforeach; ?> 278 </ul> 279 <input type="hidden" name="tag_ids" id="tag_ids" value="<?= $tag_ids_str; ?>"> 280 </div> 281 <?php endif; ?> 282 283 <div class="wp99234-section user_details"> 284 285 <h4 class="wp99234-section_title"><?php _e( 'Your Details', 'wp99234' ); ?></h4> 286 287 <div class="wp99234-section_content"> 288 289 <?php 290 $user_fields = array( 291 'first_name' => array( 292 (get_option('wp99234_club_use_placeholders') == 'yes' ? 'placeholder' : 'label') => __( 'First Name', 'wp99234' ), 293 'default' => get_user_meta( $current_user->ID, 'first_name', true ), 294 'attributes' => array('required' => true, 'class' => 'wp99234-input_field_text input-text', 'id' => 'wp99234-registration_first_name') 295 ), 296 'last_name' => array( 297 (get_option('wp99234_club_use_placeholders') == 'yes' ? 'placeholder' : 'label') => __( 'Last Name', 'wp99234' ), 298 'default' => get_user_meta( $current_user->ID , 'last_name', true), 299 'attributes' => array('class' => 'wp99234-input_field_text input-text', 'id' => 'wp99234-registration_last_name' ), 300 ), 301 'reg_email' => array( 302 (get_option('wp99234_club_use_placeholders') == 'yes' ? 'placeholder' : 'label') => __( 'Email', 'wp99234' ), 303 'default' => ( $current_user ) ? $current_user->user_email : '' , 304 'attributes' => array('required' => true, 'class' => 'wp99234-input_field_text input-text', 'id' => 'wp99234-registration_email') 305 ), 306 'phone' => array( 307 (get_option('wp99234_club_use_placeholders') == 'yes' ? 'placeholder' : 'label') => __( 'Phone Number', 'wp99234' ), 308 'default' => get_user_meta( $current_user->ID , 'phone', true), 309 'attributes' => array('class' => 'wp99234-input_field_text input-text', 'id' => 'wp99234-registration_phone' ), 310 ), 311 'mobile' => array( 312 (get_option('wp99234_club_use_placeholders') == 'yes' ? 'placeholder' : 'label') => __( 'Mobile Number', 'wp99234' ), 313 'default' => get_user_meta( $current_user->ID , 'mobile', true), 314 'attributes' => array('class' => 'wp99234-input_field_text input-text', 'id' => 'wp99234-registration_mobile' ), 315 ), 316 ); 317 318 $legal_dob_club_option = get_option('wp99234_legal_dob_club'); 319 $isRequiredDOB = ($legal_dob_club_option == 'yes' || boolval($legal_dob_club_option)) ? true : false; 320 if ($legal_dob_club_option != "hidden") { 321 $user_fields['subs_birthday'] = array( 322 (get_option('wp99234_club_use_placeholders') == 'yes' ? 'placeholder' : 'label') => __( 'Date of Birth', 'wp99234' ), 323 'default' => get_user_meta( $current_user->ID , 'birthday', true), 324 'attributes' => array('class' => 'wp99234-input_field_text input-text', 'id' => 'wp99234-registration_birthday' ), 325 'attributes' => array('required' => $isRequiredDOB, 'id' => 'subs_birthday') 326 ); 327 } 328 329 foreach( $user_fields as $key => $user_field ){ 330 WP99234()->_registration->display_field( $key, $user_field ); 331 } 332 ?> 333 334 </div> 335 336 </div> 337 338 <div class="wp99234-section delivery_details"> 339 340 <h4 class="wp99234-section_title"><?php _e( 'Delivery Details', 'troly' ); ?></h4> 341 342 <div class="wp99234-section_content"> 343 344 <?php 345 $countries_obj = new WC_Countries(); 346 $countriesArray = $countries_obj->__get( 'countries' ); 347 348 $delivery_fields = array( 349 'company_name' => array( 350 (get_option('wp99234_club_use_placeholders') == 'yes' ? 'placeholder' : 'label') => __( 'Company Name (optional)', 'troly' ), 351 'default' => get_user_meta( $current_user->ID , 'shipping_company', true), 352 'attributes' => array('class' => 'wp99234-input_field_text input-text', 'id' => 'wp99234-registration_company_name' ), 353 ), 354 'shipping_address_1' => array( 355 (get_option('wp99234_club_use_placeholders') == 'yes' ? 'placeholder' : 'label') => __( 'Delivery Address', 'troly' ), 356 'default' => get_user_meta( $current_user->ID , 'shipping_address_1', true ), 357 'attributes' => array('required' => true, 'class' => 'wp99234-input_field_text input-text', 'id' => 'wp99234-registration_shipping_address_1' ) 358 ), 359 'shipping_suburb' => array( 360 (get_option('wp99234_club_use_placeholders') == 'yes' ? 'placeholder' : 'label') => __( 'Suburb', 'troly' ), 361 'default' => get_user_meta( $current_user->ID , 'shipping_city', true ), 362 'attributes' => array('required' => true, 'class' => 'wp99234-input_field_text input-text', 'id' => 'wp99234-registration_shipping_suburb') 363 ), 364 'shipping_postcode' => array( 365 (get_option('wp99234_club_use_placeholders') == 'yes' ? 'placeholder' : 'label') => __( 'Postcode', 'troly' ), 366 'default' => get_user_meta( $current_user->ID , 'shipping_postcode', true ), 367 'attributes' => array('required' => true, 'class' => 'wp99234-input_field_text input-text', 'id' => 'wp99234-registration_shipping_postcode') 368 ), 369 'shipping_country' => array( 370 (get_option('wp99234_club_use_placeholders') == 'yes' ? 'placeholder' : 'label') => __( 'Country', 'troly' ), 371 'default' => get_user_meta( $current_user->ID , 'shipping_country', true ), 372 'attributes' => array('required' => true, 'class' => 'wp99234-input_field_text input-text'), 373 'id' => 'troly_shipping_country', 374 'type' => 'select', 375 'options' => $countriesArray, 376 ), 377 'shipping_state' => array( 378 (get_option('wp99234_club_use_placeholders') == 'yes' ? 'placeholder' : 'label') => __( 'State', 'troly' ), 379 'default' => get_user_meta( $current_user->ID , 'shipping_state', true ), 380 'attributes' => array('required' => true, 'class' => 'wp99234-input_field_text input-text', 'id' => 'troly_shipping_state'), 381 ), 382 'shipping_instructions' => array( 383 'type' => 'textarea', 384 (get_option('wp99234_club_use_placeholders') == 'yes' ? 'placeholder' : 'label') => __( 'Delivery notes and instructions (optional)', 'troly' ), 385 'default' => get_user_meta( $current_user->ID, 'delivery_instructions', true), 386 'attributes' => array('class' => 'wp99234-input_field_textfield input-text', 'id' => 'wp99234-registration_shipping_instructions') 387 ) 388 ); 389 390 foreach( $delivery_fields as $key => $delivery_field ){ 391 WP99234()->_registration->display_field( $key, $delivery_field ); 392 } 393 394 if(!is_user_logged_in()){ 395 echo '<div id="wp99234-create_password_section">'; 396 ?> 397 <h4 class="wp99234-section_title"><?php _e( 'Create Password', 'wp99234' ); ?></h4> 398 <?php 399 $pass_fields = array( 400 'user_pass' => array( 401 (get_option('wp99234_club_use_placeholders') == 'yes' ? 'placeholder' : 'label') => __( 'Password', 'wp99234' ), 402 'type' => 'password' , 403 'id' => 'password' , 404 'default' => '', 405 'attributes' => array('required' => true, 'class' => 'wp99234-input_field_text') 406 ), 407 'conf_pass' => array( 408 (get_option('wp99234_club_use_placeholders') == 'yes' ? 'placeholder' : 'label') => __( 'Confirm Password', 'wp99234' ), 409 'type' => 'password' , 410 'id' => 'confirm_password' , 411 'default' => '', 412 'attributes' => array('required' => true, 'class' => 'wp99234-input_field_password') 413 ) 414 ); 415 foreach( $pass_fields as $key => $pass_field ){ 416 WP99234()->_registration->display_field( $key, $pass_field ); 417 } 418 echo '</div>'; 419 } 420 ?> 421 </div> 422 423 </div> 424 425 <div class="wp99234-section cc_details"> 426 427 <h4 class="wp99234-section_title"><?php _e( 'Payment Details', 'wp99234' ); ?></h4> 428 429 <div class="wp99234-section_content"> 430 431 <?php 432 433 $cc_fields = array( 434 'cc_name' => array( 435 (get_option('wp99234_club_use_placeholders') == 'yes' ? 'placeholder' : 'label') => __( 'Cardholder Name', 'wp99234' ), 436 'default' => '', 437 'attributes' => array('required' => true, 'autocomplete' => 'cc-name') 438 ), 439 'cc_number' => array( 440 (get_option('wp99234_club_use_placeholders') == 'yes' ? 'placeholder' : 'label') => __( 'Card Number', 'wp99234' ), 441 'default' =>'', 442 'attributes' => array( 443 'required' => true, 444 'class' => 'woocommerce-Input input-text', 445 'placeholder' => "•••• •••• •••• ••••", 446 'maxlength' => 19, 447 'type'=> 'tel', 448 'inputmode'=> 'numeric', 449 'autocomplete' => 'cc-number' 450 ) 451 ), 452 'cc_exp' => array( 453 (get_option('wp99234_club_use_placeholders') == 'yes' ? 'placeholder' : 'label') => __( 'Card Expiry Date', 'wp99234' ), 454 'default' => '' , 455 'attributes' => array( 456 'placeholder' => 'MM / YYYY', 457 'required' => true, 458 'autocomplete' => 'cc-exp' 459 ), 460 ), 461 'cc_cvv' => array( 462 (get_option('wp99234_club_use_placeholders') == 'yes' ? 'placeholder' : 'label') => __( 'Card code', 'wp99234' ), 463 'default' => '' , 464 'attributes' => array( 465 'placeholder' => 'CVC', 466 'required' => true, 467 'autocomplete' => 'cc-cvv' 468 ), 469 ) 470 ); 471 472 $has_cc_details = false; 473 474 if( is_user_logged_in() ){ 475 $has_cc_meta = get_user_meta( get_current_user_id(), 'has_subs_cc_data', true ); 476 if( $has_cc_meta && $has_cc_meta == true ){ 477 $has_cc_details = true; 478 } 479 } 480 481 if( $has_cc_details ){ 482 echo '<div><input type="checkbox" id="wp99234_use_existing_card" name="wp99234_use_existing_card" checked="checked" value="yes" style="width:auto;display:inline-block;"/> ' . sprintf( '<label for="wp99234_use_existing_card" style="width:auto;display:inline-block;vertical-align:middle;margin-bottom:0;margin-left:5px;">Use existing card (%s)</label></div>', get_user_meta( get_current_user_id(), 'cc_number', true ) ); 483 echo '<div id="hidden_cc_form"><br /><p>' . __( 'Card details entered here will be stored securely for future use.', 'wp99234' ) . '</p>'; 484 } 485 486 foreach( $cc_fields as $key => $cc_field ){ 487 $css_class = null; 488 if ($key === 'cc_exp') $css_class = 'form-row-first woocommerce-validated'; 489 if ($key === 'cc_cvv') $css_class = 'form-row-last woocommerce-validated'; 490 WP99234()->_registration->display_field( $key, $cc_field, $css_class ); 491 } 492 493 if( $has_cc_details ){ 494 echo '</div>'; 495 } 496 497 ?> 498 499 </div> 500 501 </div> 502 503 <?php 504 do_action('wp99234_preferences_form'); 505 ?> 506 507 </div> 508 509 <p class="form-submit form-row"> 510 <label id='message'></label> 511 <input type="hidden" name="<?php echo WP99234()->_registration->nonce_name; ?>" value="<?php echo wp_create_nonce( WP99234()->_registration->nonce_action ); ?>" /> 512 <input class="button" type="submit" name="<?php echo WP99234()->_registration->submit_name; ?>" value="<?php _e( 'Sign Up Now', 'wp99234' ); ?>" id="wp99234_member_submit" /> 513 </p> 514 515 </form> 206 $customer_tags = get_option('troly_customer_tags'); 207 $tag_ids_str = get_user_meta( $current_user->ID , 'tag_ids', true); 208 $tag_ids = explode(',', $tag_ids_str); 209 foreach($customer_tags as $id=>$tag) { 210 if (!$tag->is_public) { 211 unset($customer_tags[$id]); 212 } 213 } 214 if (!empty($customer_tags)): 215 ?> 216 <div class="wp99234-section chosen-preferences"> 217 <h4>Tell us about you</h4> 218 <ul class="tags"> 219 <?php foreach($customer_tags as $tag): ?> 220 <li class="tag <?= in_array($tag->id, $tag_ids) ? 'tag-selected' : ''; ?>" customer-tag="<?= $tag->id; ?>"> 221 <button class="button"><?= $tag->name; ?></button> 222 </li> 223 <?php endforeach; ?> 224 </ul> 225 <input type="hidden" name="tag_ids" id="tag_ids" value="<?= $tag_ids_str; ?>"> 226 </div> 227 <?php endif; ?> 228 229 <div class="wp99234-section user_details"> 230 231 <h4 class="wp99234-section_title"><?php _e( 'Your Details', 'wp99234' ); ?></h4> 232 233 <div class="wp99234-section_content"> 234 235 <?php 236 $user_fields = array( 237 'first_name' => array( 238 (get_option('wp99234_club_use_placeholders') == 'yes' ? 'placeholder' : 'label') => __( 'First Name', 'wp99234' ), 239 'default' => get_user_meta( $current_user->ID, 'first_name', true ), 240 'attributes' => array('required' => true, 'class' => 'wp99234-input_field_text input-text', 'id' => 'wp99234-registration_first_name') 241 ), 242 'last_name' => array( 243 (get_option('wp99234_club_use_placeholders') == 'yes' ? 'placeholder' : 'label') => __( 'Last Name', 'wp99234' ), 244 'default' => get_user_meta( $current_user->ID , 'last_name', true), 245 'attributes' => array('class' => 'wp99234-input_field_text input-text', 'id' => 'wp99234-registration_last_name' ), 246 ), 247 'reg_email' => array( 248 (get_option('wp99234_club_use_placeholders') == 'yes' ? 'placeholder' : 'label') => __( 'Email', 'wp99234' ), 249 'default' => ( $current_user ) ? $current_user->user_email : '' , 250 'attributes' => array('required' => true, 'class' => 'wp99234-input_field_text input-text', 'id' => 'wp99234-registration_email') 251 ), 252 'phone' => array( 253 (get_option('wp99234_club_use_placeholders') == 'yes' ? 'placeholder' : 'label') => __( 'Phone Number', 'wp99234' ), 254 'default' => get_user_meta( $current_user->ID , 'phone', true), 255 'attributes' => array('class' => 'wp99234-input_field_text input-text', 'id' => 'wp99234-registration_phone' ), 256 ), 257 'mobile' => array( 258 (get_option('wp99234_club_use_placeholders') == 'yes' ? 'placeholder' : 'label') => __( 'Mobile Number', 'wp99234' ), 259 'default' => get_user_meta( $current_user->ID , 'mobile', true), 260 'attributes' => array('class' => 'wp99234-input_field_text input-text', 'id' => 'wp99234-registration_mobile' ), 261 ), 262 ); 263 264 $legal_dob_club_option = get_option('wp99234_legal_dob_club'); 265 $isRequiredDOB = ($legal_dob_club_option == 'yes' || boolval($legal_dob_club_option)) ? true : false; 266 if ($legal_dob_club_option != "hidden") { 267 $user_fields['subs_birthday'] = array( 268 (get_option('wp99234_club_use_placeholders') == 'yes' ? 'placeholder' : 'label') => __( 'Date of Birth', 'wp99234' ), 269 'default' => get_user_meta( $current_user->ID , 'birthday', true), 270 'attributes' => array('class' => 'wp99234-input_field_text input-text', 'id' => 'wp99234-registration_birthday' ), 271 'attributes' => array('required' => $isRequiredDOB, 'id' => 'subs_birthday') 272 ); 273 } 274 275 foreach( $user_fields as $key => $user_field ){ 276 WP99234()->_registration->display_field( $key, $user_field ); 277 } 278 ?> 279 280 </div> 281 282 </div> 283 284 <div class="wp99234-section delivery_details"> 285 286 <h4 class="wp99234-section_title"><?php _e( 'Delivery Details', 'troly' ); ?></h4> 287 288 <div class="wp99234-section_content"> 289 290 <?php 291 $countries_obj = new WC_Countries(); 292 $countriesArray = $countries_obj->__get( 'countries' ); 293 294 $delivery_fields = array( 295 'company_name' => array( 296 (get_option('wp99234_club_use_placeholders') == 'yes' ? 'placeholder' : 'label') => __( 'Company Name (optional)', 'troly' ), 297 'default' => get_user_meta( $current_user->ID , 'shipping_company', true), 298 'attributes' => array('class' => 'wp99234-input_field_text input-text', 'id' => 'wp99234-registration_company_name' ), 299 ), 300 'shipping_address_1' => array( 301 (get_option('wp99234_club_use_placeholders') == 'yes' ? 'placeholder' : 'label') => __( 'Delivery Address', 'troly' ), 302 'default' => get_user_meta( $current_user->ID , 'shipping_address_1', true ), 303 'attributes' => array('required' => true, 'class' => 'wp99234-input_field_text input-text', 'id' => 'wp99234-registration_shipping_address_1' ) 304 ), 305 'shipping_suburb' => array( 306 (get_option('wp99234_club_use_placeholders') == 'yes' ? 'placeholder' : 'label') => __( 'Suburb', 'troly' ), 307 'default' => get_user_meta( $current_user->ID , 'shipping_city', true ), 308 'attributes' => array('required' => true, 'class' => 'wp99234-input_field_text input-text', 'id' => 'wp99234-registration_shipping_suburb') 309 ), 310 'shipping_postcode' => array( 311 (get_option('wp99234_club_use_placeholders') == 'yes' ? 'placeholder' : 'label') => __( 'Postcode', 'troly' ), 312 'default' => get_user_meta( $current_user->ID , 'shipping_postcode', true ), 313 'attributes' => array('required' => true, 'class' => 'wp99234-input_field_text input-text', 'id' => 'wp99234-registration_shipping_postcode') 314 ), 315 'shipping_country' => array( 316 (get_option('wp99234_club_use_placeholders') == 'yes' ? 'placeholder' : 'label') => __( 'Country', 'troly' ), 317 'default' => get_user_meta( $current_user->ID , 'shipping_country', true ), 318 'attributes' => array('required' => true, 'class' => 'wp99234-input_field_text input-text'), 319 'id' => 'troly_shipping_country', 320 'type' => 'select', 321 'options' => $countriesArray, 322 ), 323 'shipping_state' => array( 324 (get_option('wp99234_club_use_placeholders') == 'yes' ? 'placeholder' : 'label') => __( 'State', 'troly' ), 325 'default' => get_user_meta( $current_user->ID , 'shipping_state', true ), 326 'attributes' => array('required' => true, 'class' => 'wp99234-input_field_text input-text', 'id' => 'troly_shipping_state'), 327 ), 328 'shipping_instructions' => array( 329 'type' => 'textarea', 330 (get_option('wp99234_club_use_placeholders') == 'yes' ? 'placeholder' : 'label') => __( 'Delivery notes and instructions (optional)', 'troly' ), 331 'default' => get_user_meta( $current_user->ID, 'delivery_instructions', true), 332 'attributes' => array('class' => 'wp99234-input_field_textfield input-text', 'id' => 'wp99234-registration_shipping_instructions') 333 ) 334 ); 335 336 foreach( $delivery_fields as $key => $delivery_field ){ 337 WP99234()->_registration->display_field( $key, $delivery_field ); 338 } 339 340 if(!is_user_logged_in()){ 341 echo '<div id="wp99234-create_password_section">'; 342 ?> 343 <h4 class="wp99234-section_title"><?php _e( 'Create Password', 'wp99234' ); ?></h4> 344 <?php 345 $pass_fields = array( 346 'user_pass' => array( 347 (get_option('wp99234_club_use_placeholders') == 'yes' ? 'placeholder' : 'label') => __( 'Password', 'wp99234' ), 348 'type' => 'password' , 349 'id' => 'password' , 350 'default' => '', 351 'attributes' => array('required' => true, 'class' => 'wp99234-input_field_text') 352 ), 353 'conf_pass' => array( 354 (get_option('wp99234_club_use_placeholders') == 'yes' ? 'placeholder' : 'label') => __( 'Confirm Password', 'wp99234' ), 355 'type' => 'password' , 356 'id' => 'confirm_password' , 357 'default' => '', 358 'attributes' => array('required' => true, 'class' => 'wp99234-input_field_password') 359 ) 360 ); 361 foreach( $pass_fields as $key => $pass_field ){ 362 WP99234()->_registration->display_field( $key, $pass_field ); 363 } 364 echo '</div>'; 365 } 366 ?> 367 </div> 368 369 </div> 370 371 <div class="wp99234-section cc_details"> 372 373 <h4 class="wp99234-section_title"><?php _e( 'Payment Details', 'wp99234' ); ?></h4> 374 375 <div class="wp99234-section_content"> 376 377 <?php 378 379 $cc_fields = array( 380 'cc_name' => array( 381 (get_option('wp99234_club_use_placeholders') == 'yes' ? 'placeholder' : 'label') => __( 'Cardholder Name', 'wp99234' ), 382 'default' => '', 383 'attributes' => array('required' => true, 'autocomplete' => 'cc-name') 384 ), 385 'cc_number' => array( 386 (get_option('wp99234_club_use_placeholders') == 'yes' ? 'placeholder' : 'label') => __( 'Card Number', 'wp99234' ), 387 'default' =>'', 388 'attributes' => array( 389 'required' => true, 390 'class' => 'woocommerce-Input input-text', 391 'placeholder' => "•••• •••• •••• ••••", 392 'maxlength' => 19, 393 'type'=> 'tel', 394 'inputmode'=> 'numeric', 395 'autocomplete' => 'cc-number' 396 ) 397 ), 398 'cc_exp' => array( 399 (get_option('wp99234_club_use_placeholders') == 'yes' ? 'placeholder' : 'label') => __( 'Expiry Date', 'wp99234' ), 400 'default' => '' , 401 'attributes' => array( 402 'placeholder' => 'MM / YYYY', 403 'required' => true, 404 'autocomplete' => 'cc-exp' 405 ), 406 ), 407 'cc_cvv' => array( 408 (get_option('wp99234_club_use_placeholders') == 'yes' ? 'placeholder' : 'label') => __( 'Card code', 'wp99234' ), 409 'default' => '' , 410 'attributes' => array( 411 'placeholder' => 'CVC', 412 'required' => true, 413 'autocomplete' => 'cc-cvv' 414 ), 415 ) 416 ); 417 418 $has_cc_details = false; 419 420 if( is_user_logged_in() ){ 421 $has_cc_meta = get_user_meta( get_current_user_id(), 'has_subs_cc_data', true ); 422 if( $has_cc_meta && $has_cc_meta == true ){ 423 $has_cc_details = true; 424 } 425 } 426 427 if( $has_cc_details ){ 428 echo '<div><input type="checkbox" id="wp99234_use_existing_card" name="wp99234_use_existing_card" checked="checked" value="yes" style="width:auto;display:inline-block;"/> ' . sprintf( '<label for="wp99234_use_existing_card" style="width:auto;display:inline-block;vertical-align:middle;margin-bottom:0;margin-left:5px;">Use existing card (%s)</label></div>', get_user_meta( get_current_user_id(), 'cc_number', true ) ); 429 echo '<div id="hidden_cc_form"><br /><p>' . __( 'Card details entered here will be stored securely for future use.', 'wp99234' ) . '</p>'; 430 } 431 432 foreach( $cc_fields as $key => $cc_field ){ 433 $css_class = null; 434 if ($key === 'cc_exp') $css_class = 'form-row-first woocommerce-validated'; 435 if ($key === 'cc_cvv') $css_class = 'form-row-last woocommerce-validated'; 436 WP99234()->_registration->display_field( $key, $cc_field, $css_class ); 437 } 438 439 if( $has_cc_details ){ 440 echo '</div>'; 441 } 442 443 ?> 444 445 </div> 446 447 </div> 448 449 <?php 450 do_action('wp99234_preferences_form'); 451 ?> 452 453 </div> 454 455 <p class="form-submit form-row"> 456 <label id='message'></label> 457 <input type="hidden" name="<?php echo WP99234()->_registration->nonce_name; ?>" value="<?php echo wp_create_nonce( WP99234()->_registration->nonce_action ); ?>" /> 458 <input class="button" type="submit" name="<?php echo WP99234()->_registration->submit_name; ?>" value="<?php _e( 'Sign Up Now', 'wp99234' ); ?>" id="wp99234_member_submit" /> 459 </p> 460 461 </form> 462 </div> 516 463 <?php 517 464 $limit = (int)(get_option('wp99234_legal_drinking_age')); … … 519 466 ?> 520 467 <script type="text/javascript"> 521 jQuery(document).ready(function($) {522 $("#subs_birthday").datepicker({523 maxDate: '-<?php echo $limit; ?>',524 changeYear: true,525 changeMonth: true,526 minDate: '-105y',468 jQuery(document).ready(function($) { 469 $("#subs_birthday").datepicker({ 470 maxDate: '-<?php echo $limit; ?>', 471 changeYear: true, 472 changeMonth: true, 473 minDate: '-105y', 527 474 yearRange: '<?php echo ($year - 105) . ':' . ($year - $limit); ?>', 528 475 defaultDate: '<?php echo date('F') . ' ' . date('d') . ', ' . ($year - $limit); ?>', 529 476 }); 530 477 531 $('#wp99234_member_registration_form .tags .tag').click(function(e) {532 e.preventDefault();533 if ($(this).hasClass('tag-selected')) {534 $(this).removeClass('tag-selected');535 } else {536 $(this).addClass('tag-selected');537 }538 var tag_ids = [];539 $('#wp99234_member_registration_form .tag').each(function(i, row) {540 if ($(row).hasClass('tag-selected')) {541 tag_ids.push($(row).attr('customer-tag'));542 }543 });544 $('#tag_ids').val(tag_ids);478 $('#wp99234_member_registration_form .tags .tag').click(function(e) { 479 e.preventDefault(); 480 if ($(this).hasClass('tag-selected')) { 481 $(this).removeClass('tag-selected'); 482 } else { 483 $(this).addClass('tag-selected'); 484 } 485 var tag_ids = []; 486 $('#wp99234_member_registration_form .tag').each(function(i, row) { 487 if ($(row).hasClass('tag-selected')) { 488 tag_ids.push($(row).attr('customer-tag')); 489 } 490 }); 491 $('#tag_ids').val(tag_ids); 545 492 }); 546 493 … … 549 496 550 497 $('input[name=cc_number]').on( 'blur', function(){ 551 if( ! jQuery.payment.validateCardNumber( $( this ).val() ) ){498 if( ! jQuery.payment.validateCardNumber( $( this ).val() ) ){ 552 499 $( this ).addClass( 'invalid' ) 553 } else {500 } else { 554 501 $( this ).removeClass( 'invalid' ) 555 } 556 }); 502 } 503 }); 504 505 $( '#troly_shipping_country' ).selectWoo({ 506 width: '100%', 507 height: '350px' 508 }) 557 509 }); 558 510 </script> -
subscribility/tags/2.9.19.5/readme.txt
r2333978 r2370819 4 4 Requires at least: 4.9.0 5 5 Tested up to: 5.4.2 6 Stable Tag: 2.9.19. 46 Stable Tag: 2.9.19.5 7 7 PHP version: 7.0 and above 8 8 License: GPLv2 or later … … 70 70 71 71 ## Changelog 72 ###Version 2.9.19.5 73 - Bug fixed with payment processing with external payment gateways. 74 - Improved plugin stability and other bugs fixed. 75 72 76 ###Version 2.9.19.4 73 77 - Added plugin action links for Settings and plugin documentation. -
subscribility/tags/2.9.19.5/wp99234.php
r2333978 r2370819 4 4 * Plugin URI: https://wordpress.org/plugins/subscribility/ 5 5 * Description: Manage and fulfil your sales of wine, beers and other crafted beverages, through clubs and other direct-to-consumer sales channels. 6 * Version: 2.9.19. 46 * Version: 2.9.19.5 7 7 * Author: Troly 8 8 * Author URI: https://troly.io … … 280 280 include_once( 'includes/frontend/controllers/class-wp99234-template.php' ); 281 281 include_once( 'includes/frontend/controllers/class-wp99234-themes-footer.php' ); 282 282 283 283 include_once( 'includes/frontend/controllers/class-wp99234-customer-controller.php' ); 284 284 include_once( 'includes/frontend/controllers/class-wp99234-order-controller.php' ); -
subscribility/trunk/includes/admin/assets/css/wp99234-admin.css
r2333850 r2370819 479 479 } 480 480 .troly_log_table td span { 481 width: 80px;481 width: 90px; 482 482 height: 25px; 483 483 display: inline-block; -
subscribility/trunk/includes/frontend/assets/css/wp99234_frontend.css
r2319969 r2370819 137 137 } 138 138 .woocommerce .woocommerce-form .password-input .show-password-input { 139 position: absolute;140 right: .7em;141 top: 0;142 139 cursor: pointer; 143 140 text-decoration: none; … … 164 161 } 165 162 163 #wp99234_membership_options { 164 display: grid; 165 grid-template-columns: repeat(2, 1fr); 166 } 167 #wp99234_membership_options .wp99234-membership_option { 168 list-style: none; 169 border:1px solid transparent; 170 padding:20px; 171 width: 100%; 172 margin: 0; 173 } 174 #wp99234_membership_options .wp99234-membership_option.selected { 175 border-color: #CCC; 176 } 177 #wp99234_membership_options .wp99234-membership_option.inactive { 178 opacity: 0.6; 179 } 180 166 181 /* @todo: Dumped styling from Patina. Needs to be amended. */ 167 #wp99234_member_registration_form .wp99234-membership_option {168 width: 44% !important;169 }170 171 #wp99234_member_registration_form .wp99234-membership_option:nth-child(2n) {172 margin-left: 2% !important;173 }174 175 #wp99234_member_registration_form .wp99234-membership_option_title {176 color: inherit;177 }178 179 #wp99234_member_registration_form .wp99234-input_field_text,180 #wp99234_member_registration_form #subs_birthday,181 #wp99234_member_registration_form .cc_details input,182 #wp99234_member_registration_form .wp99234-input_field_password {183 border: none !important;184 padding: 15px 13px;185 }186 187 #wp99234_member_registration_form .wp99234-section_title {188 color: inherit !important;189 text-align: left !important;190 }191 192 #wp99234_member_registration_form p.form-row {193 text-align: left !important;194 padding-top: 5px;195 padding-bottom: 5px;196 }197 198 182 #wp99234_member_registration_form .wp99234-section.chosen-preferences { 199 183 padding-bottom: 15px; … … 215 199 } 216 200 217 #wp99234_member_registration_form #wp99234_member_submit,218 .wp99234-selected_membership {219 color: #ffffff;220 font-family: 'Raleway', sans-serif;221 font-size: 11px;222 height: 45px;223 font-style: normal;224 font-weight: 700;225 background-color: #a05f42;226 -webkit-border-radius: 1px;227 letter-spacing: 1px;228 text-transform: uppercase;229 border-width: 0px;230 }231 232 #wp99234-registration_shipping_instructions {233 border: none !important;234 }235 236 201 #wp99234_member_registration_form .form-submit.form-row { 237 202 text-align: center !important; 238 203 } 239 204 240 .form-row.shipping_instructions { 241 width: 105% !important; 205 #wp99234_member_registration_form .select2-container--default .select2-selection--single { 206 height: 48px !important; 207 } 208 #wp99234_member_registration_form .select2-container--default .select2-selection--single .select2-selection__rendered { 209 line-height: 48px; 210 } 211 #wp99234_member_registration_form .select2-container--default .select2-selection--single .select2-selection__arrow { 212 height: 46px; 242 213 } 243 214 … … 247 218 } 248 219 249 #wp99234-registration_shipping_instructions {250 height: 115px;251 }252 253 220 #order_review table.shop_table.woocommerce-checkout-review-order-table-bak { 254 221 width: 50% !important; … … 256 223 } 257 224 258 #wc-wp99234_payment_gateway-cc-form input.input-text { 259 width: 98%; 260 } 261 262 263 #wp99234_member_registration_form .wp99234-membership_option:nth-child(2n) { 264 margin-bottom: 30px; 265 } 266 267 @media (min-width: 320px) { 268 #wp99234_member_registration_form .wp99234-membership_option { 269 width: 90% !important; 270 margin-left: 0; 271 } 272 273 #wp99234_member_registration_form .wp99234-membership_option:nth-child(2n) { 274 margin-left: 0 !important; 275 } 276 } 277 278 @media (min-width: 992px) { 279 #wp99234_member_registration_form .wp99234-membership_option { 280 width: 44% !important; 281 } 282 283 #wp99234_member_registration_form .wp99234-membership_option:nth-child(2n) { 284 margin-left: 15px !important; 285 } 286 } 225 .wp99234-input_field_text.input-text { 226 width: 100%; 227 font-size: 1.6rem; 228 padding: 1.5rem 1.8rem; 229 } -
subscribility/trunk/includes/frontend/assets/js/wp99234_frontend.js
r2319969 r2370819 97 97 $("#hidden_cc_form :input").attr('required', '1'); 98 98 } 99 }); 99 }); 100 101 /** 102 * Hide shipping calculator, shipping form if local pickup is pre-selected. 103 */ 104 if ( $( 'input[type=radio].shipping_method:checked' ).length > 0 && $( 'input[type=radio].shipping_method:checked' ).val().indexOf( 'local_pickup' ) >= 0 ) { 105 $( '.woocommerce-shipping-destination, .woocommerce-shipping-calculator, .woocommerce-shipping-fields, #order_comments_field' ).hide() 106 } 107 108 /** 109 * Hide shipping calculator, shipping form if local pickup is selected. 110 */ 111 $( 'body' ).on( 'click', 'input[type=radio].shipping_method', function() { 112 const method = $(this).val() 113 114 // Only trigger it once all the AJAX has stopped. 115 $( document ).ajaxStop( function() { 116 if ( method.indexOf( 'local_pickup' ) >= 0 ) { 117 $( '.woocommerce-shipping-destination, .woocommerce-shipping-calculator, .woocommerce-shipping-fields, #order_comments_field' ).hide() 118 } else { 119 $( '.woocommerce-shipping-destination, .woocommerce-shipping-calculator, .woocommerce-shipping-fields, #order_comments_field' ).show() 120 } 121 }); 122 }) 100 123 }); -
subscribility/trunk/includes/frontend/controllers/class-wp99234-forms.php
r2333850 r2370819 143 143 function display_field($key, $field, $css_class = null) { 144 144 $type = (isset($field['type']))?$field['type']:'text'; 145 $isRequired = isset( $field['attributes']['required'] ) ?? false; 145 146 146 147 ?> 147 148 <p class="form-row <?php echo $key . ' ' . $css_class;?>"> 148 149 <?php /*if ( isset( $this->errors[ $key ] ) ): ?>150 <p class="error">151 <?php echo esc_html( $this->errors[ $key ] ); ?>152 </p>153 <?php endif;*/?>154 149 155 150 <?php … … 166 161 <label for="<?php echo $key;?>"> 167 162 <?php echo $field['label'];?> 163 <?php echo $isRequired ? '<abbr class="required" title="required">*</abbr>' : ''; ?> 168 164 </label> 169 165 <?php -
subscribility/trunk/includes/frontend/controllers/class-wp99234-order-controller.php
r2333875 r2370819 26 26 $this->_orderData[ 'order' ] = [ 27 27 'source' => 'web', 28 'status' => ' draft', // Why are these draft orders?28 'status' => 'confirmed', 29 29 'fname' => $this->_order->get_billing_first_name(), 30 30 'lname' => $this->_order->get_billing_last_name(), … … 106 106 'shipment' => [ 107 107 'name' => $this->_order->get_shipping_first_name() . ' ' . $this->_order->get_shipping_last_name(), 108 'delivery_address' => $this->_order->get_shipping_address_1(), 109 'delivery_suburb' => $this->_order->get_shipping_city(), 110 'delivery_postcode' => $this->_order->get_shipping_postcode(), 111 'delivery_state' => $this->_order->get_shipping_state(), 112 'delivery_country' => WC()->countries->countries[ $this->_order->get_shipping_country() ], 113 'same_billing' => false, 108 114 ] 109 ] );110 111 WP99234()->_customer->updateCustomerData( [112 'delivery_address' => $this->_order->get_shipping_address_1(),113 'delivery_suburb' => $this->_order->get_shipping_city(),114 'delivery_postcode' => $this->_order->get_shipping_postcode(),115 'delivery_state' => $this->_order->get_shipping_state(),116 'delivery_country' => WC()->countries->countries[ $this->_order->get_shipping_country() ],117 'same_billing' => false,118 115 ] ); 119 116 -
subscribility/trunk/includes/frontend/controllers/class-wp99234-wc-filter.php
r2333850 r2370819 98 98 add_action( 'woocommerce_check_cart_items', [$this, 'wp99234_enforce_minimum_quantity'], 10 ); 99 99 add_action( 'woocommerce_cart_calculate_fees', [$this, 'wp99234_add_cart_fees'], 10, 1 ); 100 add_action( 'troly_order_status_check', [$this, 'check_wp99234_payment_status' ], 10, 1 );101 add_action( 'woocommerce_order_status_cancelled' , [$this, 'removeOrderStatusCheckCRON'], 10 );100 //add_action( 'troly_order_status_check', [$this, 'check_wp99234_payment_status' ], 10, 1 ); 101 //add_action( 'woocommerce_order_status_cancelled' , [$this, 'removeOrderStatusCheckCRON'], 10 ); 102 102 add_filter( 'woocommerce_is_purchasable', [$this, 'restrictMembersOnlyProducts'], 20, 2 ); 103 103 add_filter( 'woocommerce_post_class', [$this, 'addMembersOnlyClass'], 20, 2 ); 104 104 add_filter( 'woocommerce_login_redirect', [$this, 'trolySourceRedirect'], 10, 2 ); 105 add_action( 'woocommerce_order_status_processing', [$this, 'exportPaymentToSubs' ], 10, 1 ); 106 } 107 108 /** 109 * Send payment information to Troly once an order is paid or refunded 110 * in WordPress that does not use the Troly gateway. 111 * 112 * @param int $orderID 113 * @return void 114 */ 115 public function exportPaymentToSubs( $orderID ) { 116 WP99234()->_woocommerce->export_payment( $orderID ); 105 117 } 106 118 … … 134 146 public function addMembersOnlyClass( $classes, $product ) 135 147 { 136 if ( has_term( ' visible-to-members-only', 'product_tag', $product->get_id() ) ) {148 if ( has_term( 'purchase-by-members-only', 'product_tag', $product->get_id() ) ) { 137 149 $classes[] = 'membersonly'; 138 150 } … … 180 192 public function restrictMembersOnlyProducts( $isPurchaseable, $product ) 181 193 { 182 if ( has_term( ' visible-to-members-only', 'product_tag', $product->get_id() ) ) {194 if ( has_term( 'purchase-by-members-only', 'product_tag', $product->get_id() ) ) { 183 195 184 196 if ( is_user_logged_in() ) { … … 1466 1478 * @todo Using this here but not certain. Triggering the callback cron for Troly. 1467 1479 */ 1468 if ( ! wp_next_scheduled( 'troly_order_status_check' ) ) {1469 wp_schedule_event( time(), '15_seconds', 'troly_order_status_check', [ $order_id ] );1470 }1480 //if ( ! wp_next_scheduled( 'troly_order_status_check' ) ) { 1481 // wp_schedule_event( time(), '15_seconds', 'troly_order_status_check', [ $order_id ] ); 1482 //} 1471 1483 1472 1484 if ( isset( $response->id ) ) { … … 1594 1606 * @throws Exception 1595 1607 */ 1596 public function export_payment( $order_id ) { 1597 1598 $order = wc_get_order($order_id); 1599 1600 $subs_id = get_post_meta( $order_id, 'subs_id', true ); 1601 $trx_id = $order->get_transaction_id(); 1602 1603 WP99234()->logger->notice("Processing $subs_id"); 1604 1605 $mtype = $order->get_payment_method(); 1606 WP99234()->logger->notice("Attempting to export a payment for $order_id (Troly ID $subs_id) with $mtype (TRXID $trx_id) as payment"); 1607 1608 switch($mtype){ 1609 case 'cod': 1610 $mtype = 'cash'; 1611 break; 1612 case 'bacs': 1613 $mtype = 'transfer'; 1614 break; 1615 default: 1616 $mtype = $mtype; 1617 break; 1618 } 1619 1620 # We set rrn to allow Stream objects to show reference 1621 # This will also be set on the Payment object as well 1622 $pay_data = array( 1623 'order' => array ( 1624 'id' => $subs_id, 1625 // 'payment_type' => 'offline', 1626 'payment_meth' => 'website', 1627 'payment_src' => $mtype, 1628 'status' => 'confirmed' , 1629 'rrn' => $trx_id 1630 ), 1631 'id' => $subs_id 1632 ); 1633 1634 $response = WP99234()->_api->_call( $this->payment_api_endpoint.$subs_id, $pay_data, 'PUT' ); 1635 1636 if( isset( $response->channel ) ){ 1637 $order->add_order_note( 'Exported payment information to Troly' ); 1638 WP99234()->logger->notice("Succeeded exporting payment for $order_id (Troly ID $subs_id) with $mtype as payment"); 1639 return true; 1640 } else { 1641 $order->add_order_note( 'Could not export payment information to Troly' ); 1642 WP99234()->logger->notice("Failed exporting payment for $order_id (Troly ID $subs_id) with $mtype as payment"); 1643 throw new \Exception( __( 'An error has occurred. Please get in touch with us as soon as possible.', 'wp99234' ) ); 1608 public function export_payment( $order_id ) 1609 { 1610 $order = wc_get_order($order_id); 1611 $subs_id = get_post_meta( $order_id, 'subs_id', true ); 1612 $trx_id = $order->get_transaction_id(); 1613 $mtype = $order->get_payment_method(); 1614 1615 // Do not trigger this for Troly payment gateway. 1616 if ( 'wp99234_payment_gateway' !== $mtype ) { 1617 WP99234()->logger->notice("Processing $subs_id"); 1618 WP99234()->logger->notice("Attempting to export a payment for $order_id (Troly ID $subs_id) with $mtype (TRXID $trx_id) as payment"); 1619 1620 switch($mtype){ 1621 case 'bacs': 1622 $mtype = 'transfer'; 1623 break; 1624 default: 1625 $mtype = $mtype; 1626 break; 1627 } 1628 1629 # We set rrn to allow Stream objects to show reference 1630 # This will also be set on the Payment object as well 1631 $pay_data = [ 1632 'order' => [ 1633 'id' => $subs_id, 1634 'payment_type' => 'offline', 1635 'payment_meth' => 'website', 1636 'payment_src' => $mtype, 1637 'status' => 'confirmed' , 1638 'rrn' => $trx_id 1639 ], 1640 'id' => $subs_id 1641 ]; 1642 1643 $response = WP99234()->_api->_call( $this->payment_api_endpoint.$subs_id, $pay_data, 'PUT' ); 1644 1645 if ( isset( $response->channel ) ) { 1646 $order->add_order_note( 'Exported payment information to Troly' ); 1647 WP99234()->logger->notice("Succeeded exporting payment for $order_id (Troly ID $subs_id) with $mtype as payment"); 1648 return true; 1649 } else { 1650 $order->add_order_note( 'Could not export payment information to Troly' ); 1651 WP99234()->logger->notice("Failed exporting payment for $order_id (Troly ID $subs_id) with $mtype as payment"); 1652 throw new \Exception( __( 'An error has occurred. Please get in touch with us as soon as possible.', 'wp99234' ) ); 1653 } 1644 1654 } 1645 1655 } … … 1660 1670 1661 1671 $order = new WC_Order( $order_id ); 1672 $rrn = $order->get_transaction_id(); 1662 1673 $order_status = $order->get_status() !== 'failed' ? 'in-progress' : false; 1663 1674 … … 1670 1681 $data = array( 1671 1682 'status' => 'confirmed', // $order_status 1672 'id' => $subs_id, 1683 'id' => $subs_id, // maybe remove this 1673 1684 'order' => array( 1674 1685 'status' => 'confirmed', 1675 'payment_type' => $payment_type 1686 'payment_type' => $payment_type, 1687 'payment_meth' => 'website', 1688 'payment_src' => 'wp99234_payment_gateway', 1689 'rrn' => $rrn, 1676 1690 ) 1677 1691 ); … … 1748 1762 * 1749 1763 * @param int|string $orderID 1750 * @todo fix this1764 * @todo removing this since the status of orders placed via Troly gateway are begin updated already 1751 1765 * @return void 1752 1766 */ 1753 public function check_wp99234_payment_status( $orderID ) {1754 1755 if ( ! $orderID ) return;1756 $order = wc_get_order( $orderID );1757 if ( ! $order ) return;1758 1759 $trolyOrderID = get_post_meta( $order->get_id(), 'subs_id', true );1760 1761 if ( ! $trolyOrderID || empty( $trolyOrderID) ) return;1762 1763 $endpoint = sprintf( "%sorders/%s.json", WP99234_Api::$endpoint, $trolyOrderID );1764 $response = WP99234()->_api->_call( $endpoint );1765 1766 // Just taking in the case of "success" for now.1767 if ( $response && is_object( $response ) && ( $response->payment_status === 'auth'1768 || $response->payment_status === 'paid' ) ) {1769 $order->update_status( 'processing' );1770 1771 // Removing the specific CRON after order status has been updated.1772 wp_clear_scheduled_hook( 'troly_order_status_check', [ $orderID ] );1773 }1774 1775 exit;1776 }1767 //public function check_wp99234_payment_status( $orderID ) { 1768 1769 // if ( ! $orderID ) return; 1770 // $order = wc_get_order( $orderID ); 1771 // if ( ! $order ) return; 1772 1773 // $trolyOrderID = get_post_meta( $order->get_id(), 'subs_id', true ); 1774 1775 // if ( ! $trolyOrderID || empty( $trolyOrderID) ) return; 1776 1777 // $endpoint = sprintf( "%sorders/%s.json", WP99234_Api::$endpoint, $trolyOrderID ); 1778 // $response = WP99234()->_api->_call( $endpoint ); 1779 1780 // // Just taking in the case of "success" for now. 1781 // if ( $response && is_object( $response ) && ( $response->payment_status === 'auth' 1782 // || $response->payment_status === 'paid' ) ) { 1783 // $order->update_status( 'processing' ); 1784 1785 // // Removing the specific CRON after order status has been updated. 1786 // wp_clear_scheduled_hook( 'troly_order_status_check', [ $orderID ] ); 1787 // } 1788 1789 // exit; 1790 //} 1777 1791 1778 1792 /** … … 1783 1797 * @return void 1784 1798 */ 1785 public function removeOrderStatusCheckCRON( $orderID )1786 {1787 wp_clear_scheduled_hook( 'troly_order_status_check', [ $orderID ] );1788 }1799 //public function removeOrderStatusCheckCRON( $orderID ) 1800 //{ 1801 // wp_clear_scheduled_hook( 'troly_order_status_check', [ $orderID ] ); 1802 //} 1789 1803 1790 1804 /** -
subscribility/trunk/includes/frontend/controllers/class-wp99234-wc-payment-gateway.php
r2319969 r2370819 38 38 39 39 add_action( 'woocommerce_after_checkout_form', array($this, 'add_cc_field_toggle_js'), 6); 40 add_action( 'woocommerce_payment_complete', [ $this, 'exportPaymentToSubs' ], 10, 2);41 }42 43 /**44 * Send payment information to Troly once an order is paid or refunded45 * in WordPress that does not use the Troly gateway46 *47 * @param int $order_id48 * @param array $posted_data49 * @return void50 */51 public function exportPaymentToSubs( $order_id, $posted_data ) {52 WP99234()->_woocommerce->export_payment( $order_id );53 40 } 54 41 … … 110 97 $return_url = $this->get_return_url( $order ); 111 98 112 if( $websocket_channel ){ 113 $return_url = esc_url_raw( add_query_arg( 'ws_channel', $websocket_channel, $return_url ) ); 114 } 99 if ( $websocket_channel ) { 100 $order->update_status( 'processing' ); 101 $return_url = esc_url_raw( add_query_arg( 'ws_channel', $websocket_channel, $return_url ) ); 102 } 115 103 116 104 // Return thankyou redirect -
subscribility/trunk/includes/frontend/views/newsletter_form.php
r2319969 r2370819 22 22 </style> 23 23 24 <form id="newsletter_registration_form" action="#newsletter_registration_form" method="POST"> 24 <div class="woocommerce"> 25 <form id="newsletter_registration_form" action="#newsletter_registration_form" method="POST"> 25 26 26 <div class="woocommerce">27 <?php if ( !is_admin() ) { if ( function_exists('wc_print_notices') ) { wc_print_notices(); } } ?>28 </div>27 <div class="woocommerce"> 28 <?php if ( !is_admin() ) { if ( function_exists('wc_print_notices') ) { wc_print_notices(); } } ?> 29 </div> 29 30 30 <div class="cfix">31 <div class="cfix"> 31 32 32 <?php $fields = array( 33 'first_name' => array( 34 (get_option('wp99234_newsletter_use_placeholders') == 'yes' ? 'placeholder' : 'label') => __( 'First Name', 'wp99234' ), 35 'default' => '', 36 ), 37 'reg_email' => array( 38 (get_option('wp99234_newsletter_use_placeholders') == 'yes' ? 'placeholder' : 'label') => __( 'Email', 'wp99234' ), 39 'default' => '', 40 ), 41 ); 33 <?php $fields = array( 34 'first_name' => array( 35 (get_option('wp99234_newsletter_use_placeholders') == 'yes' ? 'placeholder' : 'label') => __( 'First Name', 'wp99234' ), 36 'default' => '', 37 'attributes' => [ 38 'class' => 'input-text', 39 ], 40 ), 41 'reg_email' => array( 42 (get_option('wp99234_newsletter_use_placeholders') == 'yes' ? 'placeholder' : 'label') => __( 'Email', 'wp99234' ), 43 'default' => '', 44 'attributes' => [ 45 'class' => 'input-text', 46 ], 47 ), 48 ); 42 49 43 if ( get_option('wp99234_newsletter_collect_mobile') == 'yes' ) { 44 $fields['mobile'] = array( 45 ( get_option( 'wp99234_newsletter_use_placeholders' ) == 'yes' ? 'placeholder' : 'label' ) => __( 'Mobile', 'wp99234' ), 46 'default' => '', 47 ); 48 } 50 if ( get_option('wp99234_newsletter_collect_mobile') == 'yes' ) { 51 $fields['mobile'] = array( 52 ( get_option( 'wp99234_newsletter_use_placeholders' ) == 'yes' ? 'placeholder' : 'label' ) => __( 'Mobile', 'wp99234' ), 53 'default' => '', 54 'attributes' => [ 55 'class' => 'input-text', 56 ], 57 ); 58 } 49 59 50 // Only show Postcode if not 'hidden'51 if ( get_option('wp99234_newsletter_collect_postcode') != 'hidden' ) {52 $fields['postcode'] = array(53 ( get_option( 'wp99234_newsletter_use_placeholders' ) == 'yes' ? 'placeholder' : 'label' ) => __( 'Postcode', 'wp99234' ),54 'default' => '',55 );56 }60 // Only show Postcode if not 'hidden' 61 if ( get_option('wp99234_newsletter_collect_postcode') != 'hidden' ) { 62 $fields['postcode'] = array( 63 ( get_option( 'wp99234_newsletter_use_placeholders' ) == 'yes' ? 'placeholder' : 'label' ) => __( 'Postcode', 'wp99234' ), 64 'default' => '', 65 ); 66 } 57 67 58 ?>68 ?> 59 69 60 <?php foreach( $fields as $key => $field ){61 WP99234()->_newsletter->display_field( $key, $field );62 } ?>70 <?php foreach( $fields as $key => $field ){ 71 WP99234()->_newsletter->display_field( $key, $field ); 72 } ?> 63 73 64 <p class="form-submit form-row">65 <input type="hidden" name="<?php echo WP99234()->_newsletter->nonce_name; ?>" value="<?php echo wp_create_nonce( WP99234()->_newsletter->nonce_action ); ?>" />66 <input type="submit" name="<?php echo WP99234()->_newsletter->submit_name; ?>" value="<?php _e( 'Sign Up Now', 'wp99234' ); ?>" class="wp99234-newsletter-signup-button" />67 </p>74 <p class="form-submit form-row"> 75 <input type="hidden" name="<?php echo WP99234()->_newsletter->nonce_name; ?>" value="<?php echo wp_create_nonce( WP99234()->_newsletter->nonce_action ); ?>" /> 76 <input type="submit" name="<?php echo WP99234()->_newsletter->submit_name; ?>" value="<?php _e( 'Sign Up Now', 'wp99234' ); ?>" class="wp99234-newsletter-signup-button" /> 77 </p> 68 78 69 </div>79 </div> 70 80 71 </form> 81 </form> 82 </div> -
subscribility/trunk/includes/frontend/views/registration_form.php
r2333850 r2370819 19 19 $current_membership_id = 'null'; 20 20 21 // Enqueue credit card validator logics. 21 22 wp_enqueue_script( 'jquery-payment-troly' ); 22 23 23 24 echo "\n\n".'<script type="text/javascript">window.troly_current_membership_id = '.$current_membership_id.';</script>'."\n\n"; 24 25 26 // Enqueue WooCommerce styling and functions for dropdown elements. 27 wp_enqueue_style( 'select2' ); 28 wp_enqueue_script( 'selectWoo' ); 25 29 get_header(); 26 30 ?> 27 31 <style type="text/css"> 28 .membership_variation.hide { display:none; } 29 30 /* clearfix hack class */ 31 .wp99234-cfix:after { content: ""; display: table; clear: both; } 32 33 li.wp99234-membership_option { 34 list-style:none; 35 border:1px solid transparent; 36 float:left; 37 padding:20px; 38 margin-bottom:4%; 39 width: 100%; 40 position: relative; 41 } 42 43 .wp99234-membership_option p { 44 padding: 10px 5px; 45 } 46 47 /* Emphasize input fields to inverse background */ 48 .wp99234-input_field_text, #subs_birthday, 49 .wp99234-input_field_password, 50 .wp99234-input_field_textfield, 51 .wp99234-section.cc_details input[type="text"], 52 .wp99234-section.cc_details input[type="tel"] { 53 border-bottom: 1px solid gray; 54 } 55 56 .wp99234-section.chosen-preferences .tags { 57 margin-top: 5px; 58 } 59 .wp99234-section.chosen-preferences .tag, .wp99234-section.chosen-preferences .tag-editable { 60 position: relative; 61 display: inline-block; 62 } 63 64 .wp99234-section.chosen-preferences .tag-selected button:before, 65 .wp99234-membership_option.selected button:before { 66 content:'\2713\00a0\00a0'; /* Add check icon to selected tag */ 67 white-space: pre; 68 } 69 70 .wp99234-membership_option:nth-child(2n+1){ clear:both; } 71 72 .wp99234-membership_option.selected{ 73 border: 1px solid #CCC; 74 } 75 76 .wp99234-selected_membership, 77 .wp99234-restricted_membership { 78 /*margin-top: 1.313em;*/ 79 } 80 81 .wp99234-section.cc_details { 82 padding-top: 15px; 83 } 84 85 #wp99234-create_password_section { 86 padding-top: 15px; 87 } 88 89 #wp99234_member_submit { 90 padding: 5px; 91 height: auto; 92 } 93 94 @media screen and (min-width: 700px) { 95 96 .wp99234-membership_option:nth-child(2n){ 97 margin-left:4%; 98 } 99 .wp99234-membership_option{ 100 width:46%; 101 float:left; 102 } 103 } 104 105 .wp99234_delivery_area { 106 display: block; 107 width: 100%; 108 min-height: 150px; 109 } 110 111 /* User details, CC details and delivery sections */ 112 .wp99234-section.user_details, 113 .wp99234-section.cc_details, 114 .wp99234-section.delivery_details, 115 .wp99234-input_field_textfield { 116 width: 100%; 117 box-sizing: border-box; 118 } 119 @media screen and (min-width: 700px) { 120 121 .wp99234-section.user_details, 122 .wp99234-section.cc_details { 123 float: left; 124 width: 50%; 125 padding-right: 20px; 126 } 127 .wp99234-section.delivery_details { 128 float: right; 129 width: 50%; 130 padding-left: 20px; 131 } 132 } 133 134 .wp99234-section.user_details label, 135 .wp99234-section.cc_details label, 136 .wp99234-section.delivery_details label, 137 .wp99234-section.user_details input, 138 .wp99234-section.cc_details input, 139 .wp99234-section.delivery_details input { 140 width: 100%; 141 } 142 143 @media screen and (max-width: 700px) { 144 .wp99234-section.delivery_details { 145 padding-top: 15px; 146 } 147 } 148 149 #wp99234_use_existing_card{ 150 width:auto; 151 } 152 153 /* Form button */ 154 #wp99234_member_registration_form p.form-submit { 155 text-align: right; 156 } 157 #wp99234_member_registration_form p.form-submit input { 158 width: 260px; 159 text-align: center; 160 padding: 5px; 161 } 32 .membership_variation.hide { display:none; } 33 34 /* clearfix hack class */ 35 .wp99234-cfix:after { content: ""; display: table; clear: both; } 36 37 .wp99234-membership_option p { 38 padding: 10px 5px; 39 } 40 41 .wp99234-section.chosen-preferences .tag, .wp99234-section.chosen-preferences .tag-editable { 42 position: relative; 43 display: inline-block; 44 } 45 46 .wp99234-section.chosen-preferences .tag-selected button:before, 47 .wp99234-membership_option.selected button:before { 48 content:'\2713\00a0\00a0'; /* Add check icon to selected tag */ 49 white-space: pre; 50 } 51 52 .wp99234-membership_option:nth-child(2n+1){ clear:both; } 53 54 .wp99234-selected_membership, 55 .wp99234-restricted_membership { 56 /*margin-top: 1.313em;*/ 57 } 58 59 .wp99234-section.cc_details { 60 padding-top: 15px; 61 } 62 63 #wp99234-create_password_section { 64 padding-top: 15px; 65 } 66 67 .wp99234_delivery_area { 68 display: block; 69 width: 100%; 70 min-height: 150px; 71 } 72 73 /* User details, CC details and delivery sections */ 74 .wp99234-section.user_details, 75 .wp99234-section.cc_details, 76 .wp99234-section.delivery_details, 77 .wp99234-input_field_textfield { 78 width: 100%; 79 box-sizing: border-box; 80 } 81 @media screen and (min-width: 700px) { 82 83 .wp99234-section.user_details, 84 .wp99234-section.cc_details { 85 float: left; 86 width: 50%; 87 padding-right: 20px; 88 } 89 .wp99234-section.delivery_details { 90 float: right; 91 width: 50%; 92 padding-left: 20px; 93 } 94 } 95 96 @media screen and (max-width: 700px) { 97 .wp99234-section.delivery_details { 98 padding-top: 15px; 99 } 100 } 101 102 #wp99234_use_existing_card{ 103 width:auto; 104 } 162 105 163 106 #wp99234_membership_options .restricted { 164 font-style: italic;165 margin-top: 1.313em;107 font-style: italic; 108 margin-top: 1.313em; 166 109 } 167 110 168 /* membership variation dropdown */169 .membership_variation {170 height: 43px;171 border: 1px solid #CCC;172 }173 174 #wp99234-registration_shipping_instructions {175 width: 100%;176 }111 /* membership variation dropdown */ 112 .membership_variation { 113 height: 43px; 114 border: 1px solid #CCC; 115 } 116 117 #wp99234-registration_shipping_instructions { 118 width: 100%; 119 } 177 120 178 121 </style> 179 122 180 <form id="wp99234_member_registration_form" class="woocommerce" action="" method="POST"> 123 <div class="woocommerce"> 124 <form id="wp99234_member_registration_form" action="" method="POST"> 181 125 182 126 <div class="woocommerce wp99234_registration_notices"> … … 184 128 </div> 185 129 186 <div class="wp99234-cfix"> 187 188 <ul id="wp99234_membership_options" class="wp99234-cfix"> 130 <div class="wp99234-cfix"> 131 132 <ul id="wp99234_membership_options" class="wp99234-cfix"> 133 134 <?php 135 $idx = 0; foreach ( apply_filters( 'wp99234_rego_form_membership_options', $membership_options ) as $membership_option ): ?> 136 137 <?php 138 /* Any membership not available to the broader public is not rendered. 139 Public: anyone can sign up 140 Restricted: invite-only 141 */ 142 if( isset( $membership_option->visibility ) && !in_array( $membership_option->visibility, [ 'public', 'restricted' ] ) ) continue; 143 ?> 144 145 <li class="wp99234-membership_option 146 <?php echo $current_membership_id == $membership_option->id ? 'selected' : 'inactive'; ?>" 147 id="wp99234-club_<?php echo str_replace(' ', '_', strtolower($membership_option->name));?>"> 148 149 <h5 class="wp99234-membership_option_title"><?php echo esc_html( $membership_option->name ); ?></h5> 150 151 <div class="wp99234-membership_option_details"> 152 153 <?php if ( !empty( $membership_option->description )) { ?> 154 <p class="wp99234-membership-description"><?php echo $membership_option->description; ?></p> 155 <?php } ?> 156 157 <?php if ( !empty( $membership_option->benefits )) { ?> 158 <p><a href="#" class="subs-toggle-member-benefits wp99234-membership_benefits_show">Additional benefits</a></p> 159 <div class="wp99234-membership_benefits"> 160 <h6 class="wp99234-membership_option_member_benefits_title">Member Benefits</h6> 161 <ul><li><?php echo implode("</li><li>",explode("\n",$membership_option->benefits)); ?></li></ul> 162 </div> 163 <?php } ?> 164 </div> 165 166 <?php 167 if($current_membership_id == $membership_option->id) { 168 echo '<div class="restricted wp99234_current_membership">You are currently a member of this club.</div>'; 169 } 170 if( isset( $membership_option->visibility) && $membership_option->visibility == 'public') { ?> 171 172 <input type="radio" class="selected_membership_radio" name="selected_membership" value="<?php echo $membership_option->id; ?>" <?php if($current_membership_id == $membership_option->id){echo 'checked="checked"';}?> /> 173 174 <button class="wp99234-selected_membership button" data-original_text="<?php _e( 'Select', 'wp99234' ); ?>" data-selected_text="<?php _e( 'Selected', 'wp99234' ); ?>" data-membership_option_id="<?php echo $membership_option->id; ?>" > 175 <?php if($current_membership_id == $membership_option->id){ _e( 'Selected', 'wp99234' );}else{ _e( 'Select', 'wp99234' );}?> 176 </button> 177 178 <!-- enable membership variations for variation membership only --> 179 <?php if( isset($membership_option->is_variation_membership) && $membership_option->is_variation_membership ): ?> 180 <!-- only selected variation will be set name to 'variation_id'. It will be passed to Troly for creating membership during submission --> 181 <select id="membership_option_<?php echo $membership_option->id ?>" class="membership_variation hide" name=""> 182 <option value='' disabled>Membership option</option> 183 <?php 184 foreach($membership_option->variations as $v_id => $v_name) { 185 echo "<option value=".$v_id.">".$v_name."</option>"; 186 } 187 ?> 188 </select> 189 <?php endif; ?> 190 191 <?php } else if ( isset( $membership_option->visibility ) && $membership_option->visibility == 'restricted' && $current_membership_id != $membership_option->id) { ?> 192 193 <div class="restricted">You cannot currently sign up for this membership. Please contact us for further information.</div> 194 195 <?php } ?> 196 197 </li> 198 199 <?php endforeach; ?> 200 201 </ul> 202 203 <h3 class="wp99234-section_title">Membership Details</h3> 189 204 190 205 <?php 191 $idx = 0; foreach ( apply_filters( 'wp99234_rego_form_membership_options', $membership_options ) as $membership_option ): ?> 192 193 <?php 194 /* Any membership not available to the broader public is not rendered. 195 Public: anyone can sign up 196 Restricted: invite-only 197 */ 198 if( isset( $membership_option->visibility ) && !in_array( $membership_option->visibility, [ 'public', 'restricted' ] ) ) continue; 199 ?> 200 201 <li class="wp99234-membership_option <?php if($current_membership_id == $membership_option->id){ echo 'selected'; } elseif(isset($current_membership_id)){ echo 'inactive';}?>" id="wp99234-club_<?php echo str_replace(' ', '_', strtolower($membership_option->name));?>"> 202 203 <h5 class="wp99234-membership_option_title"><?php echo esc_html( $membership_option->name ); ?></h5> 204 205 <div class="wp99234-membership_option_details"> 206 207 <?php if ( !empty( $membership_option->description )) { ?> 208 <p class="wp99234-membership-description"><?php echo $membership_option->description; ?></p> 209 <?php } ?> 210 211 <?php if ( !empty( $membership_option->benefits )) { ?> 212 <p><a href="#" class="subs-toggle-member-benefits wp99234-membership_benefits_show">Additional benefits</a></p> 213 <div class="wp99234-membership_benefits"> 214 <h6 class="wp99234-membership_option_member_benefits_title">Member Benefits</h6> 215 <ul><li><?php echo implode("</li><li>",explode("\n",$membership_option->benefits)); ?></li></ul> 216 </div> 217 <?php } ?> 218 </div> 219 220 <?php 221 if($current_membership_id == $membership_option->id) { 222 echo '<div class="restricted wp99234_current_membership">You are currently a member of this club.</div>'; 223 } 224 if( isset( $membership_option->visibility) && $membership_option->visibility == 'public') { ?> 225 226 <input type="radio" class="selected_membership_radio" name="selected_membership" value="<?php echo $membership_option->id; ?>" <?php if($current_membership_id == $membership_option->id){echo 'checked="checked"';}?> /> 227 228 <button class="wp99234-selected_membership button" data-original_text="<?php _e( 'Select', 'wp99234' ); ?>" data-selected_text="<?php _e( 'Selected', 'wp99234' ); ?>" data-membership_option_id="<?php echo $membership_option->id; ?>" > 229 <?php if($current_membership_id == $membership_option->id){ _e( 'Selected', 'wp99234' );}else{ _e( 'Select', 'wp99234' );}?> 230 </button> 231 232 <!-- enable membership variations for variation membership only --> 233 <?php if( isset($membership_option->is_variation_membership) && $membership_option->is_variation_membership ): ?> 234 <!-- only selected variation will be set name to 'variation_id'. It will be passed to Troly for creating membership during submission --> 235 <select id="membership_option_<?php echo $membership_option->id ?>" class="membership_variation hide" name=""> 236 <option value='' disabled>Membership option</option> 237 <?php 238 foreach($membership_option->variations as $v_id => $v_name) { 239 echo "<option value=".$v_id.">".$v_name."</option>"; 240 } 241 ?> 242 </select> 243 <?php endif; ?> 244 245 <?php } else if ( isset( $membership_option->visibility ) && $membership_option->visibility == 'restricted' && $current_membership_id != $membership_option->id) { ?> 246 247 <div class="restricted">You cannot currently sign up for this membership. Please contact us for further information.</div> 248 249 <?php } ?> 250 251 </li> 252 253 <?php endforeach; ?> 254 255 </ul> 256 257 <h3 class="wp99234-section_title">Membership Details</h3> 258 259 <?php 260 $customer_tags = get_option('troly_customer_tags'); 261 $tag_ids_str = get_user_meta( $current_user->ID , 'tag_ids', true); 262 $tag_ids = explode(',', $tag_ids_str); 263 foreach($customer_tags as $id=>$tag) { 264 if (!$tag->is_public) { 265 unset($customer_tags[$id]); 266 } 267 } 268 if (!empty($customer_tags)): 269 ?> 270 <div class="wp99234-section chosen-preferences"> 271 <h4>Tell us about you</h4> 272 <ul class="tags"> 273 <?php foreach($customer_tags as $tag): ?> 274 <li class="tag <?= in_array($tag->id, $tag_ids) ? 'tag-selected' : ''; ?>" customer-tag="<?= $tag->id; ?>"> 275 <button class="button"><?= $tag->name; ?></button> 276 </li> 277 <?php endforeach; ?> 278 </ul> 279 <input type="hidden" name="tag_ids" id="tag_ids" value="<?= $tag_ids_str; ?>"> 280 </div> 281 <?php endif; ?> 282 283 <div class="wp99234-section user_details"> 284 285 <h4 class="wp99234-section_title"><?php _e( 'Your Details', 'wp99234' ); ?></h4> 286 287 <div class="wp99234-section_content"> 288 289 <?php 290 $user_fields = array( 291 'first_name' => array( 292 (get_option('wp99234_club_use_placeholders') == 'yes' ? 'placeholder' : 'label') => __( 'First Name', 'wp99234' ), 293 'default' => get_user_meta( $current_user->ID, 'first_name', true ), 294 'attributes' => array('required' => true, 'class' => 'wp99234-input_field_text input-text', 'id' => 'wp99234-registration_first_name') 295 ), 296 'last_name' => array( 297 (get_option('wp99234_club_use_placeholders') == 'yes' ? 'placeholder' : 'label') => __( 'Last Name', 'wp99234' ), 298 'default' => get_user_meta( $current_user->ID , 'last_name', true), 299 'attributes' => array('class' => 'wp99234-input_field_text input-text', 'id' => 'wp99234-registration_last_name' ), 300 ), 301 'reg_email' => array( 302 (get_option('wp99234_club_use_placeholders') == 'yes' ? 'placeholder' : 'label') => __( 'Email', 'wp99234' ), 303 'default' => ( $current_user ) ? $current_user->user_email : '' , 304 'attributes' => array('required' => true, 'class' => 'wp99234-input_field_text input-text', 'id' => 'wp99234-registration_email') 305 ), 306 'phone' => array( 307 (get_option('wp99234_club_use_placeholders') == 'yes' ? 'placeholder' : 'label') => __( 'Phone Number', 'wp99234' ), 308 'default' => get_user_meta( $current_user->ID , 'phone', true), 309 'attributes' => array('class' => 'wp99234-input_field_text input-text', 'id' => 'wp99234-registration_phone' ), 310 ), 311 'mobile' => array( 312 (get_option('wp99234_club_use_placeholders') == 'yes' ? 'placeholder' : 'label') => __( 'Mobile Number', 'wp99234' ), 313 'default' => get_user_meta( $current_user->ID , 'mobile', true), 314 'attributes' => array('class' => 'wp99234-input_field_text input-text', 'id' => 'wp99234-registration_mobile' ), 315 ), 316 ); 317 318 $legal_dob_club_option = get_option('wp99234_legal_dob_club'); 319 $isRequiredDOB = ($legal_dob_club_option == 'yes' || boolval($legal_dob_club_option)) ? true : false; 320 if ($legal_dob_club_option != "hidden") { 321 $user_fields['subs_birthday'] = array( 322 (get_option('wp99234_club_use_placeholders') == 'yes' ? 'placeholder' : 'label') => __( 'Date of Birth', 'wp99234' ), 323 'default' => get_user_meta( $current_user->ID , 'birthday', true), 324 'attributes' => array('class' => 'wp99234-input_field_text input-text', 'id' => 'wp99234-registration_birthday' ), 325 'attributes' => array('required' => $isRequiredDOB, 'id' => 'subs_birthday') 326 ); 327 } 328 329 foreach( $user_fields as $key => $user_field ){ 330 WP99234()->_registration->display_field( $key, $user_field ); 331 } 332 ?> 333 334 </div> 335 336 </div> 337 338 <div class="wp99234-section delivery_details"> 339 340 <h4 class="wp99234-section_title"><?php _e( 'Delivery Details', 'troly' ); ?></h4> 341 342 <div class="wp99234-section_content"> 343 344 <?php 345 $countries_obj = new WC_Countries(); 346 $countriesArray = $countries_obj->__get( 'countries' ); 347 348 $delivery_fields = array( 349 'company_name' => array( 350 (get_option('wp99234_club_use_placeholders') == 'yes' ? 'placeholder' : 'label') => __( 'Company Name (optional)', 'troly' ), 351 'default' => get_user_meta( $current_user->ID , 'shipping_company', true), 352 'attributes' => array('class' => 'wp99234-input_field_text input-text', 'id' => 'wp99234-registration_company_name' ), 353 ), 354 'shipping_address_1' => array( 355 (get_option('wp99234_club_use_placeholders') == 'yes' ? 'placeholder' : 'label') => __( 'Delivery Address', 'troly' ), 356 'default' => get_user_meta( $current_user->ID , 'shipping_address_1', true ), 357 'attributes' => array('required' => true, 'class' => 'wp99234-input_field_text input-text', 'id' => 'wp99234-registration_shipping_address_1' ) 358 ), 359 'shipping_suburb' => array( 360 (get_option('wp99234_club_use_placeholders') == 'yes' ? 'placeholder' : 'label') => __( 'Suburb', 'troly' ), 361 'default' => get_user_meta( $current_user->ID , 'shipping_city', true ), 362 'attributes' => array('required' => true, 'class' => 'wp99234-input_field_text input-text', 'id' => 'wp99234-registration_shipping_suburb') 363 ), 364 'shipping_postcode' => array( 365 (get_option('wp99234_club_use_placeholders') == 'yes' ? 'placeholder' : 'label') => __( 'Postcode', 'troly' ), 366 'default' => get_user_meta( $current_user->ID , 'shipping_postcode', true ), 367 'attributes' => array('required' => true, 'class' => 'wp99234-input_field_text input-text', 'id' => 'wp99234-registration_shipping_postcode') 368 ), 369 'shipping_country' => array( 370 (get_option('wp99234_club_use_placeholders') == 'yes' ? 'placeholder' : 'label') => __( 'Country', 'troly' ), 371 'default' => get_user_meta( $current_user->ID , 'shipping_country', true ), 372 'attributes' => array('required' => true, 'class' => 'wp99234-input_field_text input-text'), 373 'id' => 'troly_shipping_country', 374 'type' => 'select', 375 'options' => $countriesArray, 376 ), 377 'shipping_state' => array( 378 (get_option('wp99234_club_use_placeholders') == 'yes' ? 'placeholder' : 'label') => __( 'State', 'troly' ), 379 'default' => get_user_meta( $current_user->ID , 'shipping_state', true ), 380 'attributes' => array('required' => true, 'class' => 'wp99234-input_field_text input-text', 'id' => 'troly_shipping_state'), 381 ), 382 'shipping_instructions' => array( 383 'type' => 'textarea', 384 (get_option('wp99234_club_use_placeholders') == 'yes' ? 'placeholder' : 'label') => __( 'Delivery notes and instructions (optional)', 'troly' ), 385 'default' => get_user_meta( $current_user->ID, 'delivery_instructions', true), 386 'attributes' => array('class' => 'wp99234-input_field_textfield input-text', 'id' => 'wp99234-registration_shipping_instructions') 387 ) 388 ); 389 390 foreach( $delivery_fields as $key => $delivery_field ){ 391 WP99234()->_registration->display_field( $key, $delivery_field ); 392 } 393 394 if(!is_user_logged_in()){ 395 echo '<div id="wp99234-create_password_section">'; 396 ?> 397 <h4 class="wp99234-section_title"><?php _e( 'Create Password', 'wp99234' ); ?></h4> 398 <?php 399 $pass_fields = array( 400 'user_pass' => array( 401 (get_option('wp99234_club_use_placeholders') == 'yes' ? 'placeholder' : 'label') => __( 'Password', 'wp99234' ), 402 'type' => 'password' , 403 'id' => 'password' , 404 'default' => '', 405 'attributes' => array('required' => true, 'class' => 'wp99234-input_field_text') 406 ), 407 'conf_pass' => array( 408 (get_option('wp99234_club_use_placeholders') == 'yes' ? 'placeholder' : 'label') => __( 'Confirm Password', 'wp99234' ), 409 'type' => 'password' , 410 'id' => 'confirm_password' , 411 'default' => '', 412 'attributes' => array('required' => true, 'class' => 'wp99234-input_field_password') 413 ) 414 ); 415 foreach( $pass_fields as $key => $pass_field ){ 416 WP99234()->_registration->display_field( $key, $pass_field ); 417 } 418 echo '</div>'; 419 } 420 ?> 421 </div> 422 423 </div> 424 425 <div class="wp99234-section cc_details"> 426 427 <h4 class="wp99234-section_title"><?php _e( 'Payment Details', 'wp99234' ); ?></h4> 428 429 <div class="wp99234-section_content"> 430 431 <?php 432 433 $cc_fields = array( 434 'cc_name' => array( 435 (get_option('wp99234_club_use_placeholders') == 'yes' ? 'placeholder' : 'label') => __( 'Cardholder Name', 'wp99234' ), 436 'default' => '', 437 'attributes' => array('required' => true, 'autocomplete' => 'cc-name') 438 ), 439 'cc_number' => array( 440 (get_option('wp99234_club_use_placeholders') == 'yes' ? 'placeholder' : 'label') => __( 'Card Number', 'wp99234' ), 441 'default' =>'', 442 'attributes' => array( 443 'required' => true, 444 'class' => 'woocommerce-Input input-text', 445 'placeholder' => "•••• •••• •••• ••••", 446 'maxlength' => 19, 447 'type'=> 'tel', 448 'inputmode'=> 'numeric', 449 'autocomplete' => 'cc-number' 450 ) 451 ), 452 'cc_exp' => array( 453 (get_option('wp99234_club_use_placeholders') == 'yes' ? 'placeholder' : 'label') => __( 'Card Expiry Date', 'wp99234' ), 454 'default' => '' , 455 'attributes' => array( 456 'placeholder' => 'MM / YYYY', 457 'required' => true, 458 'autocomplete' => 'cc-exp' 459 ), 460 ), 461 'cc_cvv' => array( 462 (get_option('wp99234_club_use_placeholders') == 'yes' ? 'placeholder' : 'label') => __( 'Card code', 'wp99234' ), 463 'default' => '' , 464 'attributes' => array( 465 'placeholder' => 'CVC', 466 'required' => true, 467 'autocomplete' => 'cc-cvv' 468 ), 469 ) 470 ); 471 472 $has_cc_details = false; 473 474 if( is_user_logged_in() ){ 475 $has_cc_meta = get_user_meta( get_current_user_id(), 'has_subs_cc_data', true ); 476 if( $has_cc_meta && $has_cc_meta == true ){ 477 $has_cc_details = true; 478 } 479 } 480 481 if( $has_cc_details ){ 482 echo '<div><input type="checkbox" id="wp99234_use_existing_card" name="wp99234_use_existing_card" checked="checked" value="yes" style="width:auto;display:inline-block;"/> ' . sprintf( '<label for="wp99234_use_existing_card" style="width:auto;display:inline-block;vertical-align:middle;margin-bottom:0;margin-left:5px;">Use existing card (%s)</label></div>', get_user_meta( get_current_user_id(), 'cc_number', true ) ); 483 echo '<div id="hidden_cc_form"><br /><p>' . __( 'Card details entered here will be stored securely for future use.', 'wp99234' ) . '</p>'; 484 } 485 486 foreach( $cc_fields as $key => $cc_field ){ 487 $css_class = null; 488 if ($key === 'cc_exp') $css_class = 'form-row-first woocommerce-validated'; 489 if ($key === 'cc_cvv') $css_class = 'form-row-last woocommerce-validated'; 490 WP99234()->_registration->display_field( $key, $cc_field, $css_class ); 491 } 492 493 if( $has_cc_details ){ 494 echo '</div>'; 495 } 496 497 ?> 498 499 </div> 500 501 </div> 502 503 <?php 504 do_action('wp99234_preferences_form'); 505 ?> 506 507 </div> 508 509 <p class="form-submit form-row"> 510 <label id='message'></label> 511 <input type="hidden" name="<?php echo WP99234()->_registration->nonce_name; ?>" value="<?php echo wp_create_nonce( WP99234()->_registration->nonce_action ); ?>" /> 512 <input class="button" type="submit" name="<?php echo WP99234()->_registration->submit_name; ?>" value="<?php _e( 'Sign Up Now', 'wp99234' ); ?>" id="wp99234_member_submit" /> 513 </p> 514 515 </form> 206 $customer_tags = get_option('troly_customer_tags'); 207 $tag_ids_str = get_user_meta( $current_user->ID , 'tag_ids', true); 208 $tag_ids = explode(',', $tag_ids_str); 209 foreach($customer_tags as $id=>$tag) { 210 if (!$tag->is_public) { 211 unset($customer_tags[$id]); 212 } 213 } 214 if (!empty($customer_tags)): 215 ?> 216 <div class="wp99234-section chosen-preferences"> 217 <h4>Tell us about you</h4> 218 <ul class="tags"> 219 <?php foreach($customer_tags as $tag): ?> 220 <li class="tag <?= in_array($tag->id, $tag_ids) ? 'tag-selected' : ''; ?>" customer-tag="<?= $tag->id; ?>"> 221 <button class="button"><?= $tag->name; ?></button> 222 </li> 223 <?php endforeach; ?> 224 </ul> 225 <input type="hidden" name="tag_ids" id="tag_ids" value="<?= $tag_ids_str; ?>"> 226 </div> 227 <?php endif; ?> 228 229 <div class="wp99234-section user_details"> 230 231 <h4 class="wp99234-section_title"><?php _e( 'Your Details', 'wp99234' ); ?></h4> 232 233 <div class="wp99234-section_content"> 234 235 <?php 236 $user_fields = array( 237 'first_name' => array( 238 (get_option('wp99234_club_use_placeholders') == 'yes' ? 'placeholder' : 'label') => __( 'First Name', 'wp99234' ), 239 'default' => get_user_meta( $current_user->ID, 'first_name', true ), 240 'attributes' => array('required' => true, 'class' => 'wp99234-input_field_text input-text', 'id' => 'wp99234-registration_first_name') 241 ), 242 'last_name' => array( 243 (get_option('wp99234_club_use_placeholders') == 'yes' ? 'placeholder' : 'label') => __( 'Last Name', 'wp99234' ), 244 'default' => get_user_meta( $current_user->ID , 'last_name', true), 245 'attributes' => array('class' => 'wp99234-input_field_text input-text', 'id' => 'wp99234-registration_last_name' ), 246 ), 247 'reg_email' => array( 248 (get_option('wp99234_club_use_placeholders') == 'yes' ? 'placeholder' : 'label') => __( 'Email', 'wp99234' ), 249 'default' => ( $current_user ) ? $current_user->user_email : '' , 250 'attributes' => array('required' => true, 'class' => 'wp99234-input_field_text input-text', 'id' => 'wp99234-registration_email') 251 ), 252 'phone' => array( 253 (get_option('wp99234_club_use_placeholders') == 'yes' ? 'placeholder' : 'label') => __( 'Phone Number', 'wp99234' ), 254 'default' => get_user_meta( $current_user->ID , 'phone', true), 255 'attributes' => array('class' => 'wp99234-input_field_text input-text', 'id' => 'wp99234-registration_phone' ), 256 ), 257 'mobile' => array( 258 (get_option('wp99234_club_use_placeholders') == 'yes' ? 'placeholder' : 'label') => __( 'Mobile Number', 'wp99234' ), 259 'default' => get_user_meta( $current_user->ID , 'mobile', true), 260 'attributes' => array('class' => 'wp99234-input_field_text input-text', 'id' => 'wp99234-registration_mobile' ), 261 ), 262 ); 263 264 $legal_dob_club_option = get_option('wp99234_legal_dob_club'); 265 $isRequiredDOB = ($legal_dob_club_option == 'yes' || boolval($legal_dob_club_option)) ? true : false; 266 if ($legal_dob_club_option != "hidden") { 267 $user_fields['subs_birthday'] = array( 268 (get_option('wp99234_club_use_placeholders') == 'yes' ? 'placeholder' : 'label') => __( 'Date of Birth', 'wp99234' ), 269 'default' => get_user_meta( $current_user->ID , 'birthday', true), 270 'attributes' => array('class' => 'wp99234-input_field_text input-text', 'id' => 'wp99234-registration_birthday' ), 271 'attributes' => array('required' => $isRequiredDOB, 'id' => 'subs_birthday') 272 ); 273 } 274 275 foreach( $user_fields as $key => $user_field ){ 276 WP99234()->_registration->display_field( $key, $user_field ); 277 } 278 ?> 279 280 </div> 281 282 </div> 283 284 <div class="wp99234-section delivery_details"> 285 286 <h4 class="wp99234-section_title"><?php _e( 'Delivery Details', 'troly' ); ?></h4> 287 288 <div class="wp99234-section_content"> 289 290 <?php 291 $countries_obj = new WC_Countries(); 292 $countriesArray = $countries_obj->__get( 'countries' ); 293 294 $delivery_fields = array( 295 'company_name' => array( 296 (get_option('wp99234_club_use_placeholders') == 'yes' ? 'placeholder' : 'label') => __( 'Company Name (optional)', 'troly' ), 297 'default' => get_user_meta( $current_user->ID , 'shipping_company', true), 298 'attributes' => array('class' => 'wp99234-input_field_text input-text', 'id' => 'wp99234-registration_company_name' ), 299 ), 300 'shipping_address_1' => array( 301 (get_option('wp99234_club_use_placeholders') == 'yes' ? 'placeholder' : 'label') => __( 'Delivery Address', 'troly' ), 302 'default' => get_user_meta( $current_user->ID , 'shipping_address_1', true ), 303 'attributes' => array('required' => true, 'class' => 'wp99234-input_field_text input-text', 'id' => 'wp99234-registration_shipping_address_1' ) 304 ), 305 'shipping_suburb' => array( 306 (get_option('wp99234_club_use_placeholders') == 'yes' ? 'placeholder' : 'label') => __( 'Suburb', 'troly' ), 307 'default' => get_user_meta( $current_user->ID , 'shipping_city', true ), 308 'attributes' => array('required' => true, 'class' => 'wp99234-input_field_text input-text', 'id' => 'wp99234-registration_shipping_suburb') 309 ), 310 'shipping_postcode' => array( 311 (get_option('wp99234_club_use_placeholders') == 'yes' ? 'placeholder' : 'label') => __( 'Postcode', 'troly' ), 312 'default' => get_user_meta( $current_user->ID , 'shipping_postcode', true ), 313 'attributes' => array('required' => true, 'class' => 'wp99234-input_field_text input-text', 'id' => 'wp99234-registration_shipping_postcode') 314 ), 315 'shipping_country' => array( 316 (get_option('wp99234_club_use_placeholders') == 'yes' ? 'placeholder' : 'label') => __( 'Country', 'troly' ), 317 'default' => get_user_meta( $current_user->ID , 'shipping_country', true ), 318 'attributes' => array('required' => true, 'class' => 'wp99234-input_field_text input-text'), 319 'id' => 'troly_shipping_country', 320 'type' => 'select', 321 'options' => $countriesArray, 322 ), 323 'shipping_state' => array( 324 (get_option('wp99234_club_use_placeholders') == 'yes' ? 'placeholder' : 'label') => __( 'State', 'troly' ), 325 'default' => get_user_meta( $current_user->ID , 'shipping_state', true ), 326 'attributes' => array('required' => true, 'class' => 'wp99234-input_field_text input-text', 'id' => 'troly_shipping_state'), 327 ), 328 'shipping_instructions' => array( 329 'type' => 'textarea', 330 (get_option('wp99234_club_use_placeholders') == 'yes' ? 'placeholder' : 'label') => __( 'Delivery notes and instructions (optional)', 'troly' ), 331 'default' => get_user_meta( $current_user->ID, 'delivery_instructions', true), 332 'attributes' => array('class' => 'wp99234-input_field_textfield input-text', 'id' => 'wp99234-registration_shipping_instructions') 333 ) 334 ); 335 336 foreach( $delivery_fields as $key => $delivery_field ){ 337 WP99234()->_registration->display_field( $key, $delivery_field ); 338 } 339 340 if(!is_user_logged_in()){ 341 echo '<div id="wp99234-create_password_section">'; 342 ?> 343 <h4 class="wp99234-section_title"><?php _e( 'Create Password', 'wp99234' ); ?></h4> 344 <?php 345 $pass_fields = array( 346 'user_pass' => array( 347 (get_option('wp99234_club_use_placeholders') == 'yes' ? 'placeholder' : 'label') => __( 'Password', 'wp99234' ), 348 'type' => 'password' , 349 'id' => 'password' , 350 'default' => '', 351 'attributes' => array('required' => true, 'class' => 'wp99234-input_field_text') 352 ), 353 'conf_pass' => array( 354 (get_option('wp99234_club_use_placeholders') == 'yes' ? 'placeholder' : 'label') => __( 'Confirm Password', 'wp99234' ), 355 'type' => 'password' , 356 'id' => 'confirm_password' , 357 'default' => '', 358 'attributes' => array('required' => true, 'class' => 'wp99234-input_field_password') 359 ) 360 ); 361 foreach( $pass_fields as $key => $pass_field ){ 362 WP99234()->_registration->display_field( $key, $pass_field ); 363 } 364 echo '</div>'; 365 } 366 ?> 367 </div> 368 369 </div> 370 371 <div class="wp99234-section cc_details"> 372 373 <h4 class="wp99234-section_title"><?php _e( 'Payment Details', 'wp99234' ); ?></h4> 374 375 <div class="wp99234-section_content"> 376 377 <?php 378 379 $cc_fields = array( 380 'cc_name' => array( 381 (get_option('wp99234_club_use_placeholders') == 'yes' ? 'placeholder' : 'label') => __( 'Cardholder Name', 'wp99234' ), 382 'default' => '', 383 'attributes' => array('required' => true, 'autocomplete' => 'cc-name') 384 ), 385 'cc_number' => array( 386 (get_option('wp99234_club_use_placeholders') == 'yes' ? 'placeholder' : 'label') => __( 'Card Number', 'wp99234' ), 387 'default' =>'', 388 'attributes' => array( 389 'required' => true, 390 'class' => 'woocommerce-Input input-text', 391 'placeholder' => "•••• •••• •••• ••••", 392 'maxlength' => 19, 393 'type'=> 'tel', 394 'inputmode'=> 'numeric', 395 'autocomplete' => 'cc-number' 396 ) 397 ), 398 'cc_exp' => array( 399 (get_option('wp99234_club_use_placeholders') == 'yes' ? 'placeholder' : 'label') => __( 'Expiry Date', 'wp99234' ), 400 'default' => '' , 401 'attributes' => array( 402 'placeholder' => 'MM / YYYY', 403 'required' => true, 404 'autocomplete' => 'cc-exp' 405 ), 406 ), 407 'cc_cvv' => array( 408 (get_option('wp99234_club_use_placeholders') == 'yes' ? 'placeholder' : 'label') => __( 'Card code', 'wp99234' ), 409 'default' => '' , 410 'attributes' => array( 411 'placeholder' => 'CVC', 412 'required' => true, 413 'autocomplete' => 'cc-cvv' 414 ), 415 ) 416 ); 417 418 $has_cc_details = false; 419 420 if( is_user_logged_in() ){ 421 $has_cc_meta = get_user_meta( get_current_user_id(), 'has_subs_cc_data', true ); 422 if( $has_cc_meta && $has_cc_meta == true ){ 423 $has_cc_details = true; 424 } 425 } 426 427 if( $has_cc_details ){ 428 echo '<div><input type="checkbox" id="wp99234_use_existing_card" name="wp99234_use_existing_card" checked="checked" value="yes" style="width:auto;display:inline-block;"/> ' . sprintf( '<label for="wp99234_use_existing_card" style="width:auto;display:inline-block;vertical-align:middle;margin-bottom:0;margin-left:5px;">Use existing card (%s)</label></div>', get_user_meta( get_current_user_id(), 'cc_number', true ) ); 429 echo '<div id="hidden_cc_form"><br /><p>' . __( 'Card details entered here will be stored securely for future use.', 'wp99234' ) . '</p>'; 430 } 431 432 foreach( $cc_fields as $key => $cc_field ){ 433 $css_class = null; 434 if ($key === 'cc_exp') $css_class = 'form-row-first woocommerce-validated'; 435 if ($key === 'cc_cvv') $css_class = 'form-row-last woocommerce-validated'; 436 WP99234()->_registration->display_field( $key, $cc_field, $css_class ); 437 } 438 439 if( $has_cc_details ){ 440 echo '</div>'; 441 } 442 443 ?> 444 445 </div> 446 447 </div> 448 449 <?php 450 do_action('wp99234_preferences_form'); 451 ?> 452 453 </div> 454 455 <p class="form-submit form-row"> 456 <label id='message'></label> 457 <input type="hidden" name="<?php echo WP99234()->_registration->nonce_name; ?>" value="<?php echo wp_create_nonce( WP99234()->_registration->nonce_action ); ?>" /> 458 <input class="button" type="submit" name="<?php echo WP99234()->_registration->submit_name; ?>" value="<?php _e( 'Sign Up Now', 'wp99234' ); ?>" id="wp99234_member_submit" /> 459 </p> 460 461 </form> 462 </div> 516 463 <?php 517 464 $limit = (int)(get_option('wp99234_legal_drinking_age')); … … 519 466 ?> 520 467 <script type="text/javascript"> 521 jQuery(document).ready(function($) {522 $("#subs_birthday").datepicker({523 maxDate: '-<?php echo $limit; ?>',524 changeYear: true,525 changeMonth: true,526 minDate: '-105y',468 jQuery(document).ready(function($) { 469 $("#subs_birthday").datepicker({ 470 maxDate: '-<?php echo $limit; ?>', 471 changeYear: true, 472 changeMonth: true, 473 minDate: '-105y', 527 474 yearRange: '<?php echo ($year - 105) . ':' . ($year - $limit); ?>', 528 475 defaultDate: '<?php echo date('F') . ' ' . date('d') . ', ' . ($year - $limit); ?>', 529 476 }); 530 477 531 $('#wp99234_member_registration_form .tags .tag').click(function(e) {532 e.preventDefault();533 if ($(this).hasClass('tag-selected')) {534 $(this).removeClass('tag-selected');535 } else {536 $(this).addClass('tag-selected');537 }538 var tag_ids = [];539 $('#wp99234_member_registration_form .tag').each(function(i, row) {540 if ($(row).hasClass('tag-selected')) {541 tag_ids.push($(row).attr('customer-tag'));542 }543 });544 $('#tag_ids').val(tag_ids);478 $('#wp99234_member_registration_form .tags .tag').click(function(e) { 479 e.preventDefault(); 480 if ($(this).hasClass('tag-selected')) { 481 $(this).removeClass('tag-selected'); 482 } else { 483 $(this).addClass('tag-selected'); 484 } 485 var tag_ids = []; 486 $('#wp99234_member_registration_form .tag').each(function(i, row) { 487 if ($(row).hasClass('tag-selected')) { 488 tag_ids.push($(row).attr('customer-tag')); 489 } 490 }); 491 $('#tag_ids').val(tag_ids); 545 492 }); 546 493 … … 549 496 550 497 $('input[name=cc_number]').on( 'blur', function(){ 551 if( ! jQuery.payment.validateCardNumber( $( this ).val() ) ){498 if( ! jQuery.payment.validateCardNumber( $( this ).val() ) ){ 552 499 $( this ).addClass( 'invalid' ) 553 } else {500 } else { 554 501 $( this ).removeClass( 'invalid' ) 555 } 556 }); 502 } 503 }); 504 505 $( '#troly_shipping_country' ).selectWoo({ 506 width: '100%', 507 height: '350px' 508 }) 557 509 }); 558 510 </script> -
subscribility/trunk/readme.txt
r2333978 r2370819 4 4 Requires at least: 4.9.0 5 5 Tested up to: 5.4.2 6 Stable Tag: 2.9.19. 46 Stable Tag: 2.9.19.5 7 7 PHP version: 7.0 and above 8 8 License: GPLv2 or later … … 70 70 71 71 ## Changelog 72 ###Version 2.9.19.5 73 - Bug fixed with payment processing with external payment gateways. 74 - Improved plugin stability and other bugs fixed. 75 72 76 ###Version 2.9.19.4 73 77 - Added plugin action links for Settings and plugin documentation. -
subscribility/trunk/wp99234.php
r2333978 r2370819 4 4 * Plugin URI: https://wordpress.org/plugins/subscribility/ 5 5 * Description: Manage and fulfil your sales of wine, beers and other crafted beverages, through clubs and other direct-to-consumer sales channels. 6 * Version: 2.9.19. 46 * Version: 2.9.19.5 7 7 * Author: Troly 8 8 * Author URI: https://troly.io … … 280 280 include_once( 'includes/frontend/controllers/class-wp99234-template.php' ); 281 281 include_once( 'includes/frontend/controllers/class-wp99234-themes-footer.php' ); 282 282 283 283 include_once( 'includes/frontend/controllers/class-wp99234-customer-controller.php' ); 284 284 include_once( 'includes/frontend/controllers/class-wp99234-order-controller.php' );
Note: See TracChangeset
for help on using the changeset viewer.