billing
1 day ago
reviews
1 day ago
settings
1 day ago
withdrawal
1 day ago
billing.php
1 day ago
profile.php
1 day ago
reviews.php
1 day ago
settings.php
1 day ago
withdrawals.php
1 day ago
settings.php
186 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Settings Template for Account |
| 4 | * |
| 5 | * @package Tutor\Templates |
| 6 | * @subpackage Dashboard |
| 7 | * @author Themeum <support@themeum.com> |
| 8 | * @link https://themeum.com |
| 9 | * @since 4.0.0 |
| 10 | * |
| 11 | * These variables are inherited from parent templates: |
| 12 | * template: templates/account.php |
| 13 | * |
| 14 | * @var string $back_url |
| 15 | */ |
| 16 | |
| 17 | defined( 'ABSPATH' ) || exit; |
| 18 | |
| 19 | use TUTOR\Icon; |
| 20 | use TUTOR\User; |
| 21 | |
| 22 | $settings_tab_data = array( |
| 23 | 'account' => array( |
| 24 | 'id' => 'account', |
| 25 | 'label' => __( 'Account', 'tutor' ), |
| 26 | 'icon' => Icon::USER_CIRCLE, |
| 27 | 'text' => __( 'Name, email, phone number, profiles', 'tutor' ), |
| 28 | 'template' => 'dashboard.account.settings.account', |
| 29 | 'role' => false, |
| 30 | ), |
| 31 | 'security' => array( |
| 32 | 'id' => 'security', |
| 33 | 'label' => __( 'Security', 'tutor' ), |
| 34 | 'icon' => Icon::SECURITY, |
| 35 | 'text' => __( 'Password, 2FA', 'tutor' ), |
| 36 | 'template' => 'dashboard.account.settings.security', |
| 37 | 'role' => false, |
| 38 | ), |
| 39 | 'social-accounts' => array( |
| 40 | 'id' => 'social-accounts', |
| 41 | 'label' => __( 'Social Accounts', 'tutor' ), |
| 42 | 'icon' => Icon::GLOBE, |
| 43 | 'text' => __( 'Linked social media profiles', 'tutor' ), |
| 44 | 'template' => 'dashboard.account.settings.social-accounts', |
| 45 | 'role' => false, |
| 46 | ), |
| 47 | 'withdraw' => array( |
| 48 | 'id' => 'withdraw', |
| 49 | 'label' => __( 'Withdraw', 'tutor' ), |
| 50 | 'icon' => Icon::WITHDRAW, |
| 51 | 'text' => __( 'Withdrawal and refund', 'tutor' ), |
| 52 | 'template' => 'dashboard.account.settings.withdraw', |
| 53 | 'role' => User::INSTRUCTOR, |
| 54 | ), |
| 55 | 'preferences' => array( |
| 56 | 'id' => 'preferences', |
| 57 | 'label' => __( 'Preferences', 'tutor' ), |
| 58 | 'icon' => Icon::FILTER_2, |
| 59 | 'text' => __( 'Sound effects, animations, theme', 'tutor' ), |
| 60 | 'template' => 'dashboard.account.settings.preferences', |
| 61 | 'role' => false, |
| 62 | ), |
| 63 | ); |
| 64 | |
| 65 | // phpcs:ignore WordPress.NamingConventions.ValidHookName |
| 66 | $settings_tab_data = apply_filters( 'tutor_dashboard/nav_items/settings/nav_items', $settings_tab_data ); |
| 67 | |
| 68 | $settings_tab_data = array_values( |
| 69 | array_filter( |
| 70 | $settings_tab_data, |
| 71 | function ( $tab ) { |
| 72 | return 'account' === $tab['id'] || ! $tab['role'] || ( User::INSTRUCTOR === $tab['role'] && current_user_can( tutor()->instructor_role ) && User::is_instructor_view() ); |
| 73 | } |
| 74 | ) |
| 75 | ); |
| 76 | |
| 77 | ?> |
| 78 | |
| 79 | <section x-data="tutorSettings()"> |
| 80 | <div |
| 81 | x-data='(() => { |
| 82 | const tabs = tutorTabs({ |
| 83 | tabs: <?php echo wp_json_encode( $settings_tab_data ); ?>, |
| 84 | orientation: "vertical", |
| 85 | defaultTab: window.innerWidth >= 768 ? "account" : "none", |
| 86 | urlParams: { |
| 87 | enabled: true, |
| 88 | paramName: "tab", |
| 89 | } |
| 90 | }); |
| 91 | |
| 92 | return { |
| 93 | ...tabs, |
| 94 | backUrl: <?php echo wp_json_encode( $back_url ); ?>, |
| 95 | selectTab(tabId) { |
| 96 | if (tabId === "none") { |
| 97 | this.activeTab = "none"; |
| 98 | |
| 99 | if (this.urlParamsConfig.enabled) { |
| 100 | const url = new URL(window.location.href); |
| 101 | url.searchParams.delete(this.urlParamsConfig.paramName); |
| 102 | window.history.replaceState({}, "", url.toString()); |
| 103 | } |
| 104 | |
| 105 | return; |
| 106 | } |
| 107 | |
| 108 | return tabs.selectTab.call(this, tabId); |
| 109 | }, |
| 110 | handleClose() { |
| 111 | if (window.innerWidth < 768 && this.activeTab !== "none") { |
| 112 | this.selectTab("none"); |
| 113 | return; |
| 114 | } |
| 115 | |
| 116 | window.location.href = this.backUrl; |
| 117 | }, |
| 118 | }; |
| 119 | })()' |
| 120 | class="tutor-profile-settings-section" |
| 121 | > |
| 122 | <?php tutor_load_template( 'dashboard.account.settings.header', array( 'back_url' => $back_url ) ); ?> |
| 123 | |
| 124 | <div class="tutor-account-container"> |
| 125 | <div |
| 126 | x-init="$watch('$store.windowWidth', () => { |
| 127 | if (window.innerWidth >= 768 && activeTab === 'none') { |
| 128 | selectTab('account'); |
| 129 | } else if (window.innerWidth < 768 && activeTab !== 'none') { |
| 130 | selectTab('none'); |
| 131 | } |
| 132 | })" |
| 133 | @resize.window=" |
| 134 | if (window.innerWidth >= 768 && activeTab === 'none') { |
| 135 | selectTab('account'); |
| 136 | } else if (window.innerWidth < 768 && activeTab !== 'none') { |
| 137 | selectTab('none'); |
| 138 | } |
| 139 | " |
| 140 | x-cloak |
| 141 | class="tutor-gap-8" |
| 142 | > |
| 143 | <div class="tutor-flex tutor-gap-8 tutor-my-9 tutor-sm-my-6"> |
| 144 | <div x-ref="tablist" role="tablist" aria-orientation="vertical" class="tutor-tabs-nav tutor-profile-settings-tab tutor-p-5"> |
| 145 | <template x-for="tab in tabs" :key="tab.id"> |
| 146 | <button |
| 147 | type="button" |
| 148 | role="tab" |
| 149 | :class='getTabClass(tab)' |
| 150 | x-bind:aria-selected="isActive(tab.id)" |
| 151 | :disabled="tab.disabled ? true : false" |
| 152 | @click="selectTab(tab.id)" |
| 153 | > |
| 154 | <span x-data="tutorIcon({ name: tab.icon, width: 20, height: 20})"></span> |
| 155 | <div class="tutor-flex tutor-flex-column tutor-items-start"> |
| 156 | <span x-text="tab.label" class="tutor-text-small"></span> |
| 157 | <span x-text="tab.text" class="tutor-text-tiny tutor-hidden tutor-md-block tutor-text-subdued"></span> |
| 158 | </div> |
| 159 | </button> |
| 160 | </template> |
| 161 | </div> |
| 162 | |
| 163 | <div |
| 164 | role="main" |
| 165 | :class="activeTab !== null && activeTab !== 'none' ? 'tutor-profile-tab-activated' : ''" |
| 166 | class="tutor-profile-settings-tab-content tutor-w-full" |
| 167 | > |
| 168 | <?php foreach ( $settings_tab_data as $settings_tab ) : ?> |
| 169 | <div x-show="activeTab === '<?php echo esc_attr( $settings_tab['id'] ); ?>'" x-cloak class="tutor-tab-panel" role="tabpanel"> |
| 170 | <?php |
| 171 | $form_id = "tutor-{$settings_tab['id']}-form"; |
| 172 | tutor_load_template( |
| 173 | $settings_tab['template'], |
| 174 | array( 'form_id' => $form_id ), |
| 175 | isset( $settings_tab['is_pro'] ) && $settings_tab['is_pro'] ? true : false |
| 176 | ); |
| 177 | ?> |
| 178 | </div> |
| 179 | <?php endforeach; ?> |
| 180 | </div> |
| 181 | </div> |
| 182 | </div> |
| 183 | </div> |
| 184 | </div> |
| 185 | </section> |
| 186 |