PluginProbe
Yatra – Travel Booking & Tour Operator Software / trunk
Yatra – Travel Booking & Tour Operator Software vtrunk
3.0.14 3.0.14.1 3.0.14.2 3.0.12 3.0.13 3.0.11 3.0.10 3.0.9 3.0.8 3.0.7 3.0.6 3.0.5 3.0.5.1 3.0.4 3.0.3 3.0.2.9 3.0.2.7 3.0.2.8 3.0.2.6 trunk 1.0.0 2.0.0 2.0.1 2.0.10 2.0.11 All 82 releases
yatra / templates / account-page.php

account-page.php in Yatra – Travel Booking & Tour Operator Software trunk, at templates/account-page.php

94 lines 3.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Account Page Template
4 * Template for rendering the customer account page
5 */
6
7 // Prevent direct access
8 if (!defined('ABSPATH')) {
9 exit;
10 }
11
12 // Get current user
13 $current_user = wp_get_current_user();
14
15 // If user is not logged in, redirect to login
16 if (!$current_user->ID) {
17 // Render the login shortcode inline (no redirect, no dedicated /login endpoint required)
18 status_header(200);
19 nocache_headers();
20
21 // Ensure the login shortcode UI assets are loaded even though this page is not a WP post containing the shortcode.
22 wp_enqueue_style(
23 'yatra-login-shortcode',
24 YATRA_PLUGIN_URL . 'assets/css/shortcodes/login-shortcode.css',
25 [],
26 YATRA_VERSION
27 );
28 wp_enqueue_script(
29 'yatra-login-shortcode',
30 YATRA_PLUGIN_URL . 'assets/js/login-shortcode.js',
31 ['jquery', 'wp-i18n'],
32 YATRA_VERSION,
33 true
34 );
35 // Load JS translations so __() strings in login-shortcode.js are localized
36 // on this standalone account page (mirrors LoginShortcode::enqueueAssets).
37 if (function_exists('wp_set_script_translations')) {
38 wp_set_script_translations(
39 'yatra-login-shortcode',
40 'yatra',
41 YATRA_PLUGIN_PATH . 'i18n/languages'
42 );
43 }
44 wp_localize_script('yatra-login-shortcode', 'yatra_ajax', [
45 'ajax_url' => admin_url('admin-ajax.php'),
46 'nonce' => wp_create_nonce('yatra_login_nonce'),
47 'rest_url' => esc_url_raw(rest_url('yatra/v1')),
48 'rest_nonce' => wp_create_nonce('wp_rest'),
49 'debug' => defined('WP_DEBUG') && WP_DEBUG,
50 'strings' => [
51 'login_error' => __('Login failed. Please try again.', 'yatra'),
52 'network_error' => __('Network error. Please check your connection.', 'yatra'),
53 'validation_error' => __('Please fill in all required fields.', 'yatra'),
54 ],
55 ]);
56 ?>
57 <!DOCTYPE html>
58 <html <?php language_attributes(); ?>>
59 <head>
60 <meta charset="<?php bloginfo('charset'); ?>">
61 <meta name="viewport" content="width=device-width, initial-scale=1">
62 <title><?php echo esc_html(get_bloginfo('name')) . ' - ' . esc_html__('Login', 'yatra'); ?></title>
63 <?php wp_head(); ?>
64 </head>
65 <body <?php body_class(); ?>>
66 <div class="yatra-login-page-wrapper">
67 <?php echo do_shortcode('[yatra_login redirect_url="/' . esc_attr(\Yatra\Services\SettingsService::getAccountBase()) . '"]'); ?>
68 </div>
69 <?php wp_footer(); ?>
70 </body>
71 </html>
72 <?php
73 exit;
74 }
75
76 ?>
77 <!DOCTYPE html>
78 <html <?php language_attributes(); ?>>
79 <head>
80 <meta charset="<?php bloginfo('charset'); ?>">
81 <meta name="viewport" content="width=device-width, initial-scale=1">
82 <title><?php echo esc_html(get_bloginfo('name')) . ' - ' . __('My Account', 'yatra'); ?></title>
83 <?php wp_head(); ?>
84 </head>
85 <body <?php body_class(); ?>>
86 <?php
87 $yatra_account_react_embed = false;
88 require YATRA_PLUGIN_PATH . 'templates/partials/account-react-root.php';
89 ?>
90 <?php wp_footer(); ?>
91 </body>
92 </html>
93
94