Changeset 2428038
- Timestamp:
- 11/29/2020 09:04:03 AM (5 years ago)
- Location:
- age-checkbox-for-woocommerce
- Files:
-
- 6 added
- 2 edited
-
tags/1.1 (added)
-
tags/1.1/readme.txt (added)
-
tags/1.1/screenshot-1.png (added)
-
tags/1.1/screenshot-2.png (added)
-
tags/1.1/screenshot-3.png (added)
-
tags/1.1/woo-age-checkbox.php (added)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/woo-age-checkbox.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
age-checkbox-for-woocommerce/trunk/readme.txt
r2427874 r2428038 6 6 Tested up to: 5.6 7 7 Requires PHP: 7.1 8 Stable tag: 1. 0.28 Stable tag: 1.1 9 9 License: GPLv3 10 10 License URI: https://www.gnu.org/licenses/gpl-3.0.html … … 32 32 33 33 == Changelog == 34 = 1.1 = 35 * Added functionality that you can also use the translations from the WP repo or a custom message. This will make the plugin more versatile for multilang-websites. Thanks @fasterboy for letting me know! 36 34 37 = 1.0 = 35 38 * New artwork <3 -
age-checkbox-for-woocommerce/trunk/woo-age-checkbox.php
r2427875 r2428038 5 5 * Plugin URI: https://rikjanssen.info/plugins/age-checkbox-for-woocommerce/ 6 6 * Description: Do your users have to comply to age regulations before ordering? This plugin adds a checkbox that has to be ticked before placing an order. 7 * Version: 1. 0.28 * Author: Rik Janssen (Beta)7 * Version: 1.1 8 * Author: Rik Janssen 9 9 * Author URI: https://rikjanssen.info 10 10 * Text Domain: betawooage … … 18 18 function bcWOAG_age_policy_form() { 19 19 if(get_option( 'woocommerce_betawooage_checkbox' )=='yes'){ 20 21 if(get_option( 'woocommerce_betawooage_multilanguage' )=='yes'){ 22 $checkText = __( "You have to be 18 years or older to order products at this webshop. By checking this box you confirm that you are 18 years or older.", 'betawooage' ); 23 }else{ 24 $checkText = get_option( 'woocommerce_betawooage_checkboxemessage' ); 25 } 20 26 woocommerce_form_field( 'age_policy', array( 21 27 'type' => 'checkbox', … … 24 30 'input_class' => array('woocommerce-form__input woocommerce-form__input-checkbox input-checkbox'), 25 31 'required' => true, 26 'label' => get_option( 'woocommerce_betawooage_checkboxemessage' )32 'label' => $checkText 27 33 )); 28 34 } … … 36 42 if(get_option( 'woocommerce_betawooage_checkbox' )=='yes'){ 37 43 if ( ! (int) isset( $_POST['age_policy'] ) ) { 38 wc_add_notice( get_option( 'woocommerce_betawooage_failuremessage' ), 'error' ); 44 45 if(get_option( 'woocommerce_betawooage_multilanguage' )=='yes'){ 46 $failText = __( "<strong>Please confirm that you are 18 years or older</strong> by ticking the box!", 'betawooage' ); 47 }else{ 48 $failText = get_option( 'woocommerce_betawooage_failuremessage' ); 49 } 50 51 wc_add_notice( $failText, 'error' ); 52 39 53 } 40 54 } … … 64 78 ); 65 79 80 $newsettings[] = array( 81 'name' => __( 'Multilanguage age checkbox', 'betawooage' ), 82 'id' => 'woocommerce_betawooage_multilanguage', 83 'type' => 'checkbox', 84 'css' => '', 85 'std' => 1, // WC < 2.0 86 'default' => 1, // WC >= 2.0 87 'desc' => __( "Refer to the known translations of this plugin or create your own by using another plugin.", 'betawooage' ), 88 ); 89 if(get_option( 'woocommerce_betawooage_multilanguage' )=='no' OR get_option( 'woocommerce_betawooage_multilanguage' )==''){ 66 90 $newsettings[] = array( 67 91 'name' => __( 'Checkbox message', 'betawooage' ), … … 69 93 'type' => 'textarea', 70 94 'css' => 'min-width:300px; min-height:100px;', 71 'std' => __( "You have to be 18 years or older to order products at this webshop. By checking this box you confirm that you are 18 years or older.", 'betawooage' ), // WC < 2.072 'default' => __( "You have to be 18 years or older to order products at this webshop. By checking this box you confirm that you are 18 years or older.", 'betawooage' ), // WC >= 2.095 'std' => "You have to be 18 years or older to order products at this webshop. By checking this box you confirm that you are 18 years or older.", // WC < 2.0 96 'default' => "You have to be 18 years or older to order products at this webshop. By checking this box you confirm that you are 18 years or older.", // WC >= 2.0 73 97 'desc' => __( "Display the text people see before ticking the box.", 'betawooage' ), 74 98 ); … … 78 102 'type' => 'textarea', 79 103 'css' => 'min-width:300px; min-height:100px;', 80 'std' => __( "<strong>Please confirm that you are 18 years or older</strong> by ticking the box.", 'betawooage' ), // WC < 2.081 'default' => __( "<strong>Please confirm that you are 18 years or older</strong> by ticking the box.", 'betawooage' ), // WC >= 2.0104 'std' => "<strong>Please confirm that you are 18 years or older</strong> by ticking the box.", // WC < 2.0 105 'default' => "<strong>Please confirm that you are 18 years or older</strong> by ticking the box.", // WC >= 2.0 82 106 'desc' => __( "Display message to people that don't tick the box.", 'betawooage' ), 83 107 ); 84 108 } 85 109 } 86 110 87 111 $newsettings[] = $section; 112 88 113 } 89 114
Note: See TracChangeset
for help on using the changeset viewer.