- fixed encoding if not installed mbstring PHP library;

- some texts changes;
- some fixes on first install and forms metaboxes;
This commit is contained in:
nikitozzzzzzz
2017-08-03 10:52:40 +03:00
parent f676d1c112
commit 6c9668c0cb
12 changed files with 61 additions and 63 deletions
@@ -4,11 +4,11 @@
'prefix_id' => 'form',
'fields' => array(
array(
'id' => '_um_login_use_globals',
'id' => '_um_login_use_custom_settings',
'type' => 'select',
'label' => __( 'Apply custom settings to this form', 'ultimate-member' ),
'tooltip' => __( 'Switch to yes if you want to customize this form settings, styling & appearance', 'ultimate-member' ),
'value' => UM()->query()->get_meta_value( '_um_login_use_globals', null, 0 ),
'value' => UM()->query()->get_meta_value( '_um_login_use_custom_settings', null, 0 ),
'options' => array(
0 => __( 'No', 'ultimate-member' ),
1 => __( 'Yes', 'ultimate-member' ),
@@ -20,7 +20,7 @@
'label' => __( 'Template', 'ultimate-member' ),
'value' => UM()->query()->get_meta_value( '_um_login_template', null, um_get_option( 'login_template' ) ),
'options' => UM()->shortcodes()->get_templates( 'login' ),
'conditional' => array( '_um_login_use_globals', '=', 1 )
'conditional' => array( '_um_login_use_custom_settings', '=', 1 )
),
array(
'id' => '_um_login_max_width',
@@ -28,7 +28,7 @@
'label' => __( 'Max. Width (px)', 'ultimate-member' ),
'tooltip' => __( 'The maximum width of shortcode in pixels e.g. 600px', 'ultimate-member' ),
'value' => UM()->query()->get_meta_value('_um_login_max_width', null, um_get_option( 'login_max_width' ) ),
'conditional' => array( '_um_login_use_globals', '=', 1 )
'conditional' => array( '_um_login_use_custom_settings', '=', 1 )
),
array(
'id' => '_um_login_icons',
@@ -41,7 +41,7 @@
'label' => __( 'Show with label', 'ultimate-member' ),
'off' => __( 'Turn off', 'ultimate-member' )
),
'conditional' => array( '_um_login_use_globals', '=', 1 )
'conditional' => array( '_um_login_use_custom_settings', '=', 1 )
),
array(
'id' => '_um_login_primary_btn_word',
@@ -49,14 +49,14 @@
'label' => __( 'Primary Button Text', 'ultimate-member' ),
'tooltip' => __( 'Customize the button text', 'ultimate-member' ),
'value' => UM()->query()->get_meta_value( '_um_login_primary_btn_word', null, um_get_option( 'login_primary_btn_word' ) ),
'conditional' => array( '_um_login_use_globals', '=', 1 )
'conditional' => array( '_um_login_use_custom_settings', '=', 1 )
),
array(
'id' => '_um_login_secondary_btn',
'type' => 'checkbox',
'label' => __( 'Show Secondary Button', 'ultimate-member' ),
'value' => UM()->query()->get_meta_value( '_um_login_secondary_btn', null, 1 ),
'conditional' => array( '_um_login_use_globals', '=', 1 )
'conditional' => array( '_um_login_use_custom_settings', '=', 1 )
),
array(
'id' => '_um_login_secondary_btn_word',
@@ -71,14 +71,14 @@
'type' => 'checkbox',
'label' => __( 'Show Forgot Password Link?', 'ultimate-member' ),
'value' => UM()->query()->get_meta_value( '_um_login_forgot_pass_link', null, um_get_option('login_forgot_pass_link') ),
'conditional' => array( '_um_login_use_globals', '=', 1 )
'conditional' => array( '_um_login_use_custom_settings', '=', 1 )
),
array(
'id' => '_um_login_show_rememberme',
'type' => 'checkbox',
'label' => __( 'Show "Remember Me"?', 'ultimate-member' ),
'value' => UM()->query()->get_meta_value( '_um_login_show_rememberme', null, um_get_option('login_show_rememberme') ),
'conditional' => array( '_um_login_use_globals', '=', 1 )
'conditional' => array( '_um_login_use_custom_settings', '=', 1 )
),
)
) )->render_form(); ?>
@@ -11,11 +11,11 @@
'prefix_id' => 'form',
'fields' => array(
array(
'id' => '_um_profile_use_globals',
'id' => '_um_profile_use_custom_settings',
'type' => 'select',
'label' => __( 'Apply custom settings to this form', 'ultimate-member' ),
'tooltip' => __( 'Switch to yes if you want to customize this form settings, styling & appearance', 'ultimate-member' ),
'value' => UM()->query()->get_meta_value( '_um_profile_use_globals', null, 0 ),
'value' => UM()->query()->get_meta_value( '_um_profile_use_custom_settings', null, 0 ),
'options' => array(
0 => __( 'No', 'ultimate-member' ),
1 => __( 'Yes', 'ultimate-member' ),
@@ -24,10 +24,11 @@
array(
'id' => '_um_profile_role',
'type' => 'select',
'label' => __( 'Make this profile role-specific', 'ultimate-member' ),
'label' => __( 'Make this profile form role-specific', 'ultimate-member' ),
'tooltip' => __( 'Please note if you make a profile form specific to a role then you must make sure that every other role is assigned a profile form', 'ultimate-member' ),
'value' => ! empty( $profile_role ) ? $profile_role : 0,
'options' => UM()->roles()->get_roles( __( 'All roles', 'ultimate-member' ) ),
'conditional' => array( '_um_profile_use_globals', '=', 1 )
'conditional' => array( '_um_profile_use_custom_settings', '=', 1 )
),
array(
'id' => '_um_profile_template',
@@ -35,7 +36,7 @@
'label' => __( 'Template', 'ultimate-member' ),
'value' => UM()->query()->get_meta_value( '_um_profile_template', null, um_get_option( 'profile_template' ) ),
'options' => UM()->shortcodes()->get_templates( 'profile' ),
'conditional' => array( '_um_profile_use_globals', '=', 1 )
'conditional' => array( '_um_profile_use_custom_settings', '=', 1 )
),
array(
'id' => '_um_profile_max_width',
@@ -43,7 +44,7 @@
'label' => __( 'Max. Width (px)', 'ultimate-member' ),
'tooltip' => __( 'The maximum width of shortcode in pixels e.g. 600px', 'ultimate-member' ),
'value' => UM()->query()->get_meta_value('_um_profile_max_width', null, um_get_option( 'profile_max_width' ) ),
'conditional' => array( '_um_profile_use_globals', '=', 1 )
'conditional' => array( '_um_profile_use_custom_settings', '=', 1 )
),
array(
'id' => '_um_profile_area_max_width',
@@ -51,7 +52,7 @@
'label' => __( 'Profile Area Max. Width (px)', 'ultimate-member' ),
'tooltip' => __( 'The maximum width of the profile area inside profile (below profile header)', 'ultimate-member' ),
'value' => UM()->query()->get_meta_value('_um_profile_area_max_width', null, um_get_option( 'profile_area_max_width' ) ),
'conditional' => array( '_um_profile_use_globals', '=', 1 )
'conditional' => array( '_um_profile_use_custom_settings', '=', 1 )
),
array(
'id' => '_um_profile_icons',
@@ -64,7 +65,7 @@
'label' => __( 'Show with label', 'ultimate-member' ),
'off' => __( 'Turn off', 'ultimate-member' )
),
'conditional' => array( '_um_profile_use_globals', '=', 1 )
'conditional' => array( '_um_profile_use_custom_settings', '=', 1 )
),
array(
'id' => '_um_profile_primary_btn_word',
@@ -72,14 +73,14 @@
'label' => __( 'Primary Button Text', 'ultimate-member' ),
'tooltip' => __( 'Customize the button text', 'ultimate-member' ),
'value' => UM()->query()->get_meta_value( '_um_profile_primary_btn_word', null, um_get_option( 'profile_primary_btn_word' ) ),
'conditional' => array( '_um_profile_use_globals', '=', 1 )
'conditional' => array( '_um_profile_use_custom_settings', '=', 1 )
),
array(
'id' => '_um_profile_secondary_btn',
'type' => 'checkbox',
'label' => __( 'Show Secondary Button', 'ultimate-member' ),
'value' => UM()->query()->get_meta_value( '_um_profile_secondary_btn', null, 1 ),
'conditional' => array( '_um_profile_use_globals', '=', 1 )
'conditional' => array( '_um_profile_use_custom_settings', '=', 1 )
),
array(
'id' => '_um_profile_secondary_btn_word',
@@ -94,7 +95,7 @@
'type' => 'checkbox',
'label' => __( 'Enable Cover Photos', 'ultimate-member' ),
'value' => UM()->query()->get_meta_value( '_um_profile_cover_enabled', null, 1 ),
'conditional' => array( '_um_profile_use_globals', '=', 1 )
'conditional' => array( '_um_profile_use_custom_settings', '=', 1 )
),
array(
'id' => '_um_profile_cover_ratio',
@@ -115,7 +116,7 @@
'label' => __( 'Profile Photo Size', 'ultimate-member' ),
'tooltip' => __( 'Set the profile photo size in pixels here', 'ultimate-member' ),
'value' => UM()->query()->get_meta_value( '_um_profile_photosize', null, um_get_option( 'profile_photosize' ) ),
'conditional' => array( '_um_profile_use_globals', '=', 1 )
'conditional' => array( '_um_profile_use_custom_settings', '=', 1 )
),
array(
'id' => '_um_profile_photo_required',
@@ -123,28 +124,28 @@
'label' => __( 'Make Profile Photo Required', 'ultimate-member' ),
'tooltip' => __( 'Require user to update a profile photo when updating their profile', 'ultimate-member' ),
'value' => UM()->query()->get_meta_value( '_um_profile_photo_required' ),
'conditional' => array( '_um_profile_use_globals', '=', 1 )
'conditional' => array( '_um_profile_use_custom_settings', '=', 1 )
),
array(
'id' => '_um_profile_show_name',
'type' => 'checkbox',
'label' => __( 'Show display name in profile header?', 'ultimate-member' ),
'value' => UM()->query()->get_meta_value( '_um_profile_show_name', null, 1 ),
'conditional' => array( '_um_profile_use_globals', '=', 1 )
'conditional' => array( '_um_profile_use_custom_settings', '=', 1 )
),
array(
'id' => '_um_profile_show_social_links',
'type' => 'checkbox',
'label' => __( 'Show social links in profile header?', 'ultimate-member' ),
'value' => UM()->query()->get_meta_value( '_um_profile_show_social_links', null, 0 ),
'conditional' => array( '_um_profile_use_globals', '=', 1 )
'value' => UM()->query()->get_meta_value( '_um_profile_show_social_links', null, UM()->um_get_option( 'profile_show_social_links' ) ),
'conditional' => array( '_um_profile_use_custom_settings', '=', 1 )
),
array(
'id' => '_um_profile_show_bio',
'type' => 'checkbox',
'label' => __( 'Show user description in profile header?', 'ultimate-member' ),
'value' => UM()->query()->get_meta_value( '_um_profile_show_bio', null, 1 ),
'conditional' => array( '_um_profile_use_globals', '=', 1 )
'conditional' => array( '_um_profile_use_custom_settings', '=', 1 )
),
)
@@ -15,6 +15,7 @@
'id' => '_um_profile_metafields',
'type' => 'multi_selects',
'label' => __( 'Field(s) to show in user meta', 'ultimate-member' ),
'tooltip' => __( 'Fields selected here will appear in the profile header area below the user\'s display name', 'ultimate-member' ),
'value' => $_um_search_fields,
'options' => $user_fields,
'add_text' => __( 'Add New Field', 'ultimate-member' ),
@@ -11,11 +11,11 @@
'prefix_id' => 'form',
'fields' => array(
array(
'id' => '_um_register_use_globals',
'id' => '_um_register_use_custom_settings',
'type' => 'select',
'label' => __( 'Apply custom settings to this form', 'ultimate-member' ),
'tooltip' => __( 'Switch to yes if you want to customize this form settings, styling & appearance', 'ultimate-member' ),
'value' => UM()->query()->get_meta_value( '_um_register_use_globals', null, 0 ),
'value' => UM()->query()->get_meta_value( '_um_register_use_custom_settings', null, 0 ),
'options' => array(
0 => __( 'No', 'ultimate-member' ),
1 => __( 'Yes', 'ultimate-member' ),
@@ -27,7 +27,7 @@
'label' => __( 'Assign role to form', 'ultimate-member' ),
'value' => ! empty( $register_role ) ? $register_role : 0,
'options' => UM()->roles()->get_roles( __( 'Default', 'ultimate-member' ) ),
'conditional' => array( '_um_register_use_globals', '=', 1 )
'conditional' => array( '_um_register_use_custom_settings', '=', 1 )
),
array(
'id' => '_um_register_template',
@@ -35,7 +35,7 @@
'label' => __( 'Template', 'ultimate-member' ),
'value' => UM()->query()->get_meta_value( '_um_register_template', null, um_get_option( 'register_template' ) ),
'options' => UM()->shortcodes()->get_templates( 'register' ),
'conditional' => array( '_um_register_use_globals', '=', 1 )
'conditional' => array( '_um_register_use_custom_settings', '=', 1 )
),
array(
'id' => '_um_register_max_width',
@@ -43,7 +43,7 @@
'label' => __( 'Max. Width (px)', 'ultimate-member' ),
'tooltip' => __( 'The maximum width of shortcode in pixels e.g. 600px', 'ultimate-member' ),
'value' => UM()->query()->get_meta_value('_um_register_max_width', null, um_get_option( 'register_max_width' ) ),
'conditional' => array( '_um_register_use_globals', '=', 1 )
'conditional' => array( '_um_register_use_custom_settings', '=', 1 )
),
array(
'id' => '_um_register_icons',
@@ -56,7 +56,7 @@
'label' => __( 'Show with label', 'ultimate-member' ),
'off' => __( 'Turn off', 'ultimate-member' )
),
'conditional' => array( '_um_register_use_globals', '=', 1 )
'conditional' => array( '_um_register_use_custom_settings', '=', 1 )
),
array(
'id' => '_um_register_primary_btn_word',
@@ -64,14 +64,14 @@
'label' => __( 'Primary Button Text', 'ultimate-member' ),
'tooltip' => __( 'Customize the button text', 'ultimate-member' ),
'value' => UM()->query()->get_meta_value( '_um_register_primary_btn_word', null, um_get_option( 'register_primary_btn_word' ) ),
'conditional' => array( '_um_register_use_globals', '=', 1 )
'conditional' => array( '_um_register_use_custom_settings', '=', 1 )
),
array(
'id' => '_um_register_secondary_btn',
'type' => 'checkbox',
'label' => __( 'Show Secondary Button', 'ultimate-member' ),
'value' => UM()->query()->get_meta_value( '_um_register_secondary_btn', null, 1 ),
'conditional' => array( '_um_register_use_globals', '=', 1 )
'conditional' => array( '_um_register_use_custom_settings', '=', 1 )
),
array(
'id' => '_um_register_secondary_btn_word',
+3 -3
View File
@@ -135,21 +135,21 @@ if ( ! class_exists( 'um\Config' ) ) {
'_um_custom_fields' => 'a:6:{s:10:"user_login";a:15:{s:5:"title";s:8:"Username";s:7:"metakey";s:10:"user_login";s:4:"type";s:4:"text";s:5:"label";s:8:"Username";s:8:"required";i:1;s:6:"public";i:1;s:8:"editable";i:0;s:8:"validate";s:15:"unique_username";s:9:"min_chars";i:3;s:9:"max_chars";i:24;s:8:"position";s:1:"1";s:6:"in_row";s:9:"_um_row_1";s:10:"in_sub_row";s:1:"0";s:9:"in_column";s:1:"1";s:8:"in_group";s:0:"";}s:10:"user_email";a:13:{s:5:"title";s:14:"E-mail Address";s:7:"metakey";s:10:"user_email";s:4:"type";s:4:"text";s:5:"label";s:14:"E-mail Address";s:8:"required";i:0;s:6:"public";i:1;s:8:"editable";i:1;s:8:"validate";s:12:"unique_email";s:8:"position";s:1:"4";s:6:"in_row";s:9:"_um_row_1";s:10:"in_sub_row";s:1:"0";s:9:"in_column";s:1:"1";s:8:"in_group";s:0:"";}s:13:"user_password";a:16:{s:5:"title";s:8:"Password";s:7:"metakey";s:13:"user_password";s:4:"type";s:8:"password";s:5:"label";s:8:"Password";s:8:"required";i:1;s:6:"public";i:1;s:8:"editable";i:1;s:9:"min_chars";i:8;s:9:"max_chars";i:30;s:15:"force_good_pass";i:1;s:18:"force_confirm_pass";i:1;s:8:"position";s:1:"5";s:6:"in_row";s:9:"_um_row_1";s:10:"in_sub_row";s:1:"0";s:9:"in_column";s:1:"1";s:8:"in_group";s:0:"";}s:10:"first_name";a:12:{s:5:"title";s:10:"First Name";s:7:"metakey";s:10:"first_name";s:4:"type";s:4:"text";s:5:"label";s:10:"First Name";s:8:"required";i:0;s:6:"public";i:1;s:8:"editable";i:1;s:8:"position";s:1:"2";s:6:"in_row";s:9:"_um_row_1";s:10:"in_sub_row";s:1:"0";s:9:"in_column";s:1:"1";s:8:"in_group";s:0:"";}s:9:"last_name";a:12:{s:5:"title";s:9:"Last Name";s:7:"metakey";s:9:"last_name";s:4:"type";s:4:"text";s:5:"label";s:9:"Last Name";s:8:"required";i:0;s:6:"public";i:1;s:8:"editable";i:1;s:8:"position";s:1:"3";s:6:"in_row";s:9:"_um_row_1";s:10:"in_sub_row";s:1:"0";s:9:"in_column";s:1:"1";s:8:"in_group";s:0:"";}s:9:"_um_row_1";a:4:{s:4:"type";s:3:"row";s:2:"id";s:9:"_um_row_1";s:8:"sub_rows";s:1:"1";s:4:"cols";s:1:"1";}}',
'_um_mode' => 'register',
'_um_core' => 'register',
'_um_register_use_globals' => 1,
'_um_register_use_custom_settings' => 0,
);
$this->core_form_meta['login'] = array(
'_um_custom_fields' => 'a:3:{s:8:"username";a:13:{s:5:"title";s:18:"Username or E-mail";s:7:"metakey";s:8:"username";s:4:"type";s:4:"text";s:5:"label";s:18:"Username or E-mail";s:8:"required";i:1;s:6:"public";i:1;s:8:"editable";i:0;s:8:"validate";s:24:"unique_username_or_email";s:8:"position";s:1:"1";s:6:"in_row";s:9:"_um_row_1";s:10:"in_sub_row";s:1:"0";s:9:"in_column";s:1:"1";s:8:"in_group";s:0:"";}s:13:"user_password";a:16:{s:5:"title";s:8:"Password";s:7:"metakey";s:13:"user_password";s:4:"type";s:8:"password";s:5:"label";s:8:"Password";s:8:"required";i:1;s:6:"public";i:1;s:8:"editable";i:1;s:9:"min_chars";i:8;s:9:"max_chars";i:30;s:15:"force_good_pass";i:1;s:18:"force_confirm_pass";i:1;s:8:"position";s:1:"2";s:6:"in_row";s:9:"_um_row_1";s:10:"in_sub_row";s:1:"0";s:9:"in_column";s:1:"1";s:8:"in_group";s:0:"";}s:9:"_um_row_1";a:4:{s:4:"type";s:3:"row";s:2:"id";s:9:"_um_row_1";s:8:"sub_rows";s:1:"1";s:4:"cols";s:1:"1";}}',
'_um_mode' => 'login',
'_um_core' => 'login',
'_um_login_use_globals' => 1,
'_um_login_use_custom_settings' => 0,
);
$this->core_form_meta['profile'] = array(
'_um_custom_fields' => 'a:1:{s:9:"_um_row_1";a:4:{s:4:"type";s:3:"row";s:2:"id";s:9:"_um_row_1";s:8:"sub_rows";s:1:"1";s:4:"cols";s:1:"1";}}',
'_um_mode' => 'profile',
'_um_core' => 'profile',
'_um_profile_use_globals' => 1,
'_um_profile_use_custom_settings' => 0,
);
$this->email_notifications = apply_filters( 'um_email_notifications', array(
-6
View File
@@ -277,12 +277,6 @@ if ( ! class_exists( 'Account' ) ) {
);
$args = wp_parse_args( $args, $defaults );
/*if ( isset( $args['use_globals'] ) && $args['use_globals'] == 1 ) {
$args = array_merge( $args, $this->get_css_args( $args ) );
} else {
$args = array_merge( $this->get_css_args( $args ), $args );
}*/
$args = apply_filters('um_account_shortcode_args_filter', $args);
extract( $args, EXTR_SKIP );
+3 -3
View File
@@ -283,14 +283,14 @@ if ( ! class_exists( 'Form' ) ) {
* @param integer $post_id
* @return string $role
*/
function assigned_role( $post_id ){
function assigned_role( $post_id ) {
$mode = $this->form_type( $post_id );
$use_globals = get_post_meta( $post_id, "_um_{$mode}_use_globals", true);
$use_custom = get_post_meta( $post_id, "_um_{$mode}_use_custom_settings", true );
$global_role = get_option('default_role'); // Form Global settings
if ( $use_globals == 0 ) { // Non-Global settings
if ( $use_custom ) { // Non-Global settings
$role = get_post_meta( $post_id, "_um_{$mode}_role", true );
}
+1 -1
View File
@@ -159,7 +159,7 @@ if ( ! class_exists( 'Password' ) ) {
);
$args = wp_parse_args( $args, $defaults );
if ( isset( $args['use_globals'] ) && $args['use_globals'] == 1 ) {
if ( empty( $args['use_custom_settings'] ) ) {
$args = array_merge( $args, $this->get_css_args( $args ) );
} else {
$args = array_merge( $this->get_css_args( $args ), $args );
+3 -3
View File
@@ -292,10 +292,10 @@ if ( ! class_exists( 'Shortcodes' ) ) {
$args = array_merge($post_data, $args);
if (isset($args['use_globals']) && $args['use_globals'] == 1) {
$args = array_merge($args, $this->get_css_args($args));
if ( empty( $args['use_custom_settings'] ) ) {
$args = array_merge( $args, $this->get_css_args( $args ) );
} else {
$args = array_merge($this->get_css_args($args), $args);
$args = array_merge( $this->get_css_args( $args ), $args );
}
// filter for arguments
+1 -1
View File
@@ -272,7 +272,7 @@
***/
add_action('um_after_profile_header_name_args','um_social_links_icons', 50 );
function um_social_links_icons( $args ) {
if ( isset($args['show_social_links']) && $args['show_social_links'] ) {
if ( ! empty( $args['show_social_links'] ) ) {
echo '<div class="um-profile-connect um-member-connect">';
UM()->fields()->show_social_urls();
+5 -5
View File
@@ -275,16 +275,16 @@
/**
* Register user with predefined role in options
*/
add_action('um_after_register_fields', 'um_add_user_role');
function um_add_user_role( $args ){
add_action( 'um_after_register_fields', 'um_add_user_role' );
function um_add_user_role( $args ) {
if ( isset( $args['custom_fields']['role_select'] ) || isset( $args['custom_fields']['role_radio'] ) ) return;
$use_global_settings = get_post_meta( $args['form_id'], '_um_register_use_globals', true);
$use_custom_settings = get_post_meta( $args['form_id'], '_um_register_use_custom_settings', true );
if (isset($args['role']) && !empty($args['role']) && $use_global_settings == 0 ) {
if ( ! empty( $args['role'] ) && $use_custom_settings ) {
$role = $args['role'];
} else if( $use_global_settings == 1 ) {
} else if( ! $use_custom_settings ) {
//$role = um_get_option('default_role');
$role = get_option( 'default_role' );
}
+9 -7
View File
@@ -380,13 +380,15 @@
* @return string
* @uses hook filter: um_field_non_utf8_value
*/
add_filter('um_field_non_utf8_value','um_field_non_utf8_value');
function um_field_non_utf8_value( $value ){
$encoding = mb_detect_encoding( $value, 'utf-8, iso-8859-1, ascii', true);
if (strcasecmp($encoding, 'UTF-8') !== 0) {
$value = iconv($encoding, 'utf-8', $value);
}
add_filter( 'um_field_non_utf8_value', 'um_field_non_utf8_value' );
function um_field_non_utf8_value( $value ) {
if ( function_exists( 'mb_detect_encoding' ) ) {
$encoding = mb_detect_encoding( $value, 'utf-8, iso-8859-1, ascii', true );
if ( strcasecmp( $encoding, 'UTF-8' ) !== 0 ) {
$value = iconv( $encoding, 'utf-8', $value );
}
}
return $value;
}