Skip to content

Commit

Permalink
Version 1.0.2
Browse files Browse the repository at this point in the history
- fixed translated description field value
  • Loading branch information
yuriinalivaiko committed Jul 20, 2023
1 parent 364b438 commit 9ef0a33
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 13 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Open git bash, navigate to the **plugins** folder and execute this command:
Once the plugin is cloned, enter your site admin dashboard and go to _wp-admin > Plugins > Installed Plugins_. Find the "Ultimate Member - Polylang" plugin and click the "Activate" link.

### Install from ZIP archive
You can install this plugin from the [ZIP archive](https://drive.google.com/file/d/1pP84L2syUXzNKlwzBSKVBqdmBsPtge--/view?usp=sharing) as any other plugin. Follow [this instruction](https://wordpress.org/support/article/managing-plugins/#upload-via-wordpress-admin).
You can install this plugin from the [ZIP archive](https://drive.google.com/file/d/175PVG6tLK7z1wcrAawFfQdTVIC071Eup/view) as any other plugin. Follow [this instruction](https://wordpress.org/support/article/managing-plugins/#upload-via-wordpress-admin).

## How to use
Go to *wp-admin > Ultimate Member > Settings > Email* to translate email templates. Click the "+" icon unter the flag to translate a template for the needed language. The plugin saves translated email templates to locale subfolders in the theme. See details [here](https://docs.ultimatemember.com/article/1335-email-templates).
Expand Down
25 changes: 15 additions & 10 deletions includes/core/class-fields.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ public function __construct() {
public function profile_bio_key( $key, $args ) {
if ( 'description' === $key ) {
$curlang_slug = pll_current_language();
$key = 'description_' . $curlang_slug;
$curlang_key = 'description_' . $curlang_slug;
if ( um_profile( $curlang_key ) || UM()->fields()->editing ) {
$key = $curlang_key;
}
}
return $key;
}
Expand All @@ -66,10 +69,12 @@ public function profile_bio_value( $value, $data, $key = null ) {
}
if ( 'description' === $key ) {
$curlang_slug = pll_current_language();
$description = get_user_meta( um_profile_id(), 'description_' . $curlang_slug, true );
if ( $description ) {
$value = $description;
$curlang_key = 'description_' . $curlang_slug;
if ( um_profile( $curlang_key ) ) {
$value = um_profile( $curlang_key );
}
} elseif ( empty( $value ) && 0 === strpos( $key, 'description_' ) ) {
$value = um_filtered_value( 'description', $data );
}
return $value;
}
Expand All @@ -86,14 +91,14 @@ public function profile_bio_value( $value, $data, $key = null ) {
*/
public function profile_bio_update( $user_id, $args ) {
$curlang_slug = pll_current_language();
$bio_key = 'description_' . $curlang_slug;
if ( isset( $args[ $bio_key ] ) ) {
update_user_meta( $user_id, $bio_key, $args[ $bio_key ] );
$curlang_key = 'description_' . $curlang_slug;
if ( isset( $args[ $curlang_key ] ) ) {
update_user_meta( $user_id, $curlang_key, $args[ $curlang_key ] );
if ( pll_default_language() === $curlang_slug ) {
update_user_meta( $user_id, 'description', $args[ $bio_key ] );
update_user_meta( $user_id, 'description', $args[ $curlang_key ] );
}
} elseif ( isset( $args['description'] ) ) {
update_user_meta( $user_id, $bio_key, $args['description'] );
} elseif ( isset( $args[ 'description' ] ) ) {
update_user_meta( $user_id, 'description', $args[ 'description' ] );
}
}

Expand Down
4 changes: 4 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ This is a free extension created for the community. The Ultimate Member team doe

== Changelog ==

= 1.0.2: July 20, 2023 =

* Fixed: Translated description field value

= 1.0.1: June 21, 2023 =

* Added: A notice that Polylang plugin is required.
Expand Down
4 changes: 2 additions & 2 deletions um-polylang.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
Plugin Name: Ultimate Member - Polylang
Plugin URI: https://github.com/umdevelopera/um-polylang
Description: Integrates Ultimate Member with Polylang.
Version: 1.0.1
Version: 1.0.2
Author: umdevelopera
Author URI: https://github.com/umdevelopera
Text Domain: um-polylang
Domain Path: /languages
UM version: 2.5.0
UM version: 2.6.2
*/

if ( ! defined( 'ABSPATH' ) ) {
Expand Down

0 comments on commit 9ef0a33

Please sign in to comment.