diff --git a/README.md b/README.md index 296e929b..ecb51cb5 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ GNU Version 2 or Any Later Version ## Releases -[Official Release Version: 2.5.4](https://github.com/ultimatemember/ultimatemember/releases/tag/2.5.4). +[Official Release Version: 2.6.0](https://github.com/ultimatemember/ultimatemember/releases/tag/2.6.0). ## Changelog diff --git a/includes/admin/core/packages/2.6.0/functions.php b/includes/admin/core/packages/2.6.0/functions.php new file mode 100644 index 00000000..ad98baaa --- /dev/null +++ b/includes/admin/core/packages/2.6.0/functions.php @@ -0,0 +1,65 @@ +admin()->check_ajax_nonce(); + + um_maybe_unset_time_limit(); + + $fields_for_upgrade = array(); + + $forms_query = new \WP_Query; + $forms = $forms_query->query( array( + 'post_type' => 'um_form', + 'posts_per_page' => -1, + 'fields' => 'ids', + ) ); + + foreach ( $forms as $form_id ) { + $forms_fields = get_post_meta( $form_id, '_um_custom_fields', true ); + if ( ! is_array( $forms_fields ) ) { + continue; + } + + $need_update = false; + foreach ( $forms_fields as $key => &$field ) { + if ( array_key_exists( 'validate', $field ) && in_array( $field['validate'], array( 'google_url', 'googleplus_url', 'vk_url' ), true ) ) { // Looks like googleplus_url is old legacy value. + $field['validate'] = 'url'; + $need_update = true; + + $fields_for_upgrade[] = $key; + } + } + + if ( $need_update ) { + update_post_meta( $form_id, '_um_custom_fields', $forms_fields ); + } + } + + $need_update = false; + $custom_fields = get_option( 'um_fields', array() ); + foreach ( $custom_fields as &$field ) { + if ( array_key_exists( 'validate', $field ) && in_array( $field['validate'], array( 'google_url', 'googleplus_url', 'vk_url' ), true ) ) { // Looks like googleplus_url is old legacy value. + $field['validate'] = 'url'; + $need_update = true; + + $fields_for_upgrade[] = $field['metakey']; + } + } + if ( $need_update ) { + update_option( 'um_fields', $custom_fields ); + } + + $fields_for_upgrade = array_unique( $fields_for_upgrade ); + + // delete temporarily option for fields upgrade + update_option( 'um_last_version_upgrade', '2.6.0' ); + + if ( ! empty( $fields_for_upgrade ) ) { + wp_send_json_success( array( 'message' => __( 'Social URLs fields have been successfully updated.', 'ultimate-member' ) ) ); + } else { + wp_send_json_success( array( 'message' => __( 'Database has been updated successfully', 'ultimate-member' ) ) ); + } +} diff --git a/includes/admin/core/packages/2.6.0/hooks.php b/includes/admin/core/packages/2.6.0/hooks.php new file mode 100644 index 00000000..d6857b3f --- /dev/null +++ b/includes/admin/core/packages/2.6.0/hooks.php @@ -0,0 +1,5 @@ + 'social_fields260', +); diff --git a/includes/admin/core/packages/2.6.0/init.php b/includes/admin/core/packages/2.6.0/init.php new file mode 100644 index 00000000..10146ad7 --- /dev/null +++ b/includes/admin/core/packages/2.6.0/init.php @@ -0,0 +1,30 @@ + + + + diff --git a/includes/core/class-builtin.php b/includes/core/class-builtin.php index e5539241..30944e7a 100644 --- a/includes/core/class-builtin.php +++ b/includes/core/class-builtin.php @@ -949,24 +949,6 @@ if ( ! class_exists( 'um\core\Builtin' ) ) { 'match' => 'https://linkedin.com/', ), - 'googleplus' => array( - 'title' => __('Google+','ultimate-member'), - 'metakey' => 'googleplus', - 'type' => 'url', - 'label' => __('Google+','ultimate-member'), - 'required' => 0, - 'public' => 1, - 'editable' => 1, - 'url_target' => '_blank', - 'url_rel' => 'nofollow', - 'icon' => 'um-faicon-google-plus', - 'validate' => 'google_url', - 'url_text' => 'Google+', - 'advanced' => 'social', - 'color' => '#dd4b39', - 'match' => 'https://google.com/+', - ), - 'instagram' => array( 'title' => __('Instagram','ultimate-member'), 'metakey' => 'instagram', @@ -1150,24 +1132,6 @@ if ( ! class_exists( 'um\core\Builtin' ) ) { 'match' => 'https://soundcloud.com/', ), - 'vkontakte' => array( - 'title' => __('VKontakte','ultimate-member'), - 'metakey' => 'vkontakte', - 'type' => 'url', - 'label' => __('VKontakte','ultimate-member'), - 'required' => 0, - 'public' => 1, - 'editable' => 1, - 'url_target' => '_blank', - 'url_rel' => 'nofollow', - 'icon' => 'um-faicon-vk', - 'validate' => 'vk_url', - 'url_text' => 'VKontakte', - 'advanced' => 'social', - 'color' => '#2B587A', - 'match' => 'https://vk.com/', - ), - 'role_select' => array( 'title' => __('Roles (Dropdown)','ultimate-member'), 'metakey' => 'role_select', @@ -1522,10 +1486,8 @@ if ( ! class_exists( 'um\core\Builtin' ) ) { $array['alpha_numeric'] = __('Alpha-numeric value','ultimate-member'); $array['english'] = __('English letters only','ultimate-member'); $array['facebook_url'] = __('Facebook URL','ultimate-member'); - $array['google_url'] = __('Google+ URL','ultimate-member'); $array['instagram_url'] = __('Instagram URL','ultimate-member'); $array['linkedin_url'] = __('LinkedIn URL','ultimate-member'); - $array['vk_url'] = __('VKontakte URL','ultimate-member'); $array['lowercase'] = __('Lowercase only','ultimate-member'); $array['numeric'] = __('Numeric value only','ultimate-member'); $array['phone_number'] = __('Phone Number','ultimate-member'); diff --git a/includes/core/um-actions-form.php b/includes/core/um-actions-form.php index ce961498..cbf67cec 100644 --- a/includes/core/um-actions-form.php +++ b/includes/core/um-actions-form.php @@ -746,24 +746,12 @@ function um_submit_form_errors_hook_( $args ) { } break; - case 'google_url': - if ( ! UM()->validation()->is_url( $args[ $key ], 'plus.google.com' ) ) { - UM()->form()->add_error( $key, sprintf( __( 'Please enter a valid %s username or profile URL', 'ultimate-member' ), $array['label'] ) ); - } - break; - case 'linkedin_url': if ( ! UM()->validation()->is_url( $args[ $key ], 'linkedin.com' ) ) { UM()->form()->add_error( $key, sprintf( __( 'Please enter a valid %s username or profile URL', 'ultimate-member' ), $array['label'] ) ); } break; - case 'vk_url': - if ( ! UM()->validation()->is_url( $args[ $key ], 'vk.com' ) ) { - UM()->form()->add_error( $key, sprintf( __( 'Please enter a valid %s username or profile URL', 'ultimate-member' ), $array['label'] ) ); - } - break; - case 'discord': if ( ! UM()->validation()->is_discord_id( $args[ $key ] ) ) { UM()->form()->add_error( $key, __( 'Please enter a valid Discord ID', 'ultimate-member' ) ); diff --git a/includes/core/um-filters-fields.php b/includes/core/um-filters-fields.php index 73e280e4..22609c8d 100644 --- a/includes/core/um-filters-fields.php +++ b/includes/core/um-filters-fields.php @@ -432,12 +432,10 @@ function um_profile_field_filter_hook__( $value, $data, $type = '' ) { if ( $data['validate'] == 'facebook_url' ) $value = 'https://facebook.com/' . $value; if ( $data['validate'] == 'twitter_url' ) $value = 'https://twitter.com/' . $value; if ( $data['validate'] == 'linkedin_url' ) $value = 'https://linkedin.com/' . $value; - if ( $data['validate'] == 'googleplus_url' ) $value = 'https://plus.google.com/' . $value; if ( $data['validate'] == 'instagram_url' ) $value = 'https://instagram.com/' . $value; if ( $data['validate'] == 'tiktok_url' ) $value = 'https://tiktok.com/' . $value; if ( $data['validate'] == 'twitch_url' ) $value = 'https://twitch.tv/' . $value; if ( $data['validate'] == 'reddit_url' ) $value = 'https://www.reddit.com/user/' . $value; - if ( $data['validate'] == 'vk_url' ) $value = 'https://vk.com/' . $value; } if ( strpos( $value, 'http://' ) !== 0 ) { diff --git a/readme.txt b/readme.txt index a6aa3e30..93ff3110 100644 --- a/readme.txt +++ b/readme.txt @@ -6,8 +6,8 @@ Donate link: Tags: community, member, membership, user-profile, user-registration Requires PHP: 5.6 Requires at least: 5.0 -Tested up to: 6.1 -Stable tag: 2.5.4 +Tested up to: 6.2 +Stable tag: 2.6.0 License: GNU Version 2 or Any Later Version License URI: http://www.gnu.org/licenses/gpl-3.0.txt @@ -163,9 +163,11 @@ No, you do not need to use our plugin’s login or registration pages and can us * To learn more about version 2.1 please see this [docs](https://docs.ultimatemember.com/article/1512-upgrade-2-1-0) * UM2.1+ is a significant update to the Member Directories' code base from 2.0.x. Please make sure you take a full-site backup with restore point before updating the plugin -= 2.5.5: March xx, 2023 = += 2.6.0: March 29, 2023 = +* Deprecated: + - Deprecated: VKontakte and Google+ predefined fields. VKontakte and Google+ fields validation changed to just URL validation. = 2.5.4: February 17, 2023 = diff --git a/ultimate-member.php b/ultimate-member.php index ce7cf7c6..28d9b9c7 100644 --- a/ultimate-member.php +++ b/ultimate-member.php @@ -3,7 +3,7 @@ Plugin Name: Ultimate Member Plugin URI: http://ultimatemember.com/ Description: The easiest way to create powerful online communities and beautiful user profiles with WordPress -Version: 2.5.5-alpha +Version: 2.6.0 Author: Ultimate Member Author URI: http://ultimatemember.com/ Text Domain: ultimate-member