MyAccountTag.php
1 month ago
account-settings.tmpl.php
3 years ago
billing-details.tmpl.php
1 year ago
change-password.tmpl.php
1 year ago
dashboard.tmpl.php
3 years ago
delete-account.tmpl.php
1 year ago
downloads.tmpl.php
1 year ago
edit-profile.tmpl.php
1 year ago
email-notifications.tmpl.php
3 years ago
index.php
5 years ago
orders.tmpl.php
3 years ago
subscriptions.tmpl.php
1 year ago
view-order.tmpl.php
1 year ago
view-subscription.tmpl.php
1 year ago
edit-profile.tmpl.php
218 lines
| 1 | <?php |
| 2 | |
| 3 | use ProfilePress\Core\Admin\ProfileCustomFields; |
| 4 | use ProfilePress\Core\Classes\EditUserProfile; |
| 5 | use ProfilePress\Core\Classes\ExtensionManager; |
| 6 | use ProfilePress\Core\Classes\PROFILEPRESS_sql; |
| 7 | use ProfilePress\Core\Classes\UserAvatar; |
| 8 | use ProfilePress\Core\Membership\CheckoutFields; |
| 9 | |
| 10 | if ( ! defined('ABSPATH')) { |
| 11 | exit; // Exit if accessed directly |
| 12 | } |
| 13 | |
| 14 | $current_user_id = get_current_user_id(); |
| 15 | |
| 16 | do_action('ppress_myaccount_edit_profile_before'); |
| 17 | |
| 18 | $contact_infos = []; |
| 19 | $custom_fields = []; |
| 20 | |
| 21 | if (ExtensionManager::is_enabled(ExtensionManager::CUSTOM_FIELDS)) { |
| 22 | |
| 23 | $contact_infos = PROFILEPRESS_sql::get_contact_info_fields(); |
| 24 | |
| 25 | $custom_fields = PROFILEPRESS_sql::get_profile_custom_fields(); |
| 26 | } |
| 27 | |
| 28 | $success_message = EditUserProfile::get_success_message(); |
| 29 | |
| 30 | $custom_edit_profile = ppress_settings_by_key('myac_account_details_form', 'default', true); |
| 31 | |
| 32 | $sub_menus = apply_filters('ppress_my_account_settings_sub_menus', ['general' => esc_html__('General', 'wp-user-avatar')]); |
| 33 | ?> |
| 34 | <div class="profilepress-myaccount-edit-profile"> |
| 35 | |
| 36 | <h2><?= esc_html__('Account Settings', 'wp-user-avatar') ?></h2> |
| 37 | |
| 38 | <?php if (is_array($sub_menus) && count($sub_menus) > 1) : ?> |
| 39 | <div class="profilepress-myaccount-submenus-wrap"> |
| 40 | |
| 41 | <?php foreach ($sub_menus as $menu_id => $sub_menu) : ?> |
| 42 | |
| 43 | <?php $is_active = ( ! isset($_GET['epview']) && $menu_id == 'general') || (isset($_GET['epview']) && $_GET['epview'] == $menu_id) ? ' ppsubmenu-active' : ''; ?> |
| 44 | |
| 45 | <div class="profilepress-myaccount-submenu-wrap"> |
| 46 | <a href="<?= esc_url(remove_query_arg('edit', add_query_arg('epview', $menu_id))) ?>" class="profilepress-myaccount-submenu-item<?= $is_active ?>"> |
| 47 | <?= $sub_menu ?> |
| 48 | </a> |
| 49 | </div> |
| 50 | |
| 51 | <?php endforeach; ?> |
| 52 | |
| 53 | </div> |
| 54 | <?php endif; ?> |
| 55 | |
| 56 | <?php if (isset($_GET['edit']) && $_GET['edit'] == 'true') : ?> |
| 57 | <?= $success_message ?> |
| 58 | <?php endif; ?> |
| 59 | |
| 60 | <?php if ( ! empty($this->edit_profile_form_error) && is_string($this->edit_profile_form_error)) : ?> |
| 61 | |
| 62 | <?php if (strpos($this->edit_profile_form_error, 'profilepress-edit-profile-status') !== false) : ?> |
| 63 | <?= $this->edit_profile_form_error ?> |
| 64 | <?php else : ?> |
| 65 | <div class="profilepress-edit-profile-status"> |
| 66 | <?= $this->edit_profile_form_error ?> |
| 67 | </div> |
| 68 | <?php endif; ?> |
| 69 | |
| 70 | <?php endif; ?> |
| 71 | |
| 72 | <?php |
| 73 | |
| 74 | if ('default' !== $custom_edit_profile) { |
| 75 | echo apply_filters( |
| 76 | 'ppress_myaccount_edit_profile_custom_form', |
| 77 | do_shortcode(sprintf('[profilepress-edit-profile id="%s"]', absint($custom_edit_profile)), true) |
| 78 | ); |
| 79 | } elseif ( ! empty($_GET['epview']) && $_GET['epview'] != 'general') { |
| 80 | do_action('ppress_myaccount_edit_profile_submenu_content', sanitize_text_field($_GET['epview'])); |
| 81 | } else { |
| 82 | |
| 83 | $cover_image_url = ppress_get_cover_image_url(); |
| 84 | |
| 85 | ob_start(); ?> |
| 86 | [pp-edit-profile-form] |
| 87 | |
| 88 | <div class="profilepress-myaccount-form-wrap"> |
| 89 | |
| 90 | <div class="profilepress-myaccount-form-field pp-cover-image"> |
| 91 | <div class="ppmyac-custom-file"> |
| 92 | <?= '[edit-profile-cover-image id="pp-cover-image" class="ppmyac-custom-file-input"]' ?> |
| 93 | <label for="pp-cover-image" class="ppmyac-custom-file-label" data-browse="<?= esc_html__('Browse', 'wp-user-avatar'); ?>"> |
| 94 | <?= esc_html__('Cover photo (min. width: 1000px)', 'wp-user-avatar') ?> |
| 95 | </label> |
| 96 | </div> |
| 97 | </div> |
| 98 | |
| 99 | <div class="profilepress-myaccount-form-field pp-user-cover-image"> |
| 100 | <div class="profilepress-myaccount-delete-cover-image-wrap"> |
| 101 | <div class="profilepress-myaccount-cover-image"> |
| 102 | <div class="profilepress-myaccount-has-cover-image" style="<?= ! $cover_image_url ? 'display:none' : '' ?>"> |
| 103 | <?= '[pp-user-cover-image]'; ?> |
| 104 | </div> |
| 105 | <?= sprintf('[pp-remove-cover-image-button label="%s" class="ppmyac-remove-avatar"]', __('Remove', 'wp-user-avatar')); ?> |
| 106 | <div class="profilepress-myaccount-cover-image-empty" style="<?= $cover_image_url ? 'display:none' : '' ?>"></div> |
| 107 | </div> |
| 108 | </div> |
| 109 | </div> |
| 110 | |
| 111 | <div class="profilepress-myaccount-form-field edit-profile-avatar"> |
| 112 | <div class="ppmyac-custom-file"> |
| 113 | <?= '[edit-profile-avatar id="pp-avatar" class="ppmyac-custom-file-input"]' ?> |
| 114 | <label for="pp-avatar" class="ppmyac-custom-file-label" data-browse="<?= esc_html__('Browse', 'wp-user-avatar'); ?>"> |
| 115 | <?= esc_html__('Profile picture', 'wp-user-avatar') ?> |
| 116 | </label> |
| 117 | </div> |
| 118 | </div> |
| 119 | |
| 120 | <div class="profilepress-myaccount-form-field delete-avatar"> |
| 121 | <div class="profilepress-myaccount-delete-avatar-wrap"> |
| 122 | <div class="profilepress-myaccount-delete-avatar"> |
| 123 | <?= UserAvatar::get_avatar_img($current_user_id); ?> |
| 124 | <?= sprintf('[pp-remove-avatar-button label="%s" class="ppmyac-remove-avatar"]', __('Remove', 'wp-user-avatar')); ?> |
| 125 | </div> |
| 126 | </div> |
| 127 | </div> |
| 128 | |
| 129 | <div class="profilepress-myaccount-form-field edit-profile-email"> |
| 130 | <label for="edit-profile-email"><?= esc_html__('Email address', 'wp-user-avatar') ?></label> |
| 131 | <?= '[edit-profile-email id="edit-profile-email" class="profilepress-myaccount-form-control"]'; ?> |
| 132 | </div> |
| 133 | |
| 134 | <div class="profilepress-myaccount-form-field edit-profile-first-name"> |
| 135 | <label for="edit-profile-first-name"><?= esc_html__('First name', 'wp-user-avatar') ?></label> |
| 136 | <?= '[edit-profile-first-name id="edit-profile-first-name" class="profilepress-myaccount-form-control"]'; ?> |
| 137 | </div> |
| 138 | |
| 139 | <div class="profilepress-myaccount-form-field edit-profile-last-name"> |
| 140 | <label for="edit-profile-last-name"><?= esc_html__('Last name', 'wp-user-avatar') ?></label> |
| 141 | <?= '[edit-profile-last-name id="edit-profile-last-name" class="profilepress-myaccount-form-control"]'; ?> |
| 142 | </div> |
| 143 | |
| 144 | <div class="profilepress-myaccount-form-field edit-profile-nickname"> |
| 145 | <label for="edit-profile-nickname"><?= esc_html__('Nickname', 'wp-user-avatar') ?></label> |
| 146 | <?= '[edit-profile-nickname id="edit-profile-nickname" class="profilepress-myaccount-form-control"]'; ?> |
| 147 | </div> |
| 148 | |
| 149 | <div class="profilepress-myaccount-form-field eup_display_name"> |
| 150 | <label for="eup_display_name"><?= esc_html__('Display name publicly as', 'wp-user-avatar') ?></label> |
| 151 | <?php $this->display_name_select_dropdown(); ?> |
| 152 | </div> |
| 153 | |
| 154 | <div class="profilepress-myaccount-form-field edit-profile-website"> |
| 155 | <label for="edit-profile-website"><?= esc_html__('Website', 'wp-user-avatar') ?></label> |
| 156 | <?= '[edit-profile-website id="edit-profile-website" class="profilepress-myaccount-form-control"]'; ?> |
| 157 | </div> |
| 158 | |
| 159 | <div class="profilepress-myaccount-form-field edit-profile-bio"> |
| 160 | <label for="edit-profile-bio"><?= esc_html__('About yourself', 'wp-user-avatar') ?></label> |
| 161 | <?= '[edit-profile-bio id="edit-profile-bio" class="profilepress-myaccount-form-control"]'; ?> |
| 162 | </div> |
| 163 | |
| 164 | <?php $billing_fields = CheckoutFields::standard_billing_fields() ?> |
| 165 | |
| 166 | <?php if (is_array($contact_infos) && ! empty($contact_infos)) : ?> |
| 167 | |
| 168 | <?php foreach ($contact_infos as $field_key => $label) : ?> |
| 169 | <?php if (in_array($field_key, array_keys($billing_fields))) continue; ?> |
| 170 | <?php if (apply_filters('ppress_myaccount_edit_profile_disable_' . $field_key, false, $current_user_id)) continue; ?> |
| 171 | <div class="profilepress-myaccount-form-field <?= $field_key ?>"> |
| 172 | <label for="<?= $field_key ?>"><?= $label ?></label> |
| 173 | <?= sprintf('[edit-profile-cpf key="%1$s" id="%1$s" type="%2$s" class="profilepress-myaccount-form-control"]', $field_key, 'text'); ?> |
| 174 | </div> |
| 175 | <?php endforeach; ?> |
| 176 | |
| 177 | <?php endif; |
| 178 | |
| 179 | if (is_array($custom_fields) && ! empty($custom_fields)) : ?> |
| 180 | |
| 181 | <?php foreach ($custom_fields as $custom_field) : |
| 182 | |
| 183 | $field_key = $custom_field['field_key']; |
| 184 | |
| 185 | if (in_array($field_key, array_keys($billing_fields))) continue; |
| 186 | |
| 187 | // skip woocommerce core billing / shipping fields added to wordpress profile admin page. |
| 188 | if (in_array($field_key, ppress_woocommerce_billing_shipping_fields())) continue; |
| 189 | |
| 190 | if (apply_filters('ppress_myaccount_edit_profile_disable_' . $field_key, false, $current_user_id)) continue; |
| 191 | ?> |
| 192 | <div class="profilepress-myaccount-form-field <?= $field_key ?>"> |
| 193 | <?php if ($custom_field['type'] !== 'agreeable') : ?> |
| 194 | <label for="<?= $field_key ?>"><?= $custom_field['label_name'] ?></label> |
| 195 | <?php endif; ?> |
| 196 | <?= sprintf('[edit-profile-cpf id="%1$s" key="%1$s" type="%2$s" class="profilepress-myaccount-form-control"]', $field_key, $custom_field['type']) ?> |
| 197 | </div> |
| 198 | <?php endforeach; ?> |
| 199 | |
| 200 | <?php endif; ?> |
| 201 | |
| 202 | <div class="profilepress-myaccount-form-field edit-profile-submit"> |
| 203 | <?= '[edit-profile-submit]'; ?> |
| 204 | </div> |
| 205 | </div> |
| 206 | |
| 207 | <input type="hidden" name="ppmyac_form_action" value="updateProfile"> |
| 208 | |
| 209 | [/pp-edit-profile-form] |
| 210 | |
| 211 | <?= do_shortcode(ob_get_clean(), true); |
| 212 | } |
| 213 | ?> |
| 214 | </div> |
| 215 | <?php |
| 216 | |
| 217 | do_action('ppress_myaccount_edit_profile'); |
| 218 |