Changeset 3489159
- Timestamp:
- 03/23/2026 03:30:12 PM (7 months ago)
- Location:
- wolve-loyalty
- Files:
-
- 4 added
- 14 edited
- 16 copied
-
tags/1.5.5 (copied) (copied from wolve-loyalty/trunk )
-
tags/1.5.5/includes/Info-page/info-page.php (modified) (2 diffs)
-
tags/1.5.5/includes/admin-page.php (copied) (copied from wolve-loyalty/trunk/includes/admin-page.php ) (11 diffs)
-
tags/1.5.5/includes/auth.php (copied) (copied from wolve-loyalty/trunk/includes/auth.php )
-
tags/1.5.5/includes/benefits/benefits.css (copied) (copied from wolve-loyalty/trunk/includes/benefits/benefits.css )
-
tags/1.5.5/includes/benefits/benefits_display.php (copied) (copied from wolve-loyalty/trunk/includes/benefits/benefits_display.php ) (4 diffs)
-
tags/1.5.5/includes/i18n (added)
-
tags/1.5.5/includes/i18n/text-defaults.php (added)
-
tags/1.5.5/includes/my-account/my-account-endpoint.php (modified) (1 diff)
-
tags/1.5.5/includes/my-account/my-account.css (copied) (copied from wolve-loyalty/trunk/includes/my-account/my-account.css )
-
tags/1.5.5/includes/my-account/my-account.php (copied) (copied from wolve-loyalty/trunk/includes/my-account/my-account.php ) (7 diffs)
-
tags/1.5.5/includes/platform-api.php (copied) (copied from wolve-loyalty/trunk/includes/platform-api.php )
-
tags/1.5.5/includes/product-points/product-points-display.php (modified) (1 diff)
-
tags/1.5.5/includes/signupForm/countries-list.php (copied) (copied from wolve-loyalty/trunk/includes/signupForm/countries-list.php )
-
tags/1.5.5/includes/signupForm/signup-form.css (copied) (copied from wolve-loyalty/trunk/includes/signupForm/signup-form.css )
-
tags/1.5.5/includes/signupForm/signup-form.js (copied) (copied from wolve-loyalty/trunk/includes/signupForm/signup-form.js )
-
tags/1.5.5/includes/signupForm/signup-form.php (copied) (copied from wolve-loyalty/trunk/includes/signupForm/signup-form.php ) (2 diffs)
-
tags/1.5.5/includes/signupForm/vipps-signup-form.js (copied) (copied from wolve-loyalty/trunk/includes/signupForm/vipps-signup-form.js ) (1 diff)
-
tags/1.5.5/includes/signupForm/vipps-signup-form.php (copied) (copied from wolve-loyalty/trunk/includes/signupForm/vipps-signup-form.php ) (1 diff)
-
tags/1.5.5/readme.txt (copied) (copied from wolve-loyalty/trunk/readme.txt ) (4 diffs)
-
tags/1.5.5/wolve-loyalty.php (copied) (copied from wolve-loyalty/trunk/wolve-loyalty.php ) (5 diffs)
-
trunk/includes/Info-page/info-page.php (modified) (2 diffs)
-
trunk/includes/admin-page.php (modified) (11 diffs)
-
trunk/includes/benefits/benefits_display.php (modified) (4 diffs)
-
trunk/includes/i18n (added)
-
trunk/includes/i18n/text-defaults.php (added)
-
trunk/includes/my-account/my-account-endpoint.php (modified) (1 diff)
-
trunk/includes/my-account/my-account.php (modified) (7 diffs)
-
trunk/includes/product-points/product-points-display.php (modified) (1 diff)
-
trunk/includes/signupForm/signup-form.php (modified) (2 diffs)
-
trunk/includes/signupForm/vipps-signup-form.js (modified) (1 diff)
-
trunk/includes/signupForm/vipps-signup-form.php (modified) (1 diff)
-
trunk/readme.txt (modified) (4 diffs)
-
trunk/wolve-loyalty.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wolve-loyalty/tags/1.5.5/includes/Info-page/info-page.php
r3391502 r3489159 515 515 516 516 // Get custom CTA title text from options 517 $cta_title_format = get_option( 'wolve_loyalty_info_cta_title', __( 'Eksklusive tilbud kun for %s-medlemmer', 'wolve-loyalty' ) );517 $cta_title_format = get_option( 'wolve_loyalty_info_cta_title', Wolve_Loyalty_Text_Defaults::get_default( 'wolve_loyalty_info_cta_title' ) ); 518 518 $html .= sprintf( 519 519 esc_html( $cta_title_format ), … … 526 526 527 527 // Get custom button text from options 528 $button_text = get_option( 'wolve_loyalty_info_button_text', __( 'Registrer deg nå', 'wolve-loyalty' ) );528 $button_text = get_option( 'wolve_loyalty_info_button_text', Wolve_Loyalty_Text_Defaults::get_default( 'wolve_loyalty_info_button_text' ) ); 529 529 530 530 $html .= ' <a href="' . esc_url( $registration_url ) . '" class="wolve-cta-button">'; -
wolve-loyalty/tags/1.5.5/includes/admin-page.php
r3478959 r3489159 52 52 function wolve_loyalty_settings_page() 53 53 { 54 // Handle "Reset Text Defaults" form submission 55 if ( isset( $_POST['wolve_reset_text_defaults'] ) && check_admin_referer( 'wolve_reset_text_defaults', 'wolve_reset_text_nonce' ) ) { 56 $locale = isset( $_POST['wolve_reset_locale'] ) ? sanitize_text_field( wp_unslash( $_POST['wolve_reset_locale'] ) ) : 'en_US'; 57 $defaults = Wolve_Loyalty_Text_Defaults::get_defaults( $locale ); 58 59 // Update individual text options 60 foreach ( $defaults as $key => $value ) { 61 if ( strpos( $key, 'signup_' ) === 0 ) { 62 continue; 63 } 64 update_option( $key, $value ); 65 } 66 67 // Update signup defaults array (merge text into existing array to preserve non-text fields) 68 $existing_signup = get_option( 'wolve_loyalty_signup_defaults', array() ); 69 $locale_signup = Wolve_Loyalty_Text_Defaults::get_signup_defaults( $locale ); 70 $merged_signup = array_merge( $existing_signup, $locale_signup ); 71 update_option( 'wolve_loyalty_signup_defaults', $merged_signup ); 72 73 update_option( 'wolve_loyalty_default_locale', $locale ); 74 75 add_settings_error( 'wolve_loyalty_options', 'text_defaults_reset', 76 sprintf( __( 'Text defaults have been reset to %s.', 'wolve-loyalty' ), Wolve_Loyalty_Text_Defaults::get_supported_locales()[ $locale ] ?? $locale ), 77 'updated' 78 ); 79 } 80 54 81 // Unslash and sanitize the 'tab' parameter 55 82 $tab = isset($_GET['tab']) ? sanitize_text_field(wp_unslash($_GET['tab'])) : 'general'; … … 108 135 </div> 109 136 </form> 137 138 <!-- Reset Text Defaults to Language --> 139 <div style="margin-top: 30px; padding: 20px; background: #fff; border: 1px solid #ccd0d4; border-radius: 4px; max-width: 600px;"> 140 <h3 style="margin-top: 0;"><?php esc_html_e( 'Reset Text Defaults', 'wolve-loyalty' ); ?></h3> 141 <p class="description" style="margin-bottom: 12px;"> 142 <?php esc_html_e( 'Reset all customer-facing text fields (signup form, my page, benefits, info page) to the selected language defaults. This will overwrite your current text settings but will not affect colors or API settings.', 'wolve-loyalty' ); ?> 143 </p> 144 <form method="post"> 145 <?php wp_nonce_field( 'wolve_reset_text_defaults', 'wolve_reset_text_nonce' ); ?> 146 <?php $current_locale = get_option( 'wolve_loyalty_default_locale', get_locale() ); ?> 147 <select name="wolve_reset_locale" style="vertical-align: middle;"> 148 <?php foreach ( Wolve_Loyalty_Text_Defaults::get_supported_locales() as $code => $name ) : ?> 149 <option value="<?php echo esc_attr( $code ); ?>" <?php selected( $code, $current_locale ); ?>><?php echo esc_html( $name ); ?></option> 150 <?php endforeach; ?> 151 </select> 152 <button type="submit" name="wolve_reset_text_defaults" class="button button-secondary" style="vertical-align: middle;" 153 onclick="return confirm('<?php echo esc_js( __( 'This will overwrite all your current text settings with the selected language defaults. Are you sure?', 'wolve-loyalty' ) ); ?>');"> 154 <?php esc_html_e( 'Reset to Language Defaults', 'wolve-loyalty' ); ?> 155 </button> 156 </form> 157 </div> 158 110 159 <?php 111 160 } elseif ($tab === 'connect-and-activate') { … … 335 384 } 336 385 } 337 386 387 // Save My Account tab label 388 if (isset($_POST['wolve_loyalty_myaccount_tab_label'])) { 389 update_option('wolve_loyalty_myaccount_tab_label', sanitize_text_field(wp_unslash($_POST['wolve_loyalty_myaccount_tab_label']))); 390 } 391 338 392 // Save colors 339 393 $color_fields = [ … … 363 417 364 418 // Get current values 365 $default_welcome = __('Hey! Welcome to our loyalty program. You can see all your rewards below (if any). To use any rewards, please go to the checkout page.', 'wolve-loyalty'); 366 $welcome_message = get_option('wolve_loyalty_welcome_message', $default_welcome); 367 368 $default_greeting = __('Kjære %navn', 'wolve-loyalty'); 369 $greeting_format = get_option('wolve_loyalty_greeting_format', $default_greeting); 370 371 $default_login_prompt = __('Please [login_link]log in[/login_link] to view your loyalty rewards.', 'wolve-loyalty'); 372 $login_prompt = get_option('wolve_loyalty_login_prompt', $default_login_prompt); 419 $welcome_message = get_option('wolve_loyalty_welcome_message', Wolve_Loyalty_Text_Defaults::get_default('wolve_loyalty_welcome_message')); 420 $greeting_format = get_option('wolve_loyalty_greeting_format', Wolve_Loyalty_Text_Defaults::get_default('wolve_loyalty_greeting_format')); 421 $login_prompt = get_option('wolve_loyalty_login_prompt', Wolve_Loyalty_Text_Defaults::get_default('wolve_loyalty_login_prompt')); 373 422 374 423 $login_url = get_option('wolve_loyalty_login_url', ''); … … 558 607 <?php checked(1, get_option('wolve_loyalty_enable_myaccount_endpoint', 0)); ?> /> 559 608 <label for="wolve_loyalty_enable_myaccount_endpoint"> 560 <?php esc_html_e('Add a "Lojalitetsprogram"tab to the WooCommerce My Account menu', 'wolve-loyalty'); ?>609 <?php esc_html_e('Add a loyalty tab to the WooCommerce My Account menu', 'wolve-loyalty'); ?> 561 610 </label> 562 611 <p class="description"> 563 <?php esc_html_e('When enabled, customers will see a native "Lojalitetsprogram"tab in their My Account sidebar (next to Dashboard, Orders, etc.) that displays their loyalty profile. If disabled, you can use the [wolve_loyalty_profile] shortcode to display the profile on any page.', 'wolve-loyalty'); ?>612 <?php esc_html_e('When enabled, customers will see a loyalty tab in their My Account sidebar (next to Dashboard, Orders, etc.) that displays their loyalty profile. If disabled, you can use the [wolve_loyalty_profile] shortcode to display the profile on any page.', 'wolve-loyalty'); ?> 564 613 <br> 565 614 <strong><?php esc_html_e('Note:', 'wolve-loyalty'); ?></strong> 566 615 <?php esc_html_e('After enabling or disabling this option, go to Settings → Permalinks and click "Save Changes" to refresh rewrite rules.', 'wolve-loyalty'); ?> 616 </p> 617 </td> 618 </tr> 619 <tr> 620 <th scope="row"> 621 <label for="wolve_loyalty_myaccount_tab_label"><?php esc_html_e('Tab Label', 'wolve-loyalty'); ?></label> 622 </th> 623 <td> 624 <input type="text" 625 id="wolve_loyalty_myaccount_tab_label" 626 name="wolve_loyalty_myaccount_tab_label" 627 value="<?php echo esc_attr( get_option( 'wolve_loyalty_myaccount_tab_label', Wolve_Loyalty_Text_Defaults::get_default( 'wolve_loyalty_myaccount_tab_label' ) ) ); ?>" 628 style="width: 100%; max-width: 400px;"> 629 <p class="description"> 630 <?php esc_html_e('The label shown in the WooCommerce My Account sidebar menu.', 'wolve-loyalty'); ?> 567 631 </p> 568 632 </td> … … 760 824 761 825 // Get current values 762 $default_heading = __('Your benefits', 'wolve-loyalty'); 763 $benefits_heading = get_option('wolve_loyalty_benefits_heading', $default_heading); 764 765 $default_no_rewards = __('Do not use my rewards', 'wolve-loyalty'); 766 $no_rewards_text = get_option('wolve_loyalty_no_rewards_text', $default_no_rewards); 767 768 $default_no_available_rewards = __('No available rewards at this time.', 'wolve-loyalty'); 769 $no_available_rewards_text = get_option('wolve_loyalty_no_available_rewards_text', $default_no_available_rewards); 826 $benefits_heading = get_option('wolve_loyalty_benefits_heading', Wolve_Loyalty_Text_Defaults::get_default('wolve_loyalty_benefits_heading')); 827 $no_rewards_text = get_option('wolve_loyalty_no_rewards_text', Wolve_Loyalty_Text_Defaults::get_default('wolve_loyalty_no_rewards_text')); 828 $no_available_rewards_text = get_option('wolve_loyalty_no_available_rewards_text', Wolve_Loyalty_Text_Defaults::get_default('wolve_loyalty_no_available_rewards_text')); 770 829 ?> 771 830 … … 880 939 id="wolve_loyalty_points_text" 881 940 name="wolve_loyalty_points_text" 882 value="<?php echo esc_attr(get_option('wolve_loyalty_points_text', __('Earn {points} points with this purchase', 'wolve-loyalty'))); ?>"941 value="<?php echo esc_attr(get_option('wolve_loyalty_points_text', Wolve_Loyalty_Text_Defaults::get_default('wolve_loyalty_points_text'))); ?>" 883 942 style="width: 100%; max-width: 400px;"> 884 943 <p class="description"> … … 1301 1360 id="wolve_loyalty_tier_points_format" 1302 1361 name="wolve_loyalty_tier_points_format" 1303 value="<?php echo esc_attr(get_option('wolve_loyalty_tier_points_format', '{current} / {total}')); ?>"1362 value="<?php echo esc_attr(get_option('wolve_loyalty_tier_points_format', Wolve_Loyalty_Text_Defaults::get_default('wolve_loyalty_tier_points_format'))); ?>" 1304 1363 placeholder="{current} / {total}" 1305 1364 style="width: 100%; max-width: 400px;"> … … 1333 1392 id="wolve_loyalty_tier_points_remaining" 1334 1393 name="wolve_loyalty_tier_points_remaining" 1335 value="<?php echo esc_attr(get_option('wolve_loyalty_tier_points_remaining', '{points_remaining} points left')); ?>"1394 value="<?php echo esc_attr(get_option('wolve_loyalty_tier_points_remaining', Wolve_Loyalty_Text_Defaults::get_default('wolve_loyalty_tier_points_remaining'))); ?>" 1336 1395 placeholder="{points_remaining} points left" 1337 1396 style="width: 100%; max-width: 400px;"> … … 1957 2016 // Get current values 1958 2017 $registration_url = get_option('wolve_loyalty_registration_url', ''); 1959 $button_text = get_option('wolve_loyalty_info_button_text', 'Registrer deg nå');1960 $cta_title = get_option('wolve_loyalty_info_cta_title', 'Eksklusive tilbud kun for %s-medlemmer');2018 $button_text = get_option('wolve_loyalty_info_button_text', Wolve_Loyalty_Text_Defaults::get_default('wolve_loyalty_info_button_text')); 2019 $cta_title = get_option('wolve_loyalty_info_cta_title', Wolve_Loyalty_Text_Defaults::get_default('wolve_loyalty_info_cta_title')); 1961 2020 ?> 1962 2021 … … 2370 2429 function wolve_loyalty_signup_defaults_callback() 2371 2430 { 2372 $defaults = get_option('wolve_loyalty_signup_defaults', [ 2373 'show_fields' => 'country_code,phone_number,email,first_name,last_name', 2374 'required_fields' => 'country_code,phone_number', 2375 'button_text' => 'Bli medlem', 2376 'success_message' => 'Takk for at du ble medlem i vår kundeklubb!', 2377 'already_member_message' => 'Du er allerede medlem av vår kundeklubb!', 2378 'form_title' => 'Bli med i vår kundeklubb', 2379 'form_description' => '', 2380 'marketing_consent_notice' => 'Ved å bli medlem aksepterer du våre markedsføringsbetingelser, og vil motta tilbud på e-post og SMS', 2381 'hide_form_shadow' => '' 2382 ]); 2431 $defaults = get_option('wolve_loyalty_signup_defaults', Wolve_Loyalty_Text_Defaults::get_signup_defaults()); 2383 2432 2384 2433 error_log('Form display - retrieved defaults: ' . print_r($defaults, true)); -
wolve-loyalty/tags/1.5.5/includes/benefits/benefits_display.php
r3458103 r3489159 36 36 // Check if data is retrieved 37 37 if (empty($wolve_loyalty_benefits)) { 38 $no_available_rewards_text = get_option('wolve_loyalty_no_available_rewards_text', __('No available rewards at this time.', 'wolve-loyalty'));38 $no_available_rewards_text = get_option('wolve_loyalty_no_available_rewards_text', Wolve_Loyalty_Text_Defaults::get_default('wolve_loyalty_no_available_rewards_text')); 39 39 echo '<p>' . esc_html($no_available_rewards_text) . '</p>'; 40 40 return; … … 44 44 45 45 // Get custom benefits heading or use default 46 $default_heading = __('Your benefits', 'wolve-loyalty'); 47 $benefits_heading = get_option('wolve_loyalty_benefits_heading', $default_heading); 48 46 $benefits_heading = get_option('wolve_loyalty_benefits_heading', Wolve_Loyalty_Text_Defaults::get_default('wolve_loyalty_benefits_heading')); 47 49 48 // Get custom no rewards text or use default 50 $default_no_rewards = __('Do not use my rewards', 'wolve-loyalty'); 51 $no_rewards_text = get_option('wolve_loyalty_no_rewards_text', $default_no_rewards); 49 $no_rewards_text = get_option('wolve_loyalty_no_rewards_text', Wolve_Loyalty_Text_Defaults::get_default('wolve_loyalty_no_rewards_text')); 52 50 53 51 // Get tile color settings … … 142 140 $points_label = get_option('wolve_loyalty_tier_points_label', ''); 143 141 if (empty($points_label)) { 144 $points_label = __('Points', 'wolve-loyalty');145 } 146 147 $points_format = get_option('wolve_loyalty_tier_points_format', '{current} / {total}');142 $points_label = Wolve_Loyalty_Text_Defaults::get_default('wolve_loyalty_tier_points_label'); 143 } 144 145 $points_format = get_option('wolve_loyalty_tier_points_format', Wolve_Loyalty_Text_Defaults::get_default('wolve_loyalty_tier_points_format')); 148 146 if (empty($points_format)) { 149 $points_format = '{current} / {total}';147 $points_format = Wolve_Loyalty_Text_Defaults::get_default('wolve_loyalty_tier_points_format'); 150 148 } 151 149 // Replace placeholders with actual values … … 158 156 $next_tier_label = get_option('wolve_loyalty_tier_next_label', ''); 159 157 if (empty($next_tier_label)) { 160 $next_tier_label = __('Next tier', 'wolve-loyalty');161 } 162 163 $points_remaining_format = get_option('wolve_loyalty_tier_points_remaining', '{points_remaining} points left');158 $next_tier_label = Wolve_Loyalty_Text_Defaults::get_default('wolve_loyalty_tier_next_label'); 159 } 160 161 $points_remaining_format = get_option('wolve_loyalty_tier_points_remaining', Wolve_Loyalty_Text_Defaults::get_default('wolve_loyalty_tier_points_remaining')); 164 162 if (empty($points_remaining_format)) { 165 $points_remaining_format = '{points_remaining} points left';163 $points_remaining_format = Wolve_Loyalty_Text_Defaults::get_default('wolve_loyalty_tier_points_remaining'); 166 164 } 167 165 // Replace placeholder with actual points remaining -
wolve-loyalty/tags/1.5.5/includes/my-account/my-account-endpoint.php
r3395952 r3489159 107 107 $menu_label = apply_filters( 108 108 'wolve_loyalty_menu_label', 109 __( 'Lojalitetsprogram', 'wolve-loyalty')109 get_option( 'wolve_loyalty_myaccount_tab_label', Wolve_Loyalty_Text_Defaults::get_default( 'wolve_loyalty_myaccount_tab_label' ) ) 110 110 ); 111 111 -
wolve-loyalty/tags/1.5.5/includes/my-account/my-account.php
r3478959 r3489159 12 12 if ( ! is_user_logged_in() ) { 13 13 // Get the custom login prompt message or use default 14 $default_prompt = __('Please [login_link]log in[/login_link] to view your loyalty rewards.', 'wolve-loyalty'); 15 $login_prompt = get_option('wolve_loyalty_login_prompt', $default_prompt); 14 $login_prompt = get_option('wolve_loyalty_login_prompt', Wolve_Loyalty_Text_Defaults::get_default('wolve_loyalty_login_prompt')); 16 15 17 16 // Get the login URL - use custom URL if set, otherwise use WordPress default … … 90 89 $points_label = get_option('wolve_loyalty_tier_points_label', ''); 91 90 if ( empty( $points_label ) ) { 92 $points_label = __( 'Points', 'wolve-loyalty' );91 $points_label = Wolve_Loyalty_Text_Defaults::get_default( 'wolve_loyalty_tier_points_label' ); 93 92 } 94 93 … … 98 97 $optout_label = get_option('wolve_loyalty_optout_label', ''); 99 98 if ( empty( $optout_label ) ) { 100 $optout_label = __( 'Avmelding', 'wolve-loyalty' );99 $optout_label = Wolve_Loyalty_Text_Defaults::get_default( 'wolve_loyalty_optout_label' ); 101 100 } 102 101 … … 148 147 $next_tier_label = get_option('wolve_loyalty_tier_next_label', ''); 149 148 if ( empty( $next_tier_label ) ) { 150 $next_tier_label = __( 'Current tier', 'wolve-loyalty' );149 $next_tier_label = Wolve_Loyalty_Text_Defaults::get_default( 'wolve_loyalty_tier_next_label' ); 151 150 } 152 151 $html .= '<div class="wolve-member-next-tier">' . esc_html( $next_tier_label ) . ': ' . esc_html( $current_tier_name ) . '</div>'; … … 155 154 // Points remaining 156 155 if ( $points_to_next > 0 && ! empty( $next_tier_name ) ) { 157 $points_remaining_format = get_option('wolve_loyalty_tier_points_remaining', '{points_remaining} points left');156 $points_remaining_format = get_option('wolve_loyalty_tier_points_remaining', Wolve_Loyalty_Text_Defaults::get_default('wolve_loyalty_tier_points_remaining')); 158 157 if ( empty( $points_remaining_format ) ) { 159 $points_remaining_format = '{points_remaining} points left';158 $points_remaining_format = Wolve_Loyalty_Text_Defaults::get_default('wolve_loyalty_tier_points_remaining'); 160 159 } 161 160 $formatted_remaining = str_replace( '{points_remaining}', number_format( $points_to_next ), $points_remaining_format ); … … 176 175 $checkout_prompt = get_option('wolve_loyalty_checkout_prompt', ''); 177 176 if ( empty( $checkout_prompt ) ) { 178 $checkout_prompt = __( 'Gå til kassen for å bruke dine fordeler', 'wolve-loyalty' );177 $checkout_prompt = Wolve_Loyalty_Text_Defaults::get_default( 'wolve_loyalty_checkout_prompt' ); 179 178 } 180 179 $html .= '<div class="wolve-member-checkout-prompt">' . esc_html( $checkout_prompt ) . '</div>'; … … 230 229 $coupons_title = get_option('wolve_loyalty_coupons_title', ''); 231 230 if ( empty( $coupons_title ) ) { 232 $coupons_title = __( 'Dine kuponger', 'wolve-loyalty' );231 $coupons_title = Wolve_Loyalty_Text_Defaults::get_default( 'wolve_loyalty_coupons_title' ); 233 232 } 234 233 -
wolve-loyalty/tags/1.5.5/includes/product-points/product-points-display.php
r3415409 r3489159 114 114 115 115 // Get customized text template 116 $points_text_template = get_option('wolve_loyalty_points_text', __('Earn {points} points with this purchase', 'wolve-loyalty'));116 $points_text_template = get_option('wolve_loyalty_points_text', Wolve_Loyalty_Text_Defaults::get_default('wolve_loyalty_points_text')); 117 117 $display_style = get_option('wolve_loyalty_points_style', 'default'); 118 118 -
wolve-loyalty/tags/1.5.5/includes/signupForm/signup-form.php
r3458103 r3489159 81 81 82 82 // Get default settings from admin 83 $admin_defaults = get_option('wolve_loyalty_signup_defaults', [ 84 'show_fields' => 'country_code,phone_number,email,first_name,last_name', 85 'required_fields' => 'country_code,phone_number', 86 'button_text' => __('Bli medlem', 'wolve-loyalty'), 87 'success_message' => __('Takk for at du ble medlem i vår kundeklubb!', 'wolve-loyalty'), 88 'form_title' => __('Bli med i vår kundeklubb', 'wolve-loyalty'), 89 'form_description' => '', 90 'marketing_consent_notice' => __('Ved å bli medlem aksepterer du våre markedsføringsbetingelser, og vil motta tilbud på e-post og SMS', 'wolve-loyalty') 91 ]); 83 $admin_defaults = get_option('wolve_loyalty_signup_defaults', Wolve_Loyalty_Text_Defaults::get_signup_defaults()); 92 84 93 85 // Parse shortcode attributes with admin defaults as fallback … … 335 327 break; 336 328 case 'phone_number': 337 // Combine country code with local number338 329 if (!empty($value)) { 339 // Remove all non-numeric characters 340 $value = preg_replace('/[^0-9]/', '', $value); 341 // Remove leading zeros 342 $value = ltrim($value, '0'); 343 $member_data['phone_number'] = $country_code . $value; 330 if (strpos($value, '+') === 0) { 331 // Phone already has country code (e.g. from combined field) — use as-is 332 $member_data['phone_number'] = preg_replace('/[^0-9+]/', '', $value); 333 } else { 334 // Local number only — combine with country code 335 $value = preg_replace('/[^0-9]/', '', $value); 336 $value = ltrim($value, '0'); 337 $member_data['phone_number'] = $country_code . $value; 338 } 344 339 } 345 340 break; -
wolve-loyalty/tags/1.5.5/includes/signupForm/vipps-signup-form.js
r3478959 r3489159 540 540 541 541 const phoneNumberVal = $phoneDisplay.val().replace(/\s+/g, ''); 542 const fullPhone = countryCodeVal + phoneNumberVal;543 $phoneHidden.val( fullPhone);542 // Set phone_number to local number only (backend combines with country_code) 543 $phoneHidden.val(phoneNumberVal); 544 544 // Also update the display field's name for proper form submission 545 545 $phoneDisplay.attr('name', 'phone_number_display_only'); 546 547 // Add country_code field for backend processing 548 if (!$form.find('input[name="country_code"]').length) { 549 $form.append('<input type="hidden" name="country_code" value="' + countryCodeVal + '">'); 550 } else { 551 $form.find('input[name="country_code"]').val(countryCodeVal); 552 } 546 553 } 547 554 } -
wolve-loyalty/tags/1.5.5/includes/signupForm/vipps-signup-form.php
r3478959 r3489159 203 203 public function render_vipps_shortcode($atts) { 204 204 // Get default settings from admin 205 $admin_defaults = get_option('wolve_loyalty_signup_defaults', [ 206 'show_fields' => 'phone_number,email,first_name,last_name', 207 'required_fields' => 'phone_number', 208 'button_text' => __('Bli medlem', 'wolve-loyalty'), 209 'success_message' => __('Takk for at du ble medlem i vår kundeklubb!', 'wolve-loyalty'), 210 'form_title' => __('Bli med i vår kundeklubb', 'wolve-loyalty'), 211 'form_description' => '', 212 'marketing_consent_notice' => __('Ved å bli medlem aksepterer du våre markedsføringsbetingelser, og vil motta tilbud på e-post og SMS', 'wolve-loyalty') 213 ]); 205 $admin_defaults = get_option('wolve_loyalty_signup_defaults', Wolve_Loyalty_Text_Defaults::get_signup_defaults()); 214 206 215 207 // Parse shortcode attributes -
wolve-loyalty/tags/1.5.5/readme.txt
r3478959 r3489159 1 1 === Wolve Loyalty === 2 2 Contributors: josephnimoson 3 Tags: loyalty, rewards, customer engagement, retention, points, referrals, woocommerce3 Tags: loyalty, customer engagement, retention, points, woocommerce 4 4 Requires at least: 1.0.0 5 5 Tested up to: 6.9.1 6 Stable tag: 1.5. 36 Stable tag: 1.5.5 7 7 License: GPL-2.0-or-later 8 8 License URI: https://www.gnu.org/licenses/gpl-2.0.html 9 9 10 == Short Description ==11 10 Losing customers without understanding why? Use Wolve to win customers back. Loyalty and Retention solution. 12 11 … … 26 25 == Installation == 27 26 28 1. Upload the plugin files to the `/wp-content/plugins/wolve-loyalty `=directory, or install via the WordPress plugin repository.27 1. Upload the plugin files to the `/wp-content/plugins/wolve-loyalty/` directory, or install via the WordPress plugin repository. 29 28 2. Activate the plugin through the 'Plugins' screen in WordPress. 30 29 3. Access the plugin settings via the newly created 'Wolve Loyalty' menu. … … 51 50 5. **Shopper Experience (End-to-End)** - Show points on product pages, give customers a My Loyalty page in their account, and let them redeem at checkout without leaving the flow. A complete earn-and-burn experience for WooCommerce. 52 51 6. **Support** - Fast, live support available 24/7 across time zones. Get help with onboarding, best-practice playbooks, and optimization whenever you need it. 52 53 = 1.5.5 = 54 - translation preset update and bugfix in form. 53 55 54 56 = 1.5.3 = … … 133 135 134 136 – Added support for woocommerce datavisualization. 135 136 -
wolve-loyalty/tags/1.5.5/wolve-loyalty.php
r3478959 r3489159 6 6 * Author URI: https://wolve.ai 7 7 * Tested up to: 6.9.1 8 * Version: 1.5. 38 * Version: 1.5.5 9 9 * Text Domain: wolve-loyalty 10 10 * License: GPL-2.0-or-later … … 17 17 } 18 18 19 require_once plugin_dir_path(__FILE__) . 'includes/i18n/text-defaults.php'; 19 20 require_once plugin_dir_path(__FILE__) . 'includes/admin-page.php'; 20 21 require_once plugin_dir_path(__FILE__) . 'includes/member/member.php'; … … 74 75 $this->is_connected = get_option('wolve_loyalty_is_connected'); 75 76 77 // Run upgrade check for version-based migrations 78 $this->maybe_run_upgrade(); 79 76 80 // Load plugin text domain for translations 77 81 add_action('plugins_loaded', array($this, 'load_textdomain')); … … 87 91 public function load_textdomain() { 88 92 load_plugin_textdomain('wolve-loyalty', false, dirname(plugin_basename(__FILE__)) . '/languages/'); 93 } 94 95 /** 96 * Run version-based upgrades. Populates new text fields added in later versions 97 * using add_option() so existing customised values are never overwritten. 98 */ 99 private function maybe_run_upgrade() { 100 $current_version = '1.5.4'; 101 $stored_version = get_option( 'wolve_loyalty_plugin_version', '0' ); 102 103 if ( version_compare( $stored_version, $current_version, '>=' ) ) { 104 return; 105 } 106 107 // For existing clients (have API key), preserve the Norwegian tab label 108 // they've been seeing, rather than switching to their locale's default. 109 if ( get_option( 'wolve_loyalty_api_key', false ) ) { 110 add_option( 'wolve_loyalty_myaccount_tab_label', 'Lojalitetsprogram' ); 111 } 112 113 // Populate any text defaults that don't exist yet (safe for existing values) 114 $locale = get_option( 'wolve_loyalty_default_locale', get_locale() ); 115 $defaults = Wolve_Loyalty_Text_Defaults::get_defaults( $locale ); 116 117 foreach ( $defaults as $key => $value ) { 118 if ( strpos( $key, 'signup_' ) === 0 ) { 119 continue; 120 } 121 add_option( $key, $value ); 122 } 123 124 update_option( 'wolve_loyalty_plugin_version', $current_version ); 89 125 } 90 126 … … 470 506 471 507 508 // ── Activation hook: populate locale-aware text defaults on fresh install ── 509 register_activation_hook( __FILE__, 'wolve_loyalty_activate' ); 510 511 function wolve_loyalty_activate() { 512 $has_version = get_option( 'wolve_loyalty_plugin_version', false ); 513 $has_api_key = get_option( 'wolve_loyalty_api_key', false ); 514 515 if ( ! $has_version && ! $has_api_key ) { 516 // Fresh install — populate text defaults based on site locale 517 $locale = get_locale(); 518 $defaults = Wolve_Loyalty_Text_Defaults::get_defaults( $locale ); 519 520 // Individual text options (add_option is a no-op if option already exists) 521 foreach ( $defaults as $key => $value ) { 522 // Skip signup_ prefixed keys — those go into the array option 523 if ( strpos( $key, 'signup_' ) === 0 ) { 524 continue; 525 } 526 add_option( $key, $value ); 527 } 528 529 // Signup defaults array 530 $signup_defaults = Wolve_Loyalty_Text_Defaults::get_signup_defaults( $locale ); 531 add_option( 'wolve_loyalty_signup_defaults', $signup_defaults ); 532 533 update_option( 'wolve_loyalty_default_locale', $locale ); 534 } 535 536 update_option( 'wolve_loyalty_plugin_version', '1.5.4' ); 537 } 538 472 539 new Wolveloyalty(); 473 540 -
wolve-loyalty/trunk/includes/Info-page/info-page.php
r3391502 r3489159 515 515 516 516 // Get custom CTA title text from options 517 $cta_title_format = get_option( 'wolve_loyalty_info_cta_title', __( 'Eksklusive tilbud kun for %s-medlemmer', 'wolve-loyalty' ) );517 $cta_title_format = get_option( 'wolve_loyalty_info_cta_title', Wolve_Loyalty_Text_Defaults::get_default( 'wolve_loyalty_info_cta_title' ) ); 518 518 $html .= sprintf( 519 519 esc_html( $cta_title_format ), … … 526 526 527 527 // Get custom button text from options 528 $button_text = get_option( 'wolve_loyalty_info_button_text', __( 'Registrer deg nå', 'wolve-loyalty' ) );528 $button_text = get_option( 'wolve_loyalty_info_button_text', Wolve_Loyalty_Text_Defaults::get_default( 'wolve_loyalty_info_button_text' ) ); 529 529 530 530 $html .= ' <a href="' . esc_url( $registration_url ) . '" class="wolve-cta-button">'; -
wolve-loyalty/trunk/includes/admin-page.php
r3478959 r3489159 52 52 function wolve_loyalty_settings_page() 53 53 { 54 // Handle "Reset Text Defaults" form submission 55 if ( isset( $_POST['wolve_reset_text_defaults'] ) && check_admin_referer( 'wolve_reset_text_defaults', 'wolve_reset_text_nonce' ) ) { 56 $locale = isset( $_POST['wolve_reset_locale'] ) ? sanitize_text_field( wp_unslash( $_POST['wolve_reset_locale'] ) ) : 'en_US'; 57 $defaults = Wolve_Loyalty_Text_Defaults::get_defaults( $locale ); 58 59 // Update individual text options 60 foreach ( $defaults as $key => $value ) { 61 if ( strpos( $key, 'signup_' ) === 0 ) { 62 continue; 63 } 64 update_option( $key, $value ); 65 } 66 67 // Update signup defaults array (merge text into existing array to preserve non-text fields) 68 $existing_signup = get_option( 'wolve_loyalty_signup_defaults', array() ); 69 $locale_signup = Wolve_Loyalty_Text_Defaults::get_signup_defaults( $locale ); 70 $merged_signup = array_merge( $existing_signup, $locale_signup ); 71 update_option( 'wolve_loyalty_signup_defaults', $merged_signup ); 72 73 update_option( 'wolve_loyalty_default_locale', $locale ); 74 75 add_settings_error( 'wolve_loyalty_options', 'text_defaults_reset', 76 sprintf( __( 'Text defaults have been reset to %s.', 'wolve-loyalty' ), Wolve_Loyalty_Text_Defaults::get_supported_locales()[ $locale ] ?? $locale ), 77 'updated' 78 ); 79 } 80 54 81 // Unslash and sanitize the 'tab' parameter 55 82 $tab = isset($_GET['tab']) ? sanitize_text_field(wp_unslash($_GET['tab'])) : 'general'; … … 108 135 </div> 109 136 </form> 137 138 <!-- Reset Text Defaults to Language --> 139 <div style="margin-top: 30px; padding: 20px; background: #fff; border: 1px solid #ccd0d4; border-radius: 4px; max-width: 600px;"> 140 <h3 style="margin-top: 0;"><?php esc_html_e( 'Reset Text Defaults', 'wolve-loyalty' ); ?></h3> 141 <p class="description" style="margin-bottom: 12px;"> 142 <?php esc_html_e( 'Reset all customer-facing text fields (signup form, my page, benefits, info page) to the selected language defaults. This will overwrite your current text settings but will not affect colors or API settings.', 'wolve-loyalty' ); ?> 143 </p> 144 <form method="post"> 145 <?php wp_nonce_field( 'wolve_reset_text_defaults', 'wolve_reset_text_nonce' ); ?> 146 <?php $current_locale = get_option( 'wolve_loyalty_default_locale', get_locale() ); ?> 147 <select name="wolve_reset_locale" style="vertical-align: middle;"> 148 <?php foreach ( Wolve_Loyalty_Text_Defaults::get_supported_locales() as $code => $name ) : ?> 149 <option value="<?php echo esc_attr( $code ); ?>" <?php selected( $code, $current_locale ); ?>><?php echo esc_html( $name ); ?></option> 150 <?php endforeach; ?> 151 </select> 152 <button type="submit" name="wolve_reset_text_defaults" class="button button-secondary" style="vertical-align: middle;" 153 onclick="return confirm('<?php echo esc_js( __( 'This will overwrite all your current text settings with the selected language defaults. Are you sure?', 'wolve-loyalty' ) ); ?>');"> 154 <?php esc_html_e( 'Reset to Language Defaults', 'wolve-loyalty' ); ?> 155 </button> 156 </form> 157 </div> 158 110 159 <?php 111 160 } elseif ($tab === 'connect-and-activate') { … … 335 384 } 336 385 } 337 386 387 // Save My Account tab label 388 if (isset($_POST['wolve_loyalty_myaccount_tab_label'])) { 389 update_option('wolve_loyalty_myaccount_tab_label', sanitize_text_field(wp_unslash($_POST['wolve_loyalty_myaccount_tab_label']))); 390 } 391 338 392 // Save colors 339 393 $color_fields = [ … … 363 417 364 418 // Get current values 365 $default_welcome = __('Hey! Welcome to our loyalty program. You can see all your rewards below (if any). To use any rewards, please go to the checkout page.', 'wolve-loyalty'); 366 $welcome_message = get_option('wolve_loyalty_welcome_message', $default_welcome); 367 368 $default_greeting = __('Kjære %navn', 'wolve-loyalty'); 369 $greeting_format = get_option('wolve_loyalty_greeting_format', $default_greeting); 370 371 $default_login_prompt = __('Please [login_link]log in[/login_link] to view your loyalty rewards.', 'wolve-loyalty'); 372 $login_prompt = get_option('wolve_loyalty_login_prompt', $default_login_prompt); 419 $welcome_message = get_option('wolve_loyalty_welcome_message', Wolve_Loyalty_Text_Defaults::get_default('wolve_loyalty_welcome_message')); 420 $greeting_format = get_option('wolve_loyalty_greeting_format', Wolve_Loyalty_Text_Defaults::get_default('wolve_loyalty_greeting_format')); 421 $login_prompt = get_option('wolve_loyalty_login_prompt', Wolve_Loyalty_Text_Defaults::get_default('wolve_loyalty_login_prompt')); 373 422 374 423 $login_url = get_option('wolve_loyalty_login_url', ''); … … 558 607 <?php checked(1, get_option('wolve_loyalty_enable_myaccount_endpoint', 0)); ?> /> 559 608 <label for="wolve_loyalty_enable_myaccount_endpoint"> 560 <?php esc_html_e('Add a "Lojalitetsprogram"tab to the WooCommerce My Account menu', 'wolve-loyalty'); ?>609 <?php esc_html_e('Add a loyalty tab to the WooCommerce My Account menu', 'wolve-loyalty'); ?> 561 610 </label> 562 611 <p class="description"> 563 <?php esc_html_e('When enabled, customers will see a native "Lojalitetsprogram"tab in their My Account sidebar (next to Dashboard, Orders, etc.) that displays their loyalty profile. If disabled, you can use the [wolve_loyalty_profile] shortcode to display the profile on any page.', 'wolve-loyalty'); ?>612 <?php esc_html_e('When enabled, customers will see a loyalty tab in their My Account sidebar (next to Dashboard, Orders, etc.) that displays their loyalty profile. If disabled, you can use the [wolve_loyalty_profile] shortcode to display the profile on any page.', 'wolve-loyalty'); ?> 564 613 <br> 565 614 <strong><?php esc_html_e('Note:', 'wolve-loyalty'); ?></strong> 566 615 <?php esc_html_e('After enabling or disabling this option, go to Settings → Permalinks and click "Save Changes" to refresh rewrite rules.', 'wolve-loyalty'); ?> 616 </p> 617 </td> 618 </tr> 619 <tr> 620 <th scope="row"> 621 <label for="wolve_loyalty_myaccount_tab_label"><?php esc_html_e('Tab Label', 'wolve-loyalty'); ?></label> 622 </th> 623 <td> 624 <input type="text" 625 id="wolve_loyalty_myaccount_tab_label" 626 name="wolve_loyalty_myaccount_tab_label" 627 value="<?php echo esc_attr( get_option( 'wolve_loyalty_myaccount_tab_label', Wolve_Loyalty_Text_Defaults::get_default( 'wolve_loyalty_myaccount_tab_label' ) ) ); ?>" 628 style="width: 100%; max-width: 400px;"> 629 <p class="description"> 630 <?php esc_html_e('The label shown in the WooCommerce My Account sidebar menu.', 'wolve-loyalty'); ?> 567 631 </p> 568 632 </td> … … 760 824 761 825 // Get current values 762 $default_heading = __('Your benefits', 'wolve-loyalty'); 763 $benefits_heading = get_option('wolve_loyalty_benefits_heading', $default_heading); 764 765 $default_no_rewards = __('Do not use my rewards', 'wolve-loyalty'); 766 $no_rewards_text = get_option('wolve_loyalty_no_rewards_text', $default_no_rewards); 767 768 $default_no_available_rewards = __('No available rewards at this time.', 'wolve-loyalty'); 769 $no_available_rewards_text = get_option('wolve_loyalty_no_available_rewards_text', $default_no_available_rewards); 826 $benefits_heading = get_option('wolve_loyalty_benefits_heading', Wolve_Loyalty_Text_Defaults::get_default('wolve_loyalty_benefits_heading')); 827 $no_rewards_text = get_option('wolve_loyalty_no_rewards_text', Wolve_Loyalty_Text_Defaults::get_default('wolve_loyalty_no_rewards_text')); 828 $no_available_rewards_text = get_option('wolve_loyalty_no_available_rewards_text', Wolve_Loyalty_Text_Defaults::get_default('wolve_loyalty_no_available_rewards_text')); 770 829 ?> 771 830 … … 880 939 id="wolve_loyalty_points_text" 881 940 name="wolve_loyalty_points_text" 882 value="<?php echo esc_attr(get_option('wolve_loyalty_points_text', __('Earn {points} points with this purchase', 'wolve-loyalty'))); ?>"941 value="<?php echo esc_attr(get_option('wolve_loyalty_points_text', Wolve_Loyalty_Text_Defaults::get_default('wolve_loyalty_points_text'))); ?>" 883 942 style="width: 100%; max-width: 400px;"> 884 943 <p class="description"> … … 1301 1360 id="wolve_loyalty_tier_points_format" 1302 1361 name="wolve_loyalty_tier_points_format" 1303 value="<?php echo esc_attr(get_option('wolve_loyalty_tier_points_format', '{current} / {total}')); ?>"1362 value="<?php echo esc_attr(get_option('wolve_loyalty_tier_points_format', Wolve_Loyalty_Text_Defaults::get_default('wolve_loyalty_tier_points_format'))); ?>" 1304 1363 placeholder="{current} / {total}" 1305 1364 style="width: 100%; max-width: 400px;"> … … 1333 1392 id="wolve_loyalty_tier_points_remaining" 1334 1393 name="wolve_loyalty_tier_points_remaining" 1335 value="<?php echo esc_attr(get_option('wolve_loyalty_tier_points_remaining', '{points_remaining} points left')); ?>"1394 value="<?php echo esc_attr(get_option('wolve_loyalty_tier_points_remaining', Wolve_Loyalty_Text_Defaults::get_default('wolve_loyalty_tier_points_remaining'))); ?>" 1336 1395 placeholder="{points_remaining} points left" 1337 1396 style="width: 100%; max-width: 400px;"> … … 1957 2016 // Get current values 1958 2017 $registration_url = get_option('wolve_loyalty_registration_url', ''); 1959 $button_text = get_option('wolve_loyalty_info_button_text', 'Registrer deg nå');1960 $cta_title = get_option('wolve_loyalty_info_cta_title', 'Eksklusive tilbud kun for %s-medlemmer');2018 $button_text = get_option('wolve_loyalty_info_button_text', Wolve_Loyalty_Text_Defaults::get_default('wolve_loyalty_info_button_text')); 2019 $cta_title = get_option('wolve_loyalty_info_cta_title', Wolve_Loyalty_Text_Defaults::get_default('wolve_loyalty_info_cta_title')); 1961 2020 ?> 1962 2021 … … 2370 2429 function wolve_loyalty_signup_defaults_callback() 2371 2430 { 2372 $defaults = get_option('wolve_loyalty_signup_defaults', [ 2373 'show_fields' => 'country_code,phone_number,email,first_name,last_name', 2374 'required_fields' => 'country_code,phone_number', 2375 'button_text' => 'Bli medlem', 2376 'success_message' => 'Takk for at du ble medlem i vår kundeklubb!', 2377 'already_member_message' => 'Du er allerede medlem av vår kundeklubb!', 2378 'form_title' => 'Bli med i vår kundeklubb', 2379 'form_description' => '', 2380 'marketing_consent_notice' => 'Ved å bli medlem aksepterer du våre markedsføringsbetingelser, og vil motta tilbud på e-post og SMS', 2381 'hide_form_shadow' => '' 2382 ]); 2431 $defaults = get_option('wolve_loyalty_signup_defaults', Wolve_Loyalty_Text_Defaults::get_signup_defaults()); 2383 2432 2384 2433 error_log('Form display - retrieved defaults: ' . print_r($defaults, true)); -
wolve-loyalty/trunk/includes/benefits/benefits_display.php
r3458103 r3489159 36 36 // Check if data is retrieved 37 37 if (empty($wolve_loyalty_benefits)) { 38 $no_available_rewards_text = get_option('wolve_loyalty_no_available_rewards_text', __('No available rewards at this time.', 'wolve-loyalty'));38 $no_available_rewards_text = get_option('wolve_loyalty_no_available_rewards_text', Wolve_Loyalty_Text_Defaults::get_default('wolve_loyalty_no_available_rewards_text')); 39 39 echo '<p>' . esc_html($no_available_rewards_text) . '</p>'; 40 40 return; … … 44 44 45 45 // Get custom benefits heading or use default 46 $default_heading = __('Your benefits', 'wolve-loyalty'); 47 $benefits_heading = get_option('wolve_loyalty_benefits_heading', $default_heading); 48 46 $benefits_heading = get_option('wolve_loyalty_benefits_heading', Wolve_Loyalty_Text_Defaults::get_default('wolve_loyalty_benefits_heading')); 47 49 48 // Get custom no rewards text or use default 50 $default_no_rewards = __('Do not use my rewards', 'wolve-loyalty'); 51 $no_rewards_text = get_option('wolve_loyalty_no_rewards_text', $default_no_rewards); 49 $no_rewards_text = get_option('wolve_loyalty_no_rewards_text', Wolve_Loyalty_Text_Defaults::get_default('wolve_loyalty_no_rewards_text')); 52 50 53 51 // Get tile color settings … … 142 140 $points_label = get_option('wolve_loyalty_tier_points_label', ''); 143 141 if (empty($points_label)) { 144 $points_label = __('Points', 'wolve-loyalty');145 } 146 147 $points_format = get_option('wolve_loyalty_tier_points_format', '{current} / {total}');142 $points_label = Wolve_Loyalty_Text_Defaults::get_default('wolve_loyalty_tier_points_label'); 143 } 144 145 $points_format = get_option('wolve_loyalty_tier_points_format', Wolve_Loyalty_Text_Defaults::get_default('wolve_loyalty_tier_points_format')); 148 146 if (empty($points_format)) { 149 $points_format = '{current} / {total}';147 $points_format = Wolve_Loyalty_Text_Defaults::get_default('wolve_loyalty_tier_points_format'); 150 148 } 151 149 // Replace placeholders with actual values … … 158 156 $next_tier_label = get_option('wolve_loyalty_tier_next_label', ''); 159 157 if (empty($next_tier_label)) { 160 $next_tier_label = __('Next tier', 'wolve-loyalty');161 } 162 163 $points_remaining_format = get_option('wolve_loyalty_tier_points_remaining', '{points_remaining} points left');158 $next_tier_label = Wolve_Loyalty_Text_Defaults::get_default('wolve_loyalty_tier_next_label'); 159 } 160 161 $points_remaining_format = get_option('wolve_loyalty_tier_points_remaining', Wolve_Loyalty_Text_Defaults::get_default('wolve_loyalty_tier_points_remaining')); 164 162 if (empty($points_remaining_format)) { 165 $points_remaining_format = '{points_remaining} points left';163 $points_remaining_format = Wolve_Loyalty_Text_Defaults::get_default('wolve_loyalty_tier_points_remaining'); 166 164 } 167 165 // Replace placeholder with actual points remaining -
wolve-loyalty/trunk/includes/my-account/my-account-endpoint.php
r3395952 r3489159 107 107 $menu_label = apply_filters( 108 108 'wolve_loyalty_menu_label', 109 __( 'Lojalitetsprogram', 'wolve-loyalty')109 get_option( 'wolve_loyalty_myaccount_tab_label', Wolve_Loyalty_Text_Defaults::get_default( 'wolve_loyalty_myaccount_tab_label' ) ) 110 110 ); 111 111 -
wolve-loyalty/trunk/includes/my-account/my-account.php
r3478959 r3489159 12 12 if ( ! is_user_logged_in() ) { 13 13 // Get the custom login prompt message or use default 14 $default_prompt = __('Please [login_link]log in[/login_link] to view your loyalty rewards.', 'wolve-loyalty'); 15 $login_prompt = get_option('wolve_loyalty_login_prompt', $default_prompt); 14 $login_prompt = get_option('wolve_loyalty_login_prompt', Wolve_Loyalty_Text_Defaults::get_default('wolve_loyalty_login_prompt')); 16 15 17 16 // Get the login URL - use custom URL if set, otherwise use WordPress default … … 90 89 $points_label = get_option('wolve_loyalty_tier_points_label', ''); 91 90 if ( empty( $points_label ) ) { 92 $points_label = __( 'Points', 'wolve-loyalty' );91 $points_label = Wolve_Loyalty_Text_Defaults::get_default( 'wolve_loyalty_tier_points_label' ); 93 92 } 94 93 … … 98 97 $optout_label = get_option('wolve_loyalty_optout_label', ''); 99 98 if ( empty( $optout_label ) ) { 100 $optout_label = __( 'Avmelding', 'wolve-loyalty' );99 $optout_label = Wolve_Loyalty_Text_Defaults::get_default( 'wolve_loyalty_optout_label' ); 101 100 } 102 101 … … 148 147 $next_tier_label = get_option('wolve_loyalty_tier_next_label', ''); 149 148 if ( empty( $next_tier_label ) ) { 150 $next_tier_label = __( 'Current tier', 'wolve-loyalty' );149 $next_tier_label = Wolve_Loyalty_Text_Defaults::get_default( 'wolve_loyalty_tier_next_label' ); 151 150 } 152 151 $html .= '<div class="wolve-member-next-tier">' . esc_html( $next_tier_label ) . ': ' . esc_html( $current_tier_name ) . '</div>'; … … 155 154 // Points remaining 156 155 if ( $points_to_next > 0 && ! empty( $next_tier_name ) ) { 157 $points_remaining_format = get_option('wolve_loyalty_tier_points_remaining', '{points_remaining} points left');156 $points_remaining_format = get_option('wolve_loyalty_tier_points_remaining', Wolve_Loyalty_Text_Defaults::get_default('wolve_loyalty_tier_points_remaining')); 158 157 if ( empty( $points_remaining_format ) ) { 159 $points_remaining_format = '{points_remaining} points left';158 $points_remaining_format = Wolve_Loyalty_Text_Defaults::get_default('wolve_loyalty_tier_points_remaining'); 160 159 } 161 160 $formatted_remaining = str_replace( '{points_remaining}', number_format( $points_to_next ), $points_remaining_format ); … … 176 175 $checkout_prompt = get_option('wolve_loyalty_checkout_prompt', ''); 177 176 if ( empty( $checkout_prompt ) ) { 178 $checkout_prompt = __( 'Gå til kassen for å bruke dine fordeler', 'wolve-loyalty' );177 $checkout_prompt = Wolve_Loyalty_Text_Defaults::get_default( 'wolve_loyalty_checkout_prompt' ); 179 178 } 180 179 $html .= '<div class="wolve-member-checkout-prompt">' . esc_html( $checkout_prompt ) . '</div>'; … … 230 229 $coupons_title = get_option('wolve_loyalty_coupons_title', ''); 231 230 if ( empty( $coupons_title ) ) { 232 $coupons_title = __( 'Dine kuponger', 'wolve-loyalty' );231 $coupons_title = Wolve_Loyalty_Text_Defaults::get_default( 'wolve_loyalty_coupons_title' ); 233 232 } 234 233 -
wolve-loyalty/trunk/includes/product-points/product-points-display.php
r3415409 r3489159 114 114 115 115 // Get customized text template 116 $points_text_template = get_option('wolve_loyalty_points_text', __('Earn {points} points with this purchase', 'wolve-loyalty'));116 $points_text_template = get_option('wolve_loyalty_points_text', Wolve_Loyalty_Text_Defaults::get_default('wolve_loyalty_points_text')); 117 117 $display_style = get_option('wolve_loyalty_points_style', 'default'); 118 118 -
wolve-loyalty/trunk/includes/signupForm/signup-form.php
r3458103 r3489159 81 81 82 82 // Get default settings from admin 83 $admin_defaults = get_option('wolve_loyalty_signup_defaults', [ 84 'show_fields' => 'country_code,phone_number,email,first_name,last_name', 85 'required_fields' => 'country_code,phone_number', 86 'button_text' => __('Bli medlem', 'wolve-loyalty'), 87 'success_message' => __('Takk for at du ble medlem i vår kundeklubb!', 'wolve-loyalty'), 88 'form_title' => __('Bli med i vår kundeklubb', 'wolve-loyalty'), 89 'form_description' => '', 90 'marketing_consent_notice' => __('Ved å bli medlem aksepterer du våre markedsføringsbetingelser, og vil motta tilbud på e-post og SMS', 'wolve-loyalty') 91 ]); 83 $admin_defaults = get_option('wolve_loyalty_signup_defaults', Wolve_Loyalty_Text_Defaults::get_signup_defaults()); 92 84 93 85 // Parse shortcode attributes with admin defaults as fallback … … 335 327 break; 336 328 case 'phone_number': 337 // Combine country code with local number338 329 if (!empty($value)) { 339 // Remove all non-numeric characters 340 $value = preg_replace('/[^0-9]/', '', $value); 341 // Remove leading zeros 342 $value = ltrim($value, '0'); 343 $member_data['phone_number'] = $country_code . $value; 330 if (strpos($value, '+') === 0) { 331 // Phone already has country code (e.g. from combined field) — use as-is 332 $member_data['phone_number'] = preg_replace('/[^0-9+]/', '', $value); 333 } else { 334 // Local number only — combine with country code 335 $value = preg_replace('/[^0-9]/', '', $value); 336 $value = ltrim($value, '0'); 337 $member_data['phone_number'] = $country_code . $value; 338 } 344 339 } 345 340 break; -
wolve-loyalty/trunk/includes/signupForm/vipps-signup-form.js
r3478959 r3489159 540 540 541 541 const phoneNumberVal = $phoneDisplay.val().replace(/\s+/g, ''); 542 const fullPhone = countryCodeVal + phoneNumberVal;543 $phoneHidden.val( fullPhone);542 // Set phone_number to local number only (backend combines with country_code) 543 $phoneHidden.val(phoneNumberVal); 544 544 // Also update the display field's name for proper form submission 545 545 $phoneDisplay.attr('name', 'phone_number_display_only'); 546 547 // Add country_code field for backend processing 548 if (!$form.find('input[name="country_code"]').length) { 549 $form.append('<input type="hidden" name="country_code" value="' + countryCodeVal + '">'); 550 } else { 551 $form.find('input[name="country_code"]').val(countryCodeVal); 552 } 546 553 } 547 554 } -
wolve-loyalty/trunk/includes/signupForm/vipps-signup-form.php
r3478959 r3489159 203 203 public function render_vipps_shortcode($atts) { 204 204 // Get default settings from admin 205 $admin_defaults = get_option('wolve_loyalty_signup_defaults', [ 206 'show_fields' => 'phone_number,email,first_name,last_name', 207 'required_fields' => 'phone_number', 208 'button_text' => __('Bli medlem', 'wolve-loyalty'), 209 'success_message' => __('Takk for at du ble medlem i vår kundeklubb!', 'wolve-loyalty'), 210 'form_title' => __('Bli med i vår kundeklubb', 'wolve-loyalty'), 211 'form_description' => '', 212 'marketing_consent_notice' => __('Ved å bli medlem aksepterer du våre markedsføringsbetingelser, og vil motta tilbud på e-post og SMS', 'wolve-loyalty') 213 ]); 205 $admin_defaults = get_option('wolve_loyalty_signup_defaults', Wolve_Loyalty_Text_Defaults::get_signup_defaults()); 214 206 215 207 // Parse shortcode attributes -
wolve-loyalty/trunk/readme.txt
r3478959 r3489159 1 1 === Wolve Loyalty === 2 2 Contributors: josephnimoson 3 Tags: loyalty, rewards, customer engagement, retention, points, referrals, woocommerce3 Tags: loyalty, customer engagement, retention, points, woocommerce 4 4 Requires at least: 1.0.0 5 5 Tested up to: 6.9.1 6 Stable tag: 1.5. 36 Stable tag: 1.5.5 7 7 License: GPL-2.0-or-later 8 8 License URI: https://www.gnu.org/licenses/gpl-2.0.html 9 9 10 == Short Description ==11 10 Losing customers without understanding why? Use Wolve to win customers back. Loyalty and Retention solution. 12 11 … … 26 25 == Installation == 27 26 28 1. Upload the plugin files to the `/wp-content/plugins/wolve-loyalty `=directory, or install via the WordPress plugin repository.27 1. Upload the plugin files to the `/wp-content/plugins/wolve-loyalty/` directory, or install via the WordPress plugin repository. 29 28 2. Activate the plugin through the 'Plugins' screen in WordPress. 30 29 3. Access the plugin settings via the newly created 'Wolve Loyalty' menu. … … 51 50 5. **Shopper Experience (End-to-End)** - Show points on product pages, give customers a My Loyalty page in their account, and let them redeem at checkout without leaving the flow. A complete earn-and-burn experience for WooCommerce. 52 51 6. **Support** - Fast, live support available 24/7 across time zones. Get help with onboarding, best-practice playbooks, and optimization whenever you need it. 52 53 = 1.5.5 = 54 - translation preset update and bugfix in form. 53 55 54 56 = 1.5.3 = … … 133 135 134 136 – Added support for woocommerce datavisualization. 135 136 -
wolve-loyalty/trunk/wolve-loyalty.php
r3478959 r3489159 6 6 * Author URI: https://wolve.ai 7 7 * Tested up to: 6.9.1 8 * Version: 1.5. 38 * Version: 1.5.5 9 9 * Text Domain: wolve-loyalty 10 10 * License: GPL-2.0-or-later … … 17 17 } 18 18 19 require_once plugin_dir_path(__FILE__) . 'includes/i18n/text-defaults.php'; 19 20 require_once plugin_dir_path(__FILE__) . 'includes/admin-page.php'; 20 21 require_once plugin_dir_path(__FILE__) . 'includes/member/member.php'; … … 74 75 $this->is_connected = get_option('wolve_loyalty_is_connected'); 75 76 77 // Run upgrade check for version-based migrations 78 $this->maybe_run_upgrade(); 79 76 80 // Load plugin text domain for translations 77 81 add_action('plugins_loaded', array($this, 'load_textdomain')); … … 87 91 public function load_textdomain() { 88 92 load_plugin_textdomain('wolve-loyalty', false, dirname(plugin_basename(__FILE__)) . '/languages/'); 93 } 94 95 /** 96 * Run version-based upgrades. Populates new text fields added in later versions 97 * using add_option() so existing customised values are never overwritten. 98 */ 99 private function maybe_run_upgrade() { 100 $current_version = '1.5.4'; 101 $stored_version = get_option( 'wolve_loyalty_plugin_version', '0' ); 102 103 if ( version_compare( $stored_version, $current_version, '>=' ) ) { 104 return; 105 } 106 107 // For existing clients (have API key), preserve the Norwegian tab label 108 // they've been seeing, rather than switching to their locale's default. 109 if ( get_option( 'wolve_loyalty_api_key', false ) ) { 110 add_option( 'wolve_loyalty_myaccount_tab_label', 'Lojalitetsprogram' ); 111 } 112 113 // Populate any text defaults that don't exist yet (safe for existing values) 114 $locale = get_option( 'wolve_loyalty_default_locale', get_locale() ); 115 $defaults = Wolve_Loyalty_Text_Defaults::get_defaults( $locale ); 116 117 foreach ( $defaults as $key => $value ) { 118 if ( strpos( $key, 'signup_' ) === 0 ) { 119 continue; 120 } 121 add_option( $key, $value ); 122 } 123 124 update_option( 'wolve_loyalty_plugin_version', $current_version ); 89 125 } 90 126 … … 470 506 471 507 508 // ── Activation hook: populate locale-aware text defaults on fresh install ── 509 register_activation_hook( __FILE__, 'wolve_loyalty_activate' ); 510 511 function wolve_loyalty_activate() { 512 $has_version = get_option( 'wolve_loyalty_plugin_version', false ); 513 $has_api_key = get_option( 'wolve_loyalty_api_key', false ); 514 515 if ( ! $has_version && ! $has_api_key ) { 516 // Fresh install — populate text defaults based on site locale 517 $locale = get_locale(); 518 $defaults = Wolve_Loyalty_Text_Defaults::get_defaults( $locale ); 519 520 // Individual text options (add_option is a no-op if option already exists) 521 foreach ( $defaults as $key => $value ) { 522 // Skip signup_ prefixed keys — those go into the array option 523 if ( strpos( $key, 'signup_' ) === 0 ) { 524 continue; 525 } 526 add_option( $key, $value ); 527 } 528 529 // Signup defaults array 530 $signup_defaults = Wolve_Loyalty_Text_Defaults::get_signup_defaults( $locale ); 531 add_option( 'wolve_loyalty_signup_defaults', $signup_defaults ); 532 533 update_option( 'wolve_loyalty_default_locale', $locale ); 534 } 535 536 update_option( 'wolve_loyalty_plugin_version', '1.5.4' ); 537 } 538 472 539 new Wolveloyalty(); 473 540
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)