| @@ -12,8 +12,16 @@ | ||
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | global $booking; |
| 15 | 15 | $trip = $booking->trip ?? null; |
| 16 | + | |
| 17 | +// Account registration is gated by the same setting the backend enforces | |
| 18 | +// (AuthController rejects registration when this is off). When it's disabled we | |
| 19 | +// hide the Register tab/form and the "Register now" switch so customers only | |
| 20 | +// see the Login option. | |
| 21 | +$registration_enabled = class_exists('\\Yatra\\Services\\SettingsService') | |
| 22 | + ? \Yatra\Services\SettingsService::isEnabled('customer_registration') | |
| 23 | + : true; | |
| 16 | 24 | ?> |
| 17 | 25 | |
| 18 | 26 | <div class="yatra-booking-auth"> |
| 19 | 27 | <!-- Tab Navigation --> |
| @@ -23,8 +31,9 @@ | ||
| 23 | 31 | <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 16l-4-4m0 0l4-4m-4 4h14m-5 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h7a3 3 0 013 3v1"/> |
| 24 | 32 | </svg> |
| 25 | 33 | <?php esc_html_e('Login', 'yatra'); ?> |
| 26 | 34 | </button> |
| 35 | + <?php if ($registration_enabled) : ?> | |
| 27 | 36 | <button type="button" class="yatra-auth-tab" data-tab="register"> |
| 28 | 37 | <svg width="18" height="18" fill="none" stroke="currentColor" viewBox="0 0 24 24"> |
| 29 | 38 | <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M18 9v3m0 0v3m0-3h3m-3 0h-3m-2-5a4 4 0 11-8 0 4 4 0 018 0zM3 20a6 6 0 0112 0v1H3v-1z"/> |
| 30 | 39 | </svg> |
| @@ -29,8 +38,9 @@ | ||
| 29 | 38 | <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M18 9v3m0 0v3m0-3h3m-3 0h-3m-2-5a4 4 0 11-8 0 4 4 0 018 0zM3 20a6 6 0 0112 0v1H3v-1z"/> |
| 30 | 39 | </svg> |
| 31 | 40 | <?php esc_html_e('Register', 'yatra'); ?> |
| 32 | 41 | </button> |
| 42 | + <?php endif; ?> | |
| 33 | 43 | </div> |
| 34 | 44 | |
| 35 | 45 | <!-- Login Form --> |
| 36 | 46 | <div class="yatra-auth-content" id="yatra-auth-login"> |
| @@ -105,15 +115,18 @@ | ||
| 105 | 115 | </span> |
| 106 | 116 | </button> |
| 107 | 117 | </form> |
| 108 | 118 | |
| 119 | + <?php if ($registration_enabled) : ?> | |
| 109 | 120 | <div class="yatra-auth-footer"> |
| 110 | - <p><?php esc_html_e("Don't have an account?", 'yatra'); ?> | |
| 121 | + <p><?php esc_html_e("Don't have an account?", 'yatra'); ?> | |
| 111 | 122 | <button type="button" class="yatra-switch-tab" data-tab="register"><?php esc_html_e('Register now', 'yatra'); ?></button> |
| 112 | 123 | </p> |
| 113 | 124 | </div> |
| 125 | + <?php endif; ?> | |
| 114 | 126 | </div> |
| 115 | 127 | |
| 128 | + <?php if ($registration_enabled) : ?> | |
| 116 | 129 | <!-- Registration Form --> |
| 117 | 130 | <div class="yatra-auth-content" id="yatra-auth-register" style="display:none;"> |
| 118 | 131 | <div class="yatra-auth-header"> |
| 119 | 132 | <h2><?php esc_html_e('Create Account', 'yatra'); ?></h2> |
| @@ -203,15 +216,34 @@ | ||
| 203 | 216 | <div class="yatra-form-group"> |
| 204 | 217 | <label class="yatra-checkbox-label"> |
| 205 | 218 | <input type="checkbox" name="terms" required> |
| 206 | 219 | <span> |
| 207 | - <?php | |
| 220 | + <?php | |
| 221 | + // Resolve Terms + Privacy URLs from Yatra settings, | |
| 222 | + // falling back to WordPress' built-in privacy URL | |
| 223 | + // when no Yatra setting is set. Previously both | |
| 224 | + // links pointed at the privacy URL — a copy-paste | |
| 225 | + // mistake that hid the Terms page from customers. | |
| 226 | + $termsPageId = 0; | |
| 227 | + $privacyPageId = 0; | |
| 228 | + if (class_exists('\\Yatra\\Services\\SettingsService')) { | |
| 229 | + $termsPageId = \Yatra\Services\SettingsService::getInt('terms_page_id', 0); | |
| 230 | + $privacyPageId = \Yatra\Services\SettingsService::getInt('privacy_policy_page_id', 0); | |
| 231 | + } else { | |
| 232 | + $termsPageId = (int) get_option('yatra_terms_page_id', 0); | |
| 233 | + $privacyPageId = (int) get_option('yatra_privacy_policy_page_id', 0); | |
| 234 | + } | |
| 235 | + $termsUrl = $termsPageId > 0 ? get_permalink($termsPageId) : ''; | |
| 236 | + $privacyUrl = $privacyPageId > 0 ? get_permalink($privacyPageId) : ''; | |
| 237 | + if ($privacyUrl === '' && function_exists('get_privacy_policy_url')) { | |
| 238 | + $privacyUrl = (string) get_privacy_policy_url(); | |
| 239 | + } | |
| 208 | 240 | printf( |
| 209 | 241 | /* translators: %1$s: terms link, %2$s: privacy link */ |
| 210 | 242 | esc_html__('I agree to the %1$s and %2$s', 'yatra'), |
| 211 | - '<a href="' . esc_url(get_privacy_policy_url()) . '" target="_blank">' . esc_html__('Terms of Service', 'yatra') . '</a>', | |
| 212 | - '<a href="' . esc_url(get_privacy_policy_url()) . '" target="_blank">' . esc_html__('Privacy Policy', 'yatra') . '</a>' | |
| 213 | - ); | |
| 243 | + '<a href="' . esc_url($termsUrl) . '" target="_blank">' . esc_html__('Terms of Service', 'yatra') . '</a>', | |
| 244 | + '<a href="' . esc_url($privacyUrl) . '" target="_blank">' . esc_html__('Privacy Policy', 'yatra') . '</a>' | |
| 245 | + ); | |
| 214 | 246 | ?> |
| 215 | 247 | </span> |
| 216 | 248 | </label> |
| 217 | 249 | </div> |
| @@ -230,10 +262,11 @@ | ||
| 230 | 262 | </button> |
| 231 | 263 | </form> |
| 232 | 264 | |
| 233 | 265 | <div class="yatra-auth-footer"> |
| 234 | - <p><?php esc_html_e('Already have an account?', 'yatra'); ?> | |
| 266 | + <p><?php esc_html_e('Already have an account?', 'yatra'); ?> | |
| 235 | 267 | <button type="button" class="yatra-switch-tab" data-tab="login"><?php esc_html_e('Login here', 'yatra'); ?></button> |
| 236 | 268 | </p> |
| 237 | 269 | </div> |
| 238 | 270 | </div> |
| 271 | + <?php endif; ?> | |
| 239 | 272 | </div> |