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