diff --git a/admin/core/lib/ReduxFramework/ReduxCore/framework.php b/admin/core/lib/ReduxFramework/ReduxCore/framework.php index 470e9850..3aed7790 100644 --- a/admin/core/lib/ReduxFramework/ReduxCore/framework.php +++ b/admin/core/lib/ReduxFramework/ReduxCore/framework.php @@ -1327,9 +1327,11 @@ add_submenu_page( $this->slug, __('Forms', $this->slug), __('Forms', $this->slug), 'manage_options', 'edit.php?post_type=um_form', '', '' ); - add_submenu_page( $this->slug, __('Member Levels', $this->slug), __('Member Levels', $this->slug), 'manage_options', 'edit.php?post_type=um_role', '', '' ); + add_submenu_page( $this->slug, __('User Roles', $this->slug), __('User Roles', $this->slug), 'manage_options', 'edit.php?post_type=um_role', '', '' ); + if ( um_get_option('members_page' ) ){ add_submenu_page( $this->slug, __('Member Directories', $this->slug), __('Member Directories', $this->slug), 'manage_options', 'edit.php?post_type=um_directory', '', '' ); + } } diff --git a/admin/core/um-admin-actions-fields.php b/admin/core/um-admin-actions-fields.php index fc8025b0..ab6cea66 100644 --- a/admin/core/um-admin-actions-fields.php +++ b/admin/core/um-admin-actions-fields.php @@ -31,7 +31,7 @@ $save[ $_metakey ]['icon'] = ''; foreach( $array['post'] as $key => $val){ - if ( substr( $key, 0, 1) === '_' ) { // field attribute + if ( substr( $key, 0, 1) === '_' && $val != '' ) { // field attribute $new_key = ltrim ($key,'_'); if ( $new_key == 'options' ) { diff --git a/admin/core/um-admin-enqueue.php b/admin/core/um-admin-enqueue.php index 1991e970..49d125e2 100644 --- a/admin/core/um-admin-enqueue.php +++ b/admin/core/um-admin-enqueue.php @@ -23,11 +23,6 @@ class UM_Admin_Enqueue { ***/ function admin_footer_text() { $copyright = sprintf(__('Thank you for creating with Ultimate Member and WordPress.','ultimatemember')); - - if ( um_get_option('admin_load_time') == 1 ) { - $copyright .= '
' . sprintf(__('%1$s queries made in %2$s seconds','ultimatemember'), get_num_queries(), timer_stop(0) ); - } - return '' . $copyright . ''; } diff --git a/admin/core/um-admin-metabox.php b/admin/core/um-admin-metabox.php index 26f1de05..80f1eedc 100644 --- a/admin/core/um-admin-metabox.php +++ b/admin/core/um-admin-metabox.php @@ -309,6 +309,7 @@ class UM_Admin_Metabox { // save delete_post_meta( $post_id, '_um_can_view_roles' ); delete_post_meta( $post_id, '_um_can_edit_roles' ); + delete_post_meta( $post_id, '_um_can_delete_roles' ); foreach( $_POST as $k => $v ) { if (strstr($k, '_um_')){ update_post_meta( $post_id, $k, $v); diff --git a/admin/templates/directory/search.php b/admin/templates/directory/search.php index 74ca8ca4..63298e54 100644 --- a/admin/templates/directory/search.php +++ b/admin/templates/directory/search.php @@ -76,7 +76,7 @@ - +

@@ -85,7 +85,7 @@ - +

diff --git a/admin/templates/role/delete.php b/admin/templates/role/delete.php index a1037244..50658ca6 100644 --- a/admin/templates/role/delete.php +++ b/admin/templates/role/delete.php @@ -3,7 +3,7 @@

- + diff --git a/admin/templates/role/general.php b/admin/templates/role/general.php index d0fb0987..c9a08fff 100644 --- a/admin/templates/role/general.php +++ b/admin/templates/role/general.php @@ -6,17 +6,7 @@ ui_on_off('_um_can_edit_profile', 1); ?>

- -

- - ui_on_off('_um_can_upload_pics', 1); ?> -

- -

- - ui_on_off('_um_can_upload_files', 1); ?> -

- +

ui_on_off('_um_can_delete_profile', 1); ?> diff --git a/admin/templates/role/home.php b/admin/templates/role/home.php index a3755bea..5f08577c 100644 --- a/admin/templates/role/home.php +++ b/admin/templates/role/home.php @@ -3,7 +3,7 @@

- + ui_on_off('_um_default_homepage', 1, true, 1, 'xxx', 'redirect-home-url'); ?> @@ -12,7 +12,7 @@

- + diff --git a/admin/templates/role/login.php b/admin/templates/role/login.php index 8f0342b3..6deb0e26 100644 --- a/admin/templates/role/login.php +++ b/admin/templates/role/login.php @@ -3,7 +3,7 @@

- + diff --git a/admin/templates/role/logout.php b/admin/templates/role/logout.php index 6723970c..bf183389 100644 --- a/admin/templates/role/logout.php +++ b/admin/templates/role/logout.php @@ -3,7 +3,7 @@

- + diff --git a/admin/templates/role/profile.php b/admin/templates/role/profile.php index 83c56b31..7b02175f 100644 --- a/admin/templates/role/profile.php +++ b/admin/templates/role/profile.php @@ -26,7 +26,7 @@

- + ui_on_off('_um_can_access_private_profile'); ?>

diff --git a/admin/templates/role/register.php b/admin/templates/role/register.php index 4ddc7aa8..75425915 100644 --- a/admin/templates/role/register.php +++ b/admin/templates/role/register.php @@ -3,7 +3,7 @@

- + @@ -34,7 +34,7 @@

- + @@ -49,7 +49,7 @@

- + +

- + @@ -87,7 +87,7 @@

- + +

- + diff --git a/assets/css/pickadate/default.time.css b/assets/css/pickadate/default.time.css index d86cd522..21a1f540 100644 --- a/assets/css/pickadate/default.time.css +++ b/assets/css/pickadate/default.time.css @@ -76,6 +76,7 @@ outline: 0 !important; background: none !important; border-radius: 0 0 2px 2px; + color: #fff !important; } .picker--time .picker__button--clear:hover, .picker--time .picker__button--clear:focus { diff --git a/assets/css/um-account.css b/assets/css/um-account.css index bcf0146c..6ed1a2ea 100644 --- a/assets/css/um-account.css +++ b/assets/css/um-account.css @@ -37,7 +37,7 @@ font-size: 18px; line-height: 18px; font-weight: bold; - color: #333; + color: #555; } .um-account-main div.um-account-heading i { @@ -65,6 +65,8 @@ margin-bottom: 20px; } +.um-account-meta img {margin: 0 !important} + .um-account-meta.radius-1 img { border-radius: 999px } .um-account-meta.radius-2 img { border-radius: 4px } .um-account-meta.radius-3 img { border-radius: 0 } diff --git a/assets/css/um-members.css b/assets/css/um-members.css index d74dbb0b..cddf354d 100644 --- a/assets/css/um-members.css +++ b/assets/css/um-members.css @@ -185,6 +185,8 @@ position: relative; top: -35px; margin-bottom: -45px !important; + float: none; + opacity: 1; } .um-member-photo.radius-1 img { border-radius: 999px !important } @@ -276,13 +278,13 @@ padding-top: 20px; } -.um-member-connect a{ +.um-member-connect a { display: inline-block; width: 40px; line-height: 40px; height: 40px; border-radius: 999px; - color: #fff; + color: #fff !important; opacity: 0.85; margin: 0 1px; font-size: 16px; diff --git a/assets/css/um-profile.css b/assets/css/um-profile.css index 75797031..beb82430 100644 --- a/assets/css/um-profile.css +++ b/assets/css/um-profile.css @@ -4,7 +4,6 @@ .um-profile { box-sizing: border-box; - padding-top: 10px; } .um-profile .um-cover-overlay { @@ -104,6 +103,7 @@ vertical-align: middle; height: 100%; text-decoration: none !important; + background: none; } .um-cover-overlay i { @@ -131,7 +131,7 @@ font-size: 30px; height: 30px; line-height: 30px; - z-index: 666; + z-index: 66; } /* @@ -153,7 +153,6 @@ float: none !important; margin: 0 auto !important; text-align: center !important; - padding-top: 20px !important; } .um-header.no-cover a.um-profile-photo-img { @@ -161,8 +160,6 @@ top: auto !important; left: auto !important; float: none !important; - width: auto !important; - height: auto !important; display: inline-block !important; text-align: center !important; } @@ -223,6 +220,7 @@ vertical-align: middle; height: 100%; text-decoration: none !important; + background: none; } .um-profile-photo-overlay i { @@ -236,6 +234,9 @@ .um-profile-meta { padding-right: 30px; + -ms-word-break: break-all; + word-break: break-word; + word-wrap: break-word; } .um-main-meta { @@ -247,12 +248,17 @@ font-size: 24px; font-weight: bold; margin-right: 30px; + line-height: 1.7em; } .um-meta { font-size: 15px; } +.um-meta span a { +font-weight: normal; +} + .um-meta span:first-child {margin: 0 5px 0 0} .um-meta span { margin: 0 5px; diff --git a/assets/css/um-responsive.css b/assets/css/um-responsive.css index b363201d..277bdc13 100644 --- a/assets/css/um-responsive.css +++ b/assets/css/um-responsive.css @@ -102,6 +102,12 @@ div.uimob340 .um-profile-photo { left: 0; } +div.uimob340 .um-header.no-cover .um-profile-photo { + position: static; + top: auto; + left: auto; +} + div.uimob340 .um-profile-photo a.um-profile-photo-img { width: 100px !important; height: 100px !important; @@ -113,13 +119,20 @@ div.uimob340 .um-profile-photo a.um-profile-photo-img { left: auto !important; } +div.uimob340 .um-header.no-cover .um-profile-photo a.um-profile-photo-img { + width: 120px !important; + height: 120px !important; +} + div.uimob340 .um-header .um-profile-meta { padding-left: 0 !important; padding-right: 0 !important; text-align: center !important; - padding-top: 70px !important; + padding-top: 60px !important; } +div.uimob340 .um-header.no-cover .um-profile-meta {padding-top: 0 !important} + div.uimob340 .um-header .um-name { float: none !important; margin-right: 0 !important; @@ -280,6 +293,12 @@ div.uimob500 .um-profile-photo { left: 0; } +div.uimob500 .um-header.no-cover .um-profile-photo { + position: static; + top: auto; + left: auto; +} + div.uimob500 .um-profile-photo a.um-profile-photo-img { width: 100px !important; height: 100px !important; @@ -291,13 +310,20 @@ div.uimob500 .um-profile-photo a.um-profile-photo-img { left: auto !important; } +div.uimob500 .um-header.no-cover .um-profile-photo a.um-profile-photo-img { + width: 120px !important; + height: 120px !important; +} + div.uimob500 .um-header .um-profile-meta { padding-left: 0 !important; padding-right: 0 !important; text-align: center !important; - padding-top: 70px !important; + padding-top: 60px !important; } +div.uimob500 .um-header.no-cover .um-profile-meta {padding-top: 0 !important} + div.uimob500 .um-header .um-name { float: none !important; margin-right: 0 !important; @@ -445,6 +471,10 @@ div.uimob800 .um-profile-photo a.um-profile-photo-img { top: -70px !important; } +div.uimob800 .um-header.no-cover .um-profile-photo a.um-profile-photo-img { + top: auto !important; +} + div.uimob800 .um-header .um-profile-meta { padding-left: 200px; } diff --git a/assets/css/um-select.css b/assets/css/um-select.css index 707c31e3..2c9b2b34 100644 --- a/assets/css/um-select.css +++ b/assets/css/um-select.css @@ -536,6 +536,7 @@ html[dir="rtl"] .select2-container-multi .select2-choices .select2-search-choice text-decoration: none !important; width: 21px !important; text-align: center !important; + border-bottom: 0 !important; } .select2-container-multi .select2-search-choice-close:before { diff --git a/assets/css/um-styles.css b/assets/css/um-styles.css index 53b0068f..629abcc7 100644 --- a/assets/css/um-styles.css +++ b/assets/css/um-styles.css @@ -25,6 +25,21 @@ box-sizing: content-box; } +.um-header a, +.um-cover a, +.um-member-photo a, +.um-member-name a, +.um-member-more a, +.um-member-less a, +.um-members a, +.um-account-side li a, +.um-members-pagi span, +.um-members-pagi a, +.um-field-value a +{ + border-bottom: 0 !important; +} + .um a:focus, .um-modal a:focus { outline: 0 !important; @@ -238,12 +253,19 @@ p.um-notice.err { .um-field-label { display: block; margin: 0 0 8px 0; - font-weight: bold; - font-weight: 500; } + .um-field-label .um-field-label-icon { float: left; margin: 0 8px 0 0; vertical-align: middle !important; height: 22px; } .um-field-label .um-field-label-icon i { font-size: 22px; height: 22px; line-height: 22px; vertical-align: middle; } -.um-field-label label { display: inline-block; height: 22px; font-size: 16px; line-height: 22px !important; } + +.um-field-label label { + display: inline-block; + height: 22px; + font-size: 15px; + line-height: 22px !important; + font-weight: bold; + font-weight: 600; +} .um-field-area { position: relative; @@ -276,6 +298,7 @@ p.um-notice.err { left: 0; width: 44px; font-size: 22px; + line-height: 1.7em; } .um-form input[type=text], @@ -291,6 +314,7 @@ p.um-notice.err { box-sizing: border-box; box-shadow: none !important; margin: 0; + position: static; } .um-form input[type=text]:focus , @@ -317,6 +341,7 @@ p.um-notice.err { border-radius: 2px; box-sizing: border-box; min-height: 80px; + box-shadow: none; } /* @@ -441,6 +466,9 @@ input[type=submit].um-button:focus { height: auto !important; font-size: 15px; cursor: pointer !important; + width: 100%; + box-shadow: none; + text-shadow: none; } .um-button { @@ -493,7 +521,7 @@ a.um-link-alt:hover {text-decoration: underline !important;} height: auto; background: #fff; border-radius: 5px; - z-index: 555555; + z-index: 1; display: none; border: 1px solid #e5e5e5; box-sizing: border-box; diff --git a/assets/dynamic_css/dynamic_global.php b/assets/dynamic_css/dynamic_global.php index 8792485b..3c9b3960 100644 --- a/assets/dynamic_css/dynamic_global.php +++ b/assets/dynamic_css/dynamic_global.php @@ -118,8 +118,11 @@ print " .select2-drop-active, .select2-drop.select2-drop-above { - border: $form_border; + border: $form_border !important; } + +.um-$form_id.um .um-form .select2-container-multi .select2-choices .select2-search-field input[type=text] {border: none !important} + "; } diff --git a/assets/dynamic_css/dynamic_profile.php b/assets/dynamic_css/dynamic_profile.php index bae20dde..da17cca0 100644 --- a/assets/dynamic_css/dynamic_profile.php +++ b/assets/dynamic_css/dynamic_profile.php @@ -36,7 +36,6 @@ print " "; print " -.um-$form_id.um .um-header.no-cover a.um-profile-photo-img img, .um-$form_id.um .um-profile-photo a.um-profile-photo-img { width: ".$photosize."px; height: ".$photosize."px; diff --git a/core/um-account.php b/core/um-account.php index 35b9dab7..faca33f3 100644 --- a/core/um-account.php +++ b/core/um-account.php @@ -116,7 +116,7 @@ class UM_Account { switch( $id ) { case 'privacy' : - $args = 'profile_privacy,show_in_members'; + $args = 'profile_privacy,hide_in_members'; break; case 'delete' : $args = 'single_user_password'; diff --git a/core/um-actions-account.php b/core/um-actions-account.php index 6d01139e..a08c2246 100644 --- a/core/um-actions-account.php +++ b/core/um-actions-account.php @@ -16,6 +16,11 @@ $changes[ $k ] = $v; } } + + if ( isset( $changes['hide_in_members'] ) && $changes['hide_in_members'] == 'No' ){ + delete_user_meta( um_user('ID'), 'hide_in_members' ); + unset( $changes['hide_in_members'] ); + } $ultimatemember->user->update_profile( $changes ); diff --git a/core/um-actions-ajax.php b/core/um-actions-ajax.php index d3594827..e0f7ab2d 100644 --- a/core/um-actions-ajax.php +++ b/core/um-actions-ajax.php @@ -27,7 +27,7 @@ global $ultimatemember; extract($_REQUEST); - if ( !um_can_edit_profile( $user_id ) ) die( __('You can not edit this user') ); + if ( !um_current_user_can('edit', $user_id ) ) die( __('You can not edit this user') ); $ultimatemember->files->delete_core_user_photo( $user_id, 'profile_photo' ); @@ -42,7 +42,7 @@ global $ultimatemember; extract($_REQUEST); - if ( !um_can_edit_profile( $user_id ) ) die( __('You can not edit this user') ); + if ( !um_current_user_can('edit', $user_id ) ) die( __('You can not edit this user') ); $ultimatemember->files->delete_core_user_photo( $user_id, 'cover_photo' ); diff --git a/core/um-actions-core.php b/core/um-actions-core.php index ce8f3f0c..f24b15d0 100644 --- a/core/um-actions-core.php +++ b/core/um-actions-core.php @@ -8,20 +8,16 @@ global $ultimatemember; if ( is_admin() ) return false; - if ( !isset( $_REQUEST['um_action'] ) ) return false; - if ( isset( $_REQUEST['uid'] ) && !$ultimatemember->user->user_exists_by_id( $_REQUEST['uid'] ) ) return false; if ( isset( $_REQUEST['uid'] ) ) { - if ( is_super_admin( $_REQUEST['uid'] ) ) wp_die('Super administrators can not be modified.'); - - if ( !current_user_can('edit_users') ){ - wp_die('You do not have permissions to do this.'); - } - + } + + if ( isset($_REQUEST['uid'])){ + $uid = $_REQUEST['uid']; } switch( $_REQUEST['um_action'] ) { @@ -35,44 +31,44 @@ break; case 'um_reject_membership': - um_fetch_user( $_REQUEST['uid'] ); + um_fetch_user( $uid ); $ultimatemember->user->reject(); exit( wp_redirect( $ultimatemember->permalinks->get_current_url( true ) ) ); break; case 'um_approve_membership': case 'um_reenable': - um_fetch_user( $_REQUEST['uid'] ); + um_fetch_user( $uid ); $ultimatemember->user->approve(); exit( wp_redirect( $ultimatemember->permalinks->get_current_url( true ) ) ); break; case 'um_put_as_pending': - um_fetch_user( $_REQUEST['uid'] ); + um_fetch_user( $uid ); $ultimatemember->user->pending(); exit( wp_redirect( $ultimatemember->permalinks->get_current_url( true ) ) ); break; case 'um_resend_activation': - um_fetch_user( $_REQUEST['uid'] ); + um_fetch_user( $uid ); $ultimatemember->user->email_pending(); exit( wp_redirect( $ultimatemember->permalinks->get_current_url( true ) ) ); break; case 'um_deactivate': - um_fetch_user( $_REQUEST['uid'] ); + um_fetch_user( $uid ); $ultimatemember->user->deactivate(); exit( wp_redirect( $ultimatemember->permalinks->get_current_url( true ) ) ); break; case 'um_delete': - um_fetch_user( $_REQUEST['uid'] ); + if ( !um_current_user_can( 'delete', $uid ) ) wp_die( __('You do not have permission to delete this user.','ultimatemember') ); + um_fetch_user( $uid ); $ultimatemember->user->delete(); exit( wp_redirect( $ultimatemember->permalinks->get_current_url( true ) ) ); break; } - } /*** diff --git a/core/um-actions-global.php b/core/um-actions-global.php index 61eed040..2add35f2 100644 --- a/core/um-actions-global.php +++ b/core/um-actions-global.php @@ -43,18 +43,6 @@ -

+
@@ -126,7 +126,7 @@
-
+
diff --git a/core/um-actions-profile.php b/core/um-actions-profile.php index 1af05d81..1fce98b6 100644 --- a/core/um-actions-profile.php +++ b/core/um-actions-profile.php @@ -241,7 +241,7 @@ if ( um_get_requested_user() ) { if ( !um_can_view_profile( um_get_requested_user() ) ) um_redirect_home(); - if ( !um_can_edit_profile( um_get_requested_user() ) ) $ultimatemember->user->cannot_edit = 1; + if ( !um_current_user_can('edit', um_get_requested_user() ) ) $ultimatemember->user->cannot_edit = 1; um_fetch_user( um_get_requested_user() ); } else { if ( !is_user_logged_in() ) um_redirect_home(); @@ -254,7 +254,7 @@ $ultimatemember->fields->editing = 1; if ( um_get_requested_user() ) { - if ( !um_can_edit_profile( um_get_requested_user() ) ) um_redirect_home(); + if ( !um_current_user_can('edit', um_get_requested_user() ) ) um_redirect_home(); um_fetch_user( um_get_requested_user() ); } @@ -304,6 +304,7 @@ $actions = $ultimatemember->user->get_admin_actions(); + unset( $items['myaccount'] ); unset( $items['cancel'] ); $items = array_merge( $items, $actions ); $items['cancel'] = $cancel; @@ -339,7 +340,7 @@ $files = null; if ( isset( $args['user_id'] ) ) { - if ( um_can_edit_profile( $args['user_id'] ) ) { + if ( um_current_user_can('edit', $args['user_id'] ) ) { $ultimatemember->user->set( $args['user_id'] ); } else { wp_die( __('You are not allowed to edit this user.','ultimatemember') ); diff --git a/core/um-actions-register.php b/core/um-actions-register.php index 1d0b38fb..16aa150b 100644 --- a/core/um-actions-register.php +++ b/core/um-actions-register.php @@ -128,6 +128,8 @@ if ( !is_admin() ) { + do_action("track_{$status}_user_registration"); + if ( $status == 'approved' ) { $ultimatemember->user->auto_login($user_id); @@ -149,9 +151,7 @@ } } - - do_action("track_{$status}_user_registration"); - + } } diff --git a/core/um-builtin.php b/core/um-builtin.php index ecae406a..b37e06e9 100644 --- a/core/um-builtin.php +++ b/core/um-builtin.php @@ -799,17 +799,17 @@ class UM_Builtin { 'required_perm' => 'can_make_private_profile', ), - 'show_in_members' => array( - 'title' => __('Show me in the Directory','ultimatemember'), - 'metakey' => 'show_in_members', + 'hide_in_members' => array( + 'title' => __('Hide my profile from directory','ultimatemember'), + 'metakey' => 'hide_in_members', 'type' => 'radio', - 'label' => __('Show me in the Directory','ultimatemember'), - 'help' => __('Choose whether you want to appear in public member directories or not','ultimatemember'), + 'label' => __('Hide my profile from directory','ultimatemember'), + 'help' => __('Here you can hide yourself from appearing in public directory','ultimatemember'), 'required' => 0, 'public' => 1, 'editable' => 1, - 'default' => 'Yes', - 'options' => array('Yes','No'), + 'default' => 'No', + 'options' => array('No','Yes'), 'account_only' => true, 'required_opt' => array( 'members_page', 1 ), ), diff --git a/core/um-filters-members.php b/core/um-filters-members.php index b9fd90d7..dd7505cc 100644 --- a/core/um-filters-members.php +++ b/core/um-filters-members.php @@ -5,22 +5,30 @@ ***/ add_filter('um_prepare_user_query_args', 'um_prepare_user_query_args', 10, 2); add_filter('um_prepare_user_query_args', 'um_add_search_to_query', 50, 2); - add_filter('um_prepare_user_query_args', 'um_remove_unwanted_users_from_list', 99, 2); + add_filter('um_prepare_user_query_args', 'um_remove_special_users_from_list', 99, 2); /*** *** @Remove users we do not need to show in directory ***/ - function um_remove_unwanted_users_from_list( $query_args, $args ) { + function um_remove_special_users_from_list( $query_args, $args ) { global $ultimatemember; extract( $args ); - if ( !current_user_can('manage_options') ) + if ( !current_user_can('manage_options') ) { $query_args['meta_query'][] = array( 'key' => 'account_status', 'value' => 'approved', 'compare' => '=' ); + + } + + $query_args['meta_query'][] = array( + 'key' => 'hide_in_members', + 'value' => '', + 'compare' => 'NOT EXISTS' + ); return $query_args; } diff --git a/core/um-filters-user.php b/core/um-filters-user.php index b2419790..733b58af 100644 --- a/core/um-filters-user.php +++ b/core/um-filters-user.php @@ -54,9 +54,13 @@ $actions['um_reenable'] = array( 'label' => __('Reactivate this account') ); } - $actions['um_delete'] = array( 'label' => __('Delete this user') ); + if ( um_current_user_can( 'delete', um_profile_id() ) ) { + $actions['um_delete'] = array( 'label' => __('Delete this user') ); + } } + um_fetch_user( um_profile_id() ); + return $actions; } \ No newline at end of file diff --git a/core/um-setup.php b/core/um-setup.php index fb79f04b..778cccc0 100644 --- a/core/um-setup.php +++ b/core/um-setup.php @@ -40,8 +40,6 @@ class UM_Setup { '_um_show_tagline' => 0, '_um_search' => 0, '_um_userinfo_animate' => '1', - '_um_directory_header' => __('{total_users} Members','ultimatemember'), - '_um_directory_no_users' => __('Sorry, we cannot find any users who match your search criteria.','ultimatemember'), '_um_sortby' => 'user_registered_desc', '_um_profile_photo' => '1', '_um_cover_photos' => '1', @@ -140,8 +138,6 @@ class UM_Setup { '_um_login_secondary_btn_hover' => '#e5e5e5', '_um_login_secondary_btn_text' => '#666', '_um_directory_template' => 'members', - '_um_directory_header' => __('{total_users} Members','ultimatemember'), - '_um_directory_no_users' => __('We are sorry. We cannot find any users who match your search criteria.','ultimatemember'), ); $this->core_form_meta_all = apply_filters('um_core_form_meta_all', $this->core_form_meta_all ); @@ -176,8 +172,6 @@ class UM_Setup { 'can_delete_everyone' => 1, 'can_delete_roles' => 1, 'can_edit_profile' => 1, - 'can_upload_pics' => 1, - 'can_upload_files' => 1, 'can_delete_profile' => 1, 'can_view_all' => 1, 'can_make_private_profile' => 1, diff --git a/core/um-short-functions.php b/core/um-short-functions.php index 2f93e893..263cd169 100644 --- a/core/um-short-functions.php +++ b/core/um-short-functions.php @@ -244,15 +244,6 @@ $ultimatemember->user->reset(); } - /*** - *** @boolean if viewing his own profile - ***/ - function um_is_my_profile() { - if ( !is_user_logged_in() ) return false; - if ( um_is_core_page('user') && get_current_user_id() == um_get_requested_user() ) return true; - return false; - } - /*** *** @gets the queried user ***/ @@ -353,19 +344,6 @@ } - /*** - *** @Tests for current user - ***/ - function um_user_can( $permission ) { - global $ultimatemember; - $user_id = get_current_user_id(); - $role = get_user_meta( $user_id, 'role', true ); - $permissions = $ultimatemember->query->role_data( $role ); - if ( $permissions[ $permission ] == 1 ) - return true; - return false; - } - /*** *** @boolean check for not same user ***/ @@ -395,23 +373,54 @@ } /*** - *** @checks if user can edit profile + *** @User can (role settings ) ***/ - function um_can_edit_profile( $user_id ){ + function um_user_can( $permission ) { + global $ultimatemember; + $user_id = get_current_user_id(); + $role = get_user_meta( $user_id, 'role', true ); + $permissions = $ultimatemember->query->role_data( $role ); + if ( $permissions[ $permission ] == 1 ) + return true; + return false; + } + + /*** + *** @Check if user is in his profile + ***/ + function um_is_myprofile(){ + global $ultimatemember; + if ( get_current_user_id() && get_current_user_id() == um_get_requested_user() )return true; + if ( !um_get_requested_user() && um_is_core_page('user') && get_current_user_id() ) return true; + return false; + } + + /*** + *** @Current user can + ***/ + function um_current_user_can( $cap, $user_id ){ global $ultimatemember; if ( !is_user_logged_in() ) return false; + um_fetch_user( get_current_user_id() ); - if ( um_user('can_edit_everyone') ) return true; - - if ( get_current_user_id() == $user_id && um_user('can_edit_profile') ) return true; - - if ( get_current_user_id() == $user_id && !um_user('can_edit_profile') ) return false; - - if ( !um_user('can_edit_everyone') ) return false; + switch($cap) { + case 'edit': + if ( get_current_user_id() == $user_id && um_user('can_edit_profile') ) return true; + if ( !um_user('can_edit_everyone') ) return false; + if ( get_current_user_id() == $user_id && !um_user('can_edit_profile') ) return false; + if ( um_user('can_edit_roles') && !in_array( $ultimatemember->query->get_role_by_userid( $user_id ), um_user('can_edit_roles') ) ) return false; + break; + + case 'delete': + if ( !um_user('can_delete_everyone') ) return false; + if ( um_user('can_delete_roles') && !in_array( $ultimatemember->query->get_role_by_userid( $user_id ), um_user('can_delete_roles') ) ) return false; + break; + + } + return true; - } /*** @@ -419,25 +428,9 @@ ***/ function um_can_edit_my_profile(){ global $ultimatemember; - if ( !is_user_logged_in() ) return false; if ( !um_user('can_edit_profile') ) return false; - return true; - - } - - /*** - *** @quick test if the user's is on his profile - ***/ - function um_is_myprofile(){ - global $ultimatemember; - - if ( get_current_user_id() && get_current_user_id() == um_get_requested_user() )return true; - - if ( !um_get_requested_user() && um_is_core_page('user') && get_current_user_id() ) return true; - - return false; } /*** diff --git a/core/um-taxonomies.php b/core/um-taxonomies.php index 1d5342dd..59d1187e 100644 --- a/core/um-taxonomies.php +++ b/core/um-taxonomies.php @@ -33,14 +33,14 @@ class UM_Taxonomies { register_post_type( 'um_role', array( 'labels' => array( - 'name' => __( 'Member Levels' ), - 'singular_name' => __( 'Member Level' ), + 'name' => __( 'User Roles' ), + 'singular_name' => __( 'User Role' ), 'add_new' => __( 'Add New' ), - 'add_new_item' => __('Add New Member Level' ), - 'edit_item' => __('Edit Member Level'), - 'not_found' => __('You did not create any member levels yet'), + 'add_new_item' => __('Add New User Role' ), + 'edit_item' => __('Edit User Role'), + 'not_found' => __('You did not create any user roles yet'), 'not_found_in_trash' => __('Nothing found in Trash'), - 'search_items' => __('Search Member Levels') + 'search_items' => __('Search User Roles') ), 'show_ui' => true, 'show_in_menu' => false, @@ -49,6 +49,8 @@ class UM_Taxonomies { ) ); + if ( um_get_option('members_page') ){ + register_post_type( 'um_directory', array( 'labels' => array( 'name' => __( 'Member Directories' ), @@ -67,6 +69,8 @@ class UM_Taxonomies { ) ); + } + } } \ No newline at end of file diff --git a/um-config.php b/um-config.php index 0d3d7ddf..3594fa51 100644 --- a/um-config.php +++ b/um-config.php @@ -2,16 +2,17 @@ global $ultimatemember; + /*** *** @ ***/ $this->sections[] = array( - 'icon' => 'um-icon-user-add-1', - 'title' => __( 'Registration'), + 'icon' => 'um-icon-user-1', + 'title' => __( 'Users'), 'fields' => array( - + array( 'id' => 'default_role', 'type' => 'select', @@ -22,20 +23,6 @@ $this->sections[] = array( 'options' => $ultimatemember->query->get_roles( ), 'placeholder' => __('Choose user role...'), ), - - ) - -); - -/*** -*** @ -***/ - -$this->sections[] = array( - - 'icon' => 'um-icon-user-1', - 'title' => __( 'User Profile'), - 'fields' => array( array( 'id' => 'permalink_base', @@ -81,6 +68,16 @@ $this->sections[] = array( 'required' => array( 'display_name', '=', 'field' ), ), + array( + 'id' => 'members_page', + 'type' => 'switch', + 'title' => __( 'Members Directory' ), + 'default' => 1, + 'desc' => 'Control whether to enable or disable member directories on this site', + 'on' => __('Enable'), + 'off' => __('Disable'), + ), + ) ); @@ -153,54 +150,14 @@ $this->sections[] = array( ); -/*** -*** @ -***/ - -$this->sections[] = array( - - 'icon' => 'um-icon-group', - 'title' => __( 'Members Directory'), - 'fields' => array( - - array( - 'id' => 'members_page', - 'type' => 'switch', - 'title' => __( 'Members page status' ), - 'default' => 1, - 'desc' => 'Control whether to enable or disable the core Members directory page', - ), - - array( - 'id' => 'directory_header', - 'type' => 'text', - 'title' => __( 'General Results Text' ), - 'default' => um_get_metadefault('directory_header'), - 'desc' => __('Customize the search result text . e.g. Found 3,000 Members. Leave this blank to not show result text','ultimatemember'), - 'required' => array( 'members_page', '=', '1' ), - ), - - array( - 'id' => 'directory_no_users', - 'type' => 'text', - 'title' => __( 'Custom text If no users were found' ), - 'default' => um_get_metadefault('directory_no_users'), - 'desc' => __('This is the text that is displayed if no users are found during a search','ultimatemember'), - 'required' => array( 'members_page', '=', '1' ), - ), - - ) - -); - /*** *** @ ***/ $this->sections[] = array( - 'icon' => 'um-icon-lock-3', - 'title' => __( 'Site Access'), + 'icon' => 'um-icon-key-3', + 'title' => __( 'Access'), 'fields' => array( array( @@ -233,21 +190,7 @@ $this->sections[] = array( 'add_text' => __('Add New URL'), 'required' => array( 'accessible', '=', 2 ), ), - - ) - -); - -/*** -*** @ -***/ - -$this->sections[] = array( - - 'icon' => 'um-icon-wordpress-alt', - 'title' => __( 'Backend'), - 'fields' => array( - + array( 'id' => 'panic_key', 'type' => 'text', @@ -320,21 +263,7 @@ $this->sections[] = array( 'desc' => 'Enter an alternate url here to redirect a user If they try to access the backend register screen', 'required' => array( 'wpadmin_register_redirect', '=', 'custom_url' ), ), - - ) - -); - -/*** -*** @ -***/ - -$this->sections[] = array( - - 'icon' => 'um-icon-denied-block', - 'title' => __( 'Restrictions'), - 'fields' => array( - + array( 'id' => 'blocked_ips', 'type' => 'textarea', @@ -371,7 +300,7 @@ $this->sections[] = array( $this->sections[] = array( 'icon' => 'um-icon-envelope-2', - 'title' => __( 'Email Templates'), + 'title' => __( 'Emails'), 'fields' => array( array( @@ -662,7 +591,7 @@ $this->sections[] = array( $this->sections[] = array( 'icon' => 'um-icon-bell-1', - 'title' => __( 'Admin Notifications' ), + 'title' => __( 'Notifications' ), 'fields' => array( array( @@ -775,7 +704,7 @@ $this->sections[] = array( $this->sections[] = array( 'icon' => 'um-icon-photo-2', - 'title' => __( 'Image & File Uploads'), + 'title' => __( 'Uploads'), 'fields' => array( array( @@ -867,7 +796,7 @@ $this->sections[] = array( $this->sections[] = array( 'icon' => 'um-icon-brush-1', - 'title' => __( 'Styling & Appearance'), + 'title' => __( 'Appearance'), 'fields' => array( ) @@ -880,6 +809,17 @@ $this->sections[] = array( 'title' => __( 'General'), 'fields' => array( + array( + 'id' => 'directory_template', + 'type' => 'select', + 'select2' => array( 'allowClear' => 0, 'minimumResultsForSearch' => -1 ), + 'title' => __( 'Members Default Template' ), + 'desc' => __( 'This will be the default template to output member directory' ), + 'default' => um_get_metadefault('directory_template'), + 'options' => $ultimatemember->shortcodes->get_templates( 'members' ), + 'required' => array( 'xxxxxxxxxxxxx', '=', 'sssssssssssssssss' ), + ), + array( 'id' => 'active_color', 'type' => 'color', @@ -900,18 +840,6 @@ $this->sections[] = array( 'transparent' => false, ), - array( - 'id' => 'default_avatar', - 'type' => 'media', - 'width' => '150', - 'height' => '150', - 'title' => __('Default Profile Picture', 'ultimatemember'), - 'desc' => __('You can change the default profile picture globally here. Please make sure that the photo is 300x300px.', 'ultimatemember'), - 'default' => array( - 'url' => um_url . 'assets/img/default_avatar.jpg', - ), - ), - array( 'id' => 'primary_btn_color', 'type' => 'color', @@ -1147,6 +1075,18 @@ $this->sections[] = array( 'transparent' => false, ), + array( + 'id' => 'default_avatar', + 'type' => 'media', + 'width' => '150', + 'height' => '150', + 'title' => __('Default Profile Photo', 'ultimatemember'), + 'desc' => __('You can change the default profile picture globally here. Please make sure that the photo is 300x300px.', 'ultimatemember'), + 'default' => array( + 'url' => um_url . 'assets/img/default_avatar.jpg', + ), + ), + array( 'id' => 'profile_photosize', 'type' => 'text', @@ -1438,61 +1378,25 @@ $this->sections[] = array( ); -$this->sections[] = array( - - 'subsection' => true, - 'title' => __( 'Member Directory'), - 'fields' => array( - - array( - 'id' => 'directory_template', - 'type' => 'select', - 'select2' => array( 'allowClear' => 0, 'minimumResultsForSearch' => -1 ), - 'title' => __( 'Members Default Template' ), - 'desc' => __( 'This will be the default template to output member directory' ), - 'default' => um_get_metadefault('directory_template'), - 'options' => $ultimatemember->shortcodes->get_templates( 'members' ), - ), - - ) - -); - /*** *** @ ***/ $this->sections[] = array( - 'icon' => 'um-icon-tools', + 'icon' => 'um-icon-cog-2', 'title' => __( 'Advanced'), 'fields' => array( - + array( 'id' => 'allow_tracking', 'type' => 'switch', - 'title' => __( 'Allow anonymous tracking' ), + 'title' => __( 'Allow Tracking' ), 'default' => 0, 'desc' => 'Help us improve Ultimate Member’s compatibility with other plugins and themes by allowing us to track non-sensitive data on your site. Click here to see what data we track.', 'on' => 'Allow tracking', 'off' => 'Do not allow', ), - - array( - 'id' => 'admin_load_time', - 'type' => 'switch', - 'title' => __( 'Show load time in admin footer' ), - 'default' => 0, - 'desc' => __('Display the number of queries and load time in backend','ultimatemember'), - ), - - array( - 'id' => 'load_time', - 'type' => 'switch', - 'title' => __( 'Show load time in frontend' ), - 'default' => 0, - 'desc' => __('Display the number of queries and load time in frontend','ultimatemember'), - ), )