</div> <?php get_template_part('module', 'links'); ?> </div> <div class="column fivecol"> <h1><?php echo ThemexUser::$data['active_user']['profile']['full_name']; ?> </h1> <div class="signature"><?php echo ThemexUser::$data['active_user']['profile']['signature']; ?> </div> <?php if (ThemexForm::isActive('profile')) { ?> <table class="user-fields"> <?php ThemexForm::renderData('profile', array('edit' => false, 'before_title' => '<tr><th>', 'after_title' => '</th>', 'before_content' => '<td>', 'after_content' => '</td></tr>'), ThemexUser::$data['active_user']['profile']); ?> </table> <?php } ?> <?php echo ThemexUser::$data['active_user']['profile']['description']; ?> </div> <?php }
/** * Updates user profile * * @access public * @param int $ID * @param array $data * @return void */ public static function updateProfile($ID, $data) { $fields = array(array('name' => 'signature', 'type' => 'text'), array('name' => 'facebook', 'type' => 'text'), array('name' => 'twitter', 'type' => 'text'), array('name' => 'google', 'type' => 'text'), array('name' => 'tumblr', 'type' => 'text'), array('name' => 'linkedin', 'type' => 'text'), array('name' => 'flickr', 'type' => 'text'), array('name' => 'youtube', 'type' => 'text'), array('name' => 'vimeo', 'type' => 'text')); if (ThemexForm::isActive('profile')) { $fields = array_merge($fields, ThemexForm::$data['profile']['fields']); } foreach ($fields as $field) { $name = themex_sanitize_key($field['name']); if (isset($data[$name])) { if ($field['type'] == 'number') { $data[$name] = intval($data[$name]); } else { if ($field['type'] == 'name') { $data[$name] = ucwords(strtolower($data[$name])); } else { $data[$name] = sanitize_text_field($data[$name]); } } ThemexCore::updateUserMeta($ID, $name, $data[$name]); } } //first name if (isset($data['first_name'])) { update_user_meta($ID, 'first_name', sanitize_text_field($data['first_name'])); } //last name if (isset($data['last_name'])) { update_user_meta($ID, 'last_name', sanitize_text_field($data['last_name'])); } //description if (isset($data['description'])) { $data['description'] = wp_kses($data['description'], array('strong' => array(), 'em' => array(), 'a' => array('href' => array(), 'title' => array(), 'target' => array()), 'p' => array(), 'br' => array())); update_user_meta($ID, 'description', $data['description']); } if (empty(ThemexInterface::$messages)) { ThemexInterface::$messages[] = __('Profile has been successfully saved', 'academy'); $_POST['success'] = true; } }
/** * Updates user profile * * @access public * @param int $ID * @param array $data * @return void */ public static function updateProfile($ID, $data) { $shop = self::getShop($ID); if (!empty($shop)) { if (isset($data['billing_country'])) { $country = trim(sanitize_text_field($data['billing_country'])); ThemexCore::updatePostMeta($shop, 'country', $country); } if (isset($data['billing_city'])) { $city = trim(sanitize_text_field($data['billing_city'])); $city = ucwords(strtolower($city)); ThemexCore::updatePostMeta($shop, 'city', $city); } } foreach (ThemexCore::$components['forms'] as $form => $fields) { if ($form == 'profile' && ThemexForm::isActive('profile')) { $customs = ThemexForm::$data['profile']['fields']; foreach ($customs as &$custom) { $custom['name'] = themex_sanitize_key($custom['name']); } $fields = array_merge($fields, $customs); } foreach ($fields as $field) { if (isset($field['name']) && isset($data[$field['name']])) { $name = $field['name']; $alias = themex_value('alias', $field); $type = themex_value('type', $field); $value = $data[$name]; if ($type == 'text') { $value = trim(sanitize_text_field($value)); } else { if ($type == 'number') { $value = intval($value); } } if ($name == 'billing_city') { $value = ucwords(strtolower($value)); } if (isset($field['required']) && $field['required'] && ($value == '' || $type == 'select' && $value == '0')) { ThemexInterface::$messages[] = '"' . $field['label'] . '" ' . __('field is required', 'makery'); } else { if (!isset($field['prefix']) || $field['prefix']) { ThemexCore::updateUserMeta($ID, $name, $value); } else { update_user_meta($ID, $name, $value); if (!empty($alias)) { update_user_meta($ID, $alias, $value); } } } } } } if (isset($data['description'])) { $data['description'] = trim($data['description']); $data['description'] = wp_kses($data['description'], array('strong' => array(), 'em' => array(), 'a' => array('href' => array(), 'title' => array(), 'target' => array()), 'p' => array(), 'br' => array())); update_user_meta($ID, 'description', $data['description']); } if (empty(ThemexInterface::$messages)) { ThemexInterface::$messages[] = __('Profile has been successfully saved', 'makery'); $_POST['success'] = true; } }