diff --git a/admin/assets/css/um-admin-columns.css b/admin/assets/css/um-admin-columns.css index 9aea7d70..b8df8d3f 100644 --- a/admin/assets/css/um-admin-columns.css +++ b/admin/assets/css/um-admin-columns.css @@ -54,10 +54,20 @@ line-height: 34px; } .um-admin-tag.small {font-size: 13px;height:28px;line-height: 28px;display:inline;padding: 4px 10px;background: transparent;color: #666;border-radius:0;} -.um-admin-tag.ok {border-left: 2px solid #93ba37} +.um-admin-tag.approved {border-left: 2px solid #7ACF58} .um-admin-tag.pending {border-left: 2px solid #b76767} .um-admin-txtspace {margin: 0 0 0 10px;} -.um-adm-ico {font-size: 20px;margin-top: 5px;display:inline-block;color:#3ba1da} +.um-adm-ico { + font-size: 20px; + width: 20px; + text-align: center; + margin-top: 5px; + display: inline-block; + color: #7ACF58; +} + +.um-adm-ico.inactive {color: #b76767} + .um-adm-ico.pointer {cursor: pointer} \ No newline at end of file diff --git a/admin/assets/css/um-admin-dashboard.css b/admin/assets/css/um-admin-dashboard.css index 1ef798fa..97b8de0d 100644 --- a/admin/assets/css/um-admin-dashboard.css +++ b/admin/assets/css/um-admin-dashboard.css @@ -3,7 +3,7 @@ } .wrap a.red, -.wrap span.red {color:#A00} +.wrap span.red {color:#b76767} .wrap span.ok {color:#7ACF58} diff --git a/admin/assets/css/um-admin-misc.css b/admin/assets/css/um-admin-misc.css index cddd6eb0..a254dc42 100644 --- a/admin/assets/css/um-admin-misc.css +++ b/admin/assets/css/um-admin-misc.css @@ -115,9 +115,11 @@ body.um-admin-modal-open { margin: 0 0 8px 0 !important; padding: 0!important; font-size: 13px; - color: #888; + color: #666; } +.um-admin-metabox label strong {color: #222} + .um-admin-metabox input[type=text]:disabled{ opacity: 0.7 !important; color: #aaa !important; diff --git a/admin/core/um-admin-actions.php b/admin/core/um-admin-actions.php index a3b604e6..1612e8db 100644 --- a/admin/core/um-admin-actions.php +++ b/admin/core/um-admin-actions.php @@ -67,7 +67,6 @@ $locale = get_option('WPLANG'); if ( !$locale ) return; - if ( file_exists( WP_LANG_DIR . '/plugins/ultimatemember-'.$locale.'.mo' ) ) return; if ( !isset( $ultimatemember->available_languages[$locale] ) ) return; $path = $ultimatemember->files->upload_basedir; @@ -86,7 +85,9 @@ copy( $remote2_tmp, $path . 'ultimatemember-' . $locale . '.mo' ); unlink( $remote2_tmp ); - exit( wp_redirect( remove_query_arg('um_adm_action') ) ); + $url = remove_query_arg('um_adm_action', $ultimatemember->permalinks->get_current_url() ); + $url = add_query_arg('update','language_updated',$url); + exit( wp_redirect($url) ); } diff --git a/admin/core/um-admin-dashboard.php b/admin/core/um-admin-dashboard.php index e2b54913..32b8e526 100644 --- a/admin/core/um-admin-dashboard.php +++ b/admin/core/um-admin-dashboard.php @@ -50,7 +50,8 @@ class UM_Admin_Dashboard { *** @load metabox stuff ***/ function on_load_page() { - + global $ultimatemember; + wp_enqueue_script('common'); wp_enqueue_script('wp-lists'); wp_enqueue_script('postbox'); @@ -62,7 +63,33 @@ class UM_Admin_Dashboard { add_meta_box('um-metaboxes-contentbox-1', __('Users Overview','ultimatemember'), array(&$this, 'users_overview'), $this->pagehook, 'normal', 'core'); add_meta_box('um-metaboxes-sidebox-1', __('Purge Temp Files','ultimatemember'), array(&$this, 'purge_temp'), $this->pagehook, 'side', 'core'); - + + if ( $this->language_avaialable_not_installed() ) { + add_meta_box('um-metaboxes-sidebox-2', __('Language','ultimatemember'), array(&$this, 'dl_language'), $this->pagehook, 'side', 'core'); + } else if ( $this->language_avaialable_installed() ) { + add_meta_box('um-metaboxes-sidebox-2', __('Language','ultimatemember'), array(&$this, 'up_language'), $this->pagehook, 'side', 'core'); + } else if ( $this->language_not_available() ) { + add_meta_box('um-metaboxes-sidebox-2', __('Language','ultimatemember'), array(&$this, 'ct_language'), $this->pagehook, 'side', 'core'); + } + + } + + function up_language() { + global $ultimatemember; + $locale = get_option('WPLANG'); + include_once um_path . 'admin/templates/dashboard/language-update.php'; + } + + function dl_language() { + global $ultimatemember; + $locale = get_option('WPLANG'); + include_once um_path . 'admin/templates/dashboard/language-download.php'; + } + + function ct_language() { + global $ultimatemember; + $locale = get_option('WPLANG'); + include_once um_path . 'admin/templates/dashboard/language-contrib.php'; } function users_overview() { @@ -75,6 +102,38 @@ class UM_Admin_Dashboard { include_once um_path . 'admin/templates/dashboard/purge.php'; } + /*** + *** @language not available + ***/ + function language_not_available() { + $locale = get_option('WPLANG'); + if ( $locale && !isset( $ultimatemember->available_languages[$locale] ) && !file_exists( WP_LANG_DIR . '/plugins/ultimatemember-' . $locale . '.mo' ) ) + return true; + return false; + } + + /*** + *** @language available but not installed + ***/ + function language_avaialable_not_installed() { + global $ultimatemember; + $locale = get_option('WPLANG'); + if ( $locale && isset( $ultimatemember->available_languages[$locale] ) && !file_exists( WP_LANG_DIR . '/plugins/ultimatemember-' . $locale . '.mo' ) ) + return true; + return false; + } + + /*** + *** @language available and installed + ***/ + function language_avaialable_installed() { + global $ultimatemember; + $locale = get_option('WPLANG'); + if ( $locale && isset( $ultimatemember->available_languages[$locale] ) && file_exists( WP_LANG_DIR . '/plugins/ultimatemember-' . $locale . '.mo' ) ) + return true; + return false; + } + /*** *** @get a directory size ***/ diff --git a/admin/core/um-admin-metabox.php b/admin/core/um-admin-metabox.php index a7d273ea..f17d5e0c 100644 --- a/admin/core/um-admin-metabox.php +++ b/admin/core/um-admin-metabox.php @@ -122,7 +122,10 @@ class UM_Admin_Metabox { ***/ function ui_on_off( $id, $default=0, $is_conditional=false, $cond1='', $cond1_show='', $cond1_hide='', $yes='', $no='' ) { - $meta = get_post_meta( get_the_ID(), $id, true ); + $meta = (string)get_post_meta( get_the_ID(), $id, true ); + if ( $meta === '0' && $default > 0 ) { + $default = $meta; + } $yes = ( !empty( $yes ) ) ? $yes : __('Yes'); $no = ( !empty( $no ) ) ? $no : __('No'); diff --git a/admin/core/um-admin-notices.php b/admin/core/um-admin-notices.php index 43802584..ffd1a729 100644 --- a/admin/core/um-admin-notices.php +++ b/admin/core/um-admin-notices.php @@ -27,7 +27,9 @@ class UM_Admin_Notices { $path = str_replace('//','/',$path); if ( !file_exists( $path ) ) { + $old = umask(0); @mkdir( $path, 0777, true); + umask($old); } } @@ -111,6 +113,10 @@ class UM_Admin_Notices { $update = $_REQUEST['update']; switch($update) { + case 'language_updated': + $messages[0]['content'] = __('Your translation files have been updated successfully.','ultimatemember'); + break; + case 'purged_temp': $messages[0]['content'] = __('Your temp uploads directory is now clean.','ultimatemember'); break; diff --git a/admin/core/um-admin-users.php b/admin/core/um-admin-users.php index 972f2967..8a8dc2ce 100644 --- a/admin/core/um-admin-users.php +++ b/admin/core/um-admin-users.php @@ -248,7 +248,7 @@ class UM_Admin_Users { um_fetch_user( $user_id ); if ( um_user('account_status') == 'approved' ) { - $output = ''.um_user('account_status_name').''; + $output = ''.um_user('account_status_name').''; } else { $output = ''.um_user('account_status_name').''; } diff --git a/admin/templates/dashboard/language-contrib.php b/admin/templates/dashboard/language-contrib.php new file mode 100644 index 00000000..6f4a093a --- /dev/null +++ b/admin/templates/dashboard/language-contrib.php @@ -0,0 +1,3 @@ +

%1$s.','ultimatemember'), $locale); ?>

+ +

.','ultimatemember'); ?>

\ No newline at end of file diff --git a/admin/templates/dashboard/language-download.php b/admin/templates/dashboard/language-download.php new file mode 100644 index 00000000..8fd3486e --- /dev/null +++ b/admin/templates/dashboard/language-download.php @@ -0,0 +1,3 @@ +

%1$s (%2$s).','ultimatemember'), $ultimatemember->available_languages[$locale], $locale); ?>

+ +

\ No newline at end of file diff --git a/admin/templates/dashboard/language-update.php b/admin/templates/dashboard/language-update.php new file mode 100644 index 00000000..e2577e58 --- /dev/null +++ b/admin/templates/dashboard/language-update.php @@ -0,0 +1,3 @@ +

%1$s (%2$s).','ultimatemember'), $ultimatemember->available_languages[$locale], $locale); ?>

+ +

\ No newline at end of file diff --git a/core/lib/upload/um-image-upload.php b/core/lib/upload/um-image-upload.php index b638773a..cda33d20 100644 --- a/core/lib/upload/um-image-upload.php +++ b/core/lib/upload/um-image-upload.php @@ -16,7 +16,7 @@ if(isset($_FILES[$id]['name'])) { $temp = $_FILES[$id]["tmp_name"]; $file = $_FILES[$id]["name"]; - + $file = str_replace(array('(',')','+','&','?','%','{','}','[',']','=',',',';',' '),'',$file); $error = $ultimatemember->files->check_image_upload( $temp, $id ); if ( $error ){ diff --git a/core/um-access.php b/core/um-access.php index 10a1874a..aba7b5ea 100644 --- a/core/um-access.php +++ b/core/um-access.php @@ -15,15 +15,19 @@ class UM_Access { *** @do actions based on priority ***/ function template_redirect() { - + global $ultimatemember; + do_action('um_access_homepage_per_role'); do_action('um_access_global_settings'); do_action('um_access_post_settings'); - if ( $this->redirect_handler && !$this->allow_access ) + if ( $this->redirect_handler && !$this->allow_access ) { + $curr = $ultimatemember->permalinks->get_current_url(); + $this->redirect_handler = add_query_arg('redirect_to', $curr, $this->redirect_handler); exit( wp_redirect( $this->redirect_handler ) ); + } } diff --git a/core/um-account.php b/core/um-account.php index ed5636be..5aa390eb 100644 --- a/core/um-account.php +++ b/core/um-account.php @@ -114,30 +114,56 @@ class UM_Account { function get_tab_output( $id ) { global $ultimatemember; + $output = null; + switch( $id ) { - case 'privacy' : + + case 'notifications': + $output = apply_filters("um_account_content_hook_{$id}", $output); + return $output; + break; + + case 'privacy': $args = 'profile_privacy,hide_in_members'; + $fields = $ultimatemember->builtin->get_specific_fields( $args ); + foreach( $fields as $key => $data ){ + $output .= $ultimatemember->fields->edit_field( $key, $data ); + } + return $output; break; - case 'delete' : + + case 'delete': $args = 'single_user_password'; + $fields = $ultimatemember->builtin->get_specific_fields( $args ); + foreach( $fields as $key => $data ){ + $output .= $ultimatemember->fields->edit_field( $key, $data ); + } + return $output; break; - case 'general' : + + case 'general': $args = 'user_login,first_name,last_name,user_email'; + $fields = $ultimatemember->builtin->get_specific_fields( $args ); + foreach( $fields as $key => $data ){ + $output .= $ultimatemember->fields->edit_field( $key, $data ); + } + return $output; break; - case 'password' : + + case 'password': $args = 'user_password'; + $fields = $ultimatemember->builtin->get_specific_fields( $args ); + foreach( $fields as $key => $data ){ + $output .= $ultimatemember->fields->edit_field( $key, $data ); + } + return $output; break; + default : $args = null; break; + } - - $fields = $ultimatemember->builtin->get_specific_fields( $args ); - $output = null; - foreach( $fields as $key => $data ){ - $output .= $ultimatemember->fields->edit_field( $key, $data ); - } - return $output; } /*** diff --git a/core/um-actions-access.php b/core/um-actions-access.php index af50b9f6..6be2fa50 100644 --- a/core/um-actions-access.php +++ b/core/um-actions-access.php @@ -114,7 +114,7 @@ case 2: if ( !is_user_logged_in() ){ - if ( !$access_redirect ) $access_redirect = home_url(); + if ( !$access_redirect ) $access_redirect = um_get_core_page('login'); $redirect_to = $access_redirect; } diff --git a/core/um-actions-account.php b/core/um-actions-account.php index ac0ff98f..418faed3 100644 --- a/core/um-actions-account.php +++ b/core/um-actions-account.php @@ -38,6 +38,8 @@ } } + do_action('um_pre_account_update'); + $tab = ( get_query_var('um_tab') ) ? get_query_var('um_tab') : 'general'; exit( wp_redirect( $ultimatemember->account->tab_link( $tab ) ) ); @@ -218,6 +220,30 @@ } } + /*** + *** @display tab "Notifications" + ***/ + add_action('um_account_tab__notifications', 'um_account_tab__notifications'); + function um_account_tab__notifications( $info ) { + global $ultimatemember; + extract( $info ); + extract( $info ); + + $output = $ultimatemember->account->get_tab_output('notifications'); + + if ( $output ) { ?> + +
+ + + +
+ + get_var("SELECT ID FROM $wpdb->posts WHERE post_status = 'publish' AND post_name = '$role_slug'"); + $post_id = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'um_role' AND post_name = '$role_slug'"); $real_role_slug = $role_slug; } diff --git a/core/um-shortcodes.php b/core/um-shortcodes.php index 7e881c67..65d95197 100644 --- a/core/um-shortcodes.php +++ b/core/um-shortcodes.php @@ -98,12 +98,14 @@ class UM_Shortcodes { } $args = apply_filters('um_shortcode_args_filter', $args ); - - if ( um_profile_id() && isset( $args['role'] ) && $args['role'] && $args['role'] != $ultimatemember->query->get_role_by_userid( um_profile_id() ) ) - return; extract( $args, EXTR_SKIP ); + // for profiles only + if ( $mode == 'profile' && um_profile_id() && isset( $args['role'] ) && $args['role'] && + $args['role'] != $ultimatemember->query->get_role_by_userid( um_profile_id() ) ) + return; + do_action("um_pre_{$mode}_shortcode", $args); do_action("um_before_form_is_loaded", $args); diff --git a/index.php b/index.php index 66255f26..e7df37c3 100644 --- a/index.php +++ b/index.php @@ -3,7 +3,7 @@ Plugin Name: Ultimate Member Plugin URI: http://ultimatemember.com/ Description: Ultimate Member is a powerful community and membership plugin that allows you to create beautiful community and membership sites with WordPress -Version: 1.0.47 +Version: 1.0.48 Author: Ultimate Member Author URI: http://ultimatemember.com/ */ diff --git a/readme.txt b/readme.txt index 301aeb0d..4d55e6ab 100644 --- a/readme.txt +++ b/readme.txt @@ -7,7 +7,7 @@ Tags: access control, author, authors, author profile, comments, community, comm Requires at least: 4.1 Tested up to: 4.1 -Stable Tag: 1.0.47 +Stable Tag: 1.0.48 License: GNU Version 2 or Any Later Version @@ -186,6 +186,18 @@ The plugin works with popular caching plugins by automatically excluding Ultimat == Changelog == += 1.0.48: February 10, 2015 = + +* New: added translation downloader/updater in plugin dashboard +* New: added admin notice when language is updated or downloaded +* Tweak: redirect to login page by default if content is restricted +* Tweak: redirect back to the protected content after successful login +* Tweak: small modifications to plugin admin css +* Fixed: issue with registration form per role not appearing (when logged in) +* Fixed: image and file uploads strip illegal characters from file name +* Fixed: small issue with mandrill plugin +* Fixed: bug with role creation that have used slugs that exist in database + = 1.0.47: February 9, 2015 = * New: A more native dashboard for Ultimate Member