Merge pull request #1327 from ultimatemember/development/2.7.x

Version 2.8.0
This commit is contained in:
Mykyta Synelnikov
2023-12-08 01:25:01 +02:00
committed by GitHub
360 changed files with 13109 additions and 14331 deletions
@@ -1,390 +0,0 @@
@-webkit-keyframes um-ajax-spinning {
0% {
-webkit-transform: rotate(0deg);
transform: rotate(0deg); }
100% {
-webkit-transform: rotate(360deg);
transform: rotate(360deg); } }
@-moz-keyframes um-ajax-spinning {
0% {
-webkit-transform: rotate(0deg);
transform: rotate(0deg); }
100% {
-webkit-transform: rotate(360deg);
transform: rotate(360deg); } }
@-ms-keyframes um-ajax-spinning {
0% {
-webkit-transform: rotate(0deg);
transform: rotate(0deg); }
100% {
-webkit-transform: rotate(360deg);
transform: rotate(360deg); } }
@keyframes um-ajax-spinning {
0% {
-webkit-transform: rotate(0deg);
transform: rotate(0deg); }
100% {
-webkit-transform: rotate(360deg);
transform: rotate(360deg); } }
/*
- General
*/
.um-admin-builder * {
-webkit-font-smoothing: antialiased !important;
-moz-osx-font-smoothing: grayscale;
}
.um-admin-builder i {
font-size: 15px !important;
height: 100% !important;
line-height: 100% !important;
margin: 0 5px 0 0 !important;
}
.um-admin-builder .um-admin-drag {margin-top: 40px}
/*
- Add field
*/
.um-admin-drag-add-field {
display: block;
width: 100%;
height: 30px;
line-height: 30px;
text-align: center;
color: #aaa;
text-decoration: none;
}
.um-admin-drag-add-field:hover {color: #0085ba}
.um-admin-drag-add-field i {
font-size: 23px !important;
margin: 0 !important;
}
/*
- Drag controls
*/
.um-admin-drag-ctrls-demo.um-admin-drag-ctrls {
position: absolute;
right: 7px;
top: -30px;
left: auto;
}
.um-admin-drag-ctrls {
position: absolute;
top: -30px;
left: 0;
}
.um-admin-drag-ctrls a {
float: left;
margin: 0 5px 0 0;
height: 30px;
line-height: 30px;
background: #eee;
color: #888;
padding: 0 8px;
text-decoration: none;
border-radius: 2px 2px 0 0;
}
.um-admin-drag-ctrls a:hover {background-color: #e5e5e5}
.um-admin-drag-ctrls a.active,
.um-admin-drag-ctrls a.active:hover {
/*background-color: #3ba1da;*/
background-color: #0085ba;
color: #fff;
}
.um-admin-drag-ctrls.columns a {width: 30px !important;background-image: url(../img/1-column.gif); background-repeat: no-repeat; background-position: center;}
.um-admin-drag-ctrls.columns a:nth-child(2) {background-image: url(../img/2-columns.gif);}
.um-admin-drag-ctrls.columns a:last-child {background-image: url(../img/3-columns.gif);}
.um-admin-drag-ctrls.columns a.active {background-image: url(../img/1-column-active.gif)}
.um-admin-drag-ctrls.columns a.active:nth-child(2) {background-image: url(../img/2-columns-active.gif);}
.um-admin-drag-ctrls.columns a.active:last-child {background-image: url(../img/3-columns-active.gif);}
/*
- Drag Area
*/
.um-admin-drag {
width: 100%;
background: #f1f1f1;
box-sizing: border-box;
position: relative;
padding: 60px 20px 20px 20px;
}
.um-admin-drag-row {
width: 100%;
background: #fefefe;
box-sizing: border-box;
position: relative;
padding: 60px 20px 20px 20px;
margin: 0 0 60px 0;
position: relative;
}
.um-admin-drag-row:last-child {margin-bottom: 0}
.um-admin-drag-row-icons {
position: absolute;
right: 0;
top: -30px;
height: 30px;
}
.um-admin-drag-rowsub {
position: relative;
box-sizing: border-box;
background: #f1f1f1;
padding: 20px;
margin: 0 0 60px 0;
}
.um-admin-drag-rowsub:last-child {margin-bottom: 0}
.um-admin-drag-rowsub-icons {
position: absolute;
right: 0;
top: -30px;
height: 30px;
}
.um-admin-drag-col {
float: left;
width: 100%;
background: #fff;
border: 1px dashed #bbb;
box-sizing: border-box;
padding: 20px;
}
.um-admin-drag-col.cols-3 {width: 32%;}
.um-admin-drag-col.cols-3.cols-last {width: 32%;}
.um-admin-drag-col.cols-3.cols-middle {width: 32%;margin: 0 2%;}
.um-admin-drag-col.cols-1 {width: 100%;}
.um-admin-drag-col.cols-1.cols-last {width: 100%;}
.um-admin-drag-col.cols-1.cols-middle {}
.um-admin-drag-col.cols-2 {width: 49%;margin: 0 1% 0 0}
.um-admin-drag-col.cols-2.cols-last {width: 49%;margin: 0 0 0 1%;}
.um-admin-drag-col.cols-2.cols-middle {}
.um-admin-drag-addrow {
text-align: center;
font-size: 14px;
color: #888;
cursor: pointer;
border: 1px dashed #bbb;
padding: 10px 0;
margin: 20px 0 0 0;
}
.um-admin-drag-addrow i {
font-size: 23px !important;
margin: 0 !important;
}
.um-admin-drag-addrow:hover {color: #0085ba}
/*
- Fields
*/
.um-admin-drag-fld {
display: block;
position: relative;
border: 1px solid #dddddd;
margin: 0 0 15px 0;
background: #F5F5F5;
cursor: move !important;
}
.um-admin-drag-fld-title i {
width: 24px;
display: inline-block;
text-align: center;
}
.um-admin-drag-fld.um-field-type-group {background: #555;border: 0}
.um-admin-drag-fld-title.um-field-type-group,.um-admin-drag-fld-type.um-field-type-group {color: #fff}
.um-admin-drag-group {background: #FCFCFC;cursor: default;padding: 20px;border: 1px dashed #bbb;}
.um-admin-drag-col.cols-3 .um-admin-drag-fld-icons.um-field-type-group{float: left;position: relative;bottom: auto;right: auto;height: 30px;display: block;}
.um-admin-drag-fld-icons.um-field-type-group a.um_admin_duplicate_field {display: none !important}
.um-admin-drag-fld-title,
.um-admin-drag-fld-type {
float: left;
font-weight: bold;
font-size: 13px;
color: #666;
height: 30px;
line-height: 30px;
margin: 0 0 0 20px;
}
.um-admin-drag-fld-type {
font-weight: 400;
color: #999;
}
.um-admin-drag-fld-icons {
float: right;
}
/*
- Responsive cols appearance
*/
.um-admin-drag-col.cols-3 .um-admin-drag-fld-title,
.um-admin-drag-col.cols-3 .um-admin-drag-fld-type {
height: auto;
line-height: 18px;
margin: 10px;
margin-bottom: 0;
}
.um-admin-drag-col.cols-3 .um-admin-drag-fld-type {
margin: 10px;
}
.um-admin-drag-col.cols-3 .um-admin-drag-fld-icons {
float: none;
position: absolute;
bottom: 0;
right: 0;
height: 30px;
display: none;
}
.um-admin-drag-col.cols-3 .um-admin-drag-fld:hover .um-admin-drag-fld-icons{display: block;}
/*
- Icons
*/
.um-admin-drag-row-icons a,
.um-admin-drag-row-icons span,
.um-admin-drag-rowsub-icons a,
.um-admin-drag-rowsub-icons span,
.um-admin-drag-fld-icons a{
text-decoration: none;
color: #fff;
width: 40px;
height: 30px;
line-height: 30px;
text-align: center;
display: block !important;
float: left;
/*background: #44b0ec;*/
background: #0085ba;
padding: 0 4px;
transition: all .2s linear;
border-left: 1px solid #379dd5;
}
.um-admin-drag-row-icons span,
.um-admin-drag-rowsub-icons span
{cursor: move!important}
.um-admin-drag-row-icons a:hover,
.um-admin-drag-row-icons span:hover,
.um-admin-drag-rowsub-icons a:hover,
.um-admin-drag-rowsub-icons span:hover,
.um-admin-drag-fld-icons a:hover {background: #008ec2;/*background: #3396cd;*/}
.um-admin-drag-row-icons i,
.um-admin-drag-rowsub-icons i,
.um-admin-drag-fld-icons i{
font-size: 18px !important;
margin: 0 !important;
top: 2px;
position: relative;
}
.um-admin-row-loading {
position: absolute;
width: 100%;
height: calc( 100% + 30px );
top: -30px;
left: 0;
background: rgba(241, 241, 241, 0.6);
z-index: 999;
display: none;
}
.um-admin-row-loading > span {
display: block;
-webkit-transition: 0.1s opacity;
-moz-transition: 0.1s opacity;
-ms-transition: 0.1s opacity;
-o-transition: 0.1s opacity;
transition: 0.1s opacity;
color: #c6c6c6 !important;
-webkit-animation: um-ajax-spinning 1.1s infinite linear;
animation: um-ajax-spinning 1.1s infinite linear;
border-top: 0.2em solid rgba(0, 0, 0, 1);
border-right: 0.2em solid rgba(0, 0, 0, 1);
border-bottom: 0.2em solid rgba(0, 0, 0, 1);
border-left: 0.2em solid #c6c6c6;
font-size: 1.75em;
filter: alpha(opacity=0);
-ms-transform: translateZ(0);
transform: translateZ(0);
border-radius: 50%;
width: 40px;
height: 40px;
margin: -20px 0 0 -20px;
outline: 0;
padding: 0;
vertical-align: baseline;
position: absolute;
left: 50%;
top: 50%;
}
/*
- UI Placeholders
*/
.um-row-placeholder {
width: 100%;
border: 2px dashed #aaa;
box-sizing: border-box;
}
.um-rowsub-placeholder {
width: 100%;
border: 2px dashed #ccc;
box-sizing: border-box;
display: block;
}
.um-fld-placeholder {
display: block;
border: 1px dashed #dddddd;
background: #fff;
box-sizing: border-box;
width: 100%;
}
.um-admin-preview-overlay {
position: absolute;
top:0;
bottom: 0;
left: 0;
right: 0;
background-color: rgba(255,255,255,0);
z-index: 100;
}
#UM_preview_form .um-admin-modal-body {
position: relative;
}
@@ -1,69 +0,0 @@
.um-admin td, .um-admin th {
-webkit-font-smoothing: antialiased !important;
-moz-osx-font-smoothing: grayscale;
}
.um-admin.post-type-um_form .manage-column.column-id {width: 60px}
.um-admin.post-type-um_form .manage-column.column-mode {width: 100px}
.um-admin.post-type-um_form .manage-column.column-is_default {width: 60px}
.um-admin.post-type-um_form .manage-column.column-title {width: 200px}
.um-admin.post-type-um_form .manage-column.column-shortcode {width: 200px}
.um-admin.post-type-um_form .manage-column.column-impressions {width: 100px}
.um-admin.post-type-um_form .manage-column.column-conversions {width: 100px}
.um-admin.post-type-um_directory .manage-column.column-id {width: 60px}
.um-admin.post-type-um_directory .manage-column.column-title {width: 250px}
.um-admin.post-type-um_directory .manage-column.column-is_default {width: 60px}
.um-admin.post-type-um_role .manage-column.column-title {width: 200px}
.um-admin.post-type-um_role .manage-column.column-count {width: 150px}
.um-admin.post-type-um_role .manage-column.column-core {width: 150px}
.um-admin.post-type-um_form td.column-shortcode,
.um-admin.post-type-um_form td.column-id,
.um-admin.post-type-um_directory td.column-shortcode,
.um-admin.post-type-um_directory td.column-id,
.um-admin.post-type-um_role td.column-count
{font-size: 14px;}
.um-admin.users-php td.column-um_actions {padding-top: 12px}
.um-admin.users-php td.column-um_actions a.button {
height: 29px !important;
margin: 0 0 0 2px !important;
position: relative;
}
.um-admin-tag {
display: inline-block;
border-radius: 2px;
width: 100%;
box-sizing: border-box;
text-align: center;
background: #0085ba;
color: #fff;
font-size: 14px;
height: 34px;
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.approved {border-left: 2px solid #7ACF58}
.um-admin-tag.pending {border-left: 2px solid #C74A4A}
.um-admin-txtspace {margin: 0 0 0 10px;}
.um-adm-ico {
font-size: 18px;
width: 18px;
text-align: center;
display: inline-block;
color: #7ACF58;
}
.um-adm-ico.inactive {color: #C74A4A}
.um-adm-ico.pointer {cursor: pointer}
.um-admin-icontext i {
font-size: 18px;
margin: 0 5px 0 0;
}
@@ -1,295 +0,0 @@
#um-extensions-wrap #the-list {
margin: 0;
width: 100%;
display: grid;
grid-template-rows: auto 1fr;
grid-template-columns: repeat(3, 1fr);
grid-gap: 10px;
grid-auto-rows: minmax(max-content, auto);
-ms-grid-template-rows: auto 1fr;
-ms-grid-template-columns: repeat(3, 1fr);
-ms-grid-gap: 10px;
-ms-grid-auto-rows: minmax(max-content, auto);
align-items: center;
}
#um-extensions-wrap .plugin-card {
padding: 20px;
display: flex;
flex-direction: column;
flex-wrap: nowrap;
justify-content: flex-start;
align-items: stretch;
width: 100%;
margin: 0;
}
#um-extensions-wrap .plugin-image-wrapper {
color: #fff;
height: 70px;
width: 70px;
margin: 0 auto;
border-radius: 60px;
box-shadow: 0 2px 9px rgb(50 50 93 / 21%);
border: solid 4px #fff;
display: flex;
justify-content: center;
align-items: center;
overflow: hidden;
}
#um-extensions-wrap .plugin-image-wrapper a {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
background-color: #7856ff;
}
#um-extensions-wrap a.plugin-image.svg-image {
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
flex-wrap: nowrap;
}
#um_bbpress_image {
background-color: #fff !important;
filter: none !important;
width: 70px !important;
}
#um_mycred_image {
background-color: #fff;
}
#um_groups_image,
#um_profile-tabs_image,
#um_user-tags_image,
#um_friends_image,
#um_user-reviews_image,
#um_verified-users_image,
#um_private-content_image,
#um_online-users_image {
width: 36px !important;
}
#um_notices_image,
#um_social-activity_image,
#um_profile-completeness_image,
#um_private-messages_image,
#um_user-photos_image,
#um_terms-conditions_image {
width: 29px !important;
}
#um_social-login_image {
width: 28px !important;
}
#um_real-time-notifications_image,
#um_user-notes_image {
width: 26px !important;
}
#um_followers_image,
#um_user-locations_image {
width: 32px !important;
}
#um_user-bookmarks_image {
width: 23px !important;
}
#um-extensions-wrap a.plugin-image.svg-image img {
filter: invert(1);
background-color: transparent;
width: 38px;
height: auto;
}
#um-extensions-wrap a.plugin-image,
#um-extensions-wrap a.plugin-image img {
display: block;
}
#um-extensions-wrap .plugin-image:not(.svg-image) img {
width: 70px;
margin: 0;
height: 70px;
padding: 0;
}
#um-extensions-wrap .plugin-card-top {
margin: 0;
padding: 20px 0 0 0;
width: 100%;
min-height: 100px;
}
#um-extensions-wrap .plugin-card-top h3 {
text-align: center;
margin: 0 0 20px 0;
padding: 0;
}
#um-extensions-wrap .plugin-card-top .desc {
text-align: center;
margin: 0 !important;
padding: 0 !important;
}
#um-extensions-wrap .plugin-action-links {
padding: 20px 0 0 0;
width: 100%;
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: baseline;
flex-wrap: nowrap;
}
@media (max-width: 1152px) {
#um-extensions-wrap .plugin-card-top {
min-height: 120px;
}
}
@media (max-width: 992px) {
#um-extensions-wrap #the-list {
grid-template-columns: repeat(2, 1fr);
-ms-grid-template-columns: repeat(2, 1fr);
}
}
@media (max-width: 782px) {
#um-extensions-wrap #the-list {
grid-template-columns: repeat(1, 1fr);
-ms-grid-template-columns: repeat(1, 1fr);
}
}
@media screen and (max-width: 782px) {
#um-extensions-wrap .plugin-card-top {
min-height: 80px;
}
}
#um-metaboxes-general h1 sup {
font-size: 14px;
position: relative;
font-weight: 400;
background: #0085ba;
color: #fff !important;
padding: 2px 4px !important;
border-radius: 3px;
top: 5px;
left: 3px;
border: none !important;
}
.wrap a.red, .wrap span.red {color:#C74A4A}
.wrap span.ok {color:#7ACF58}
/* Misc */
.um-admin-dash-review {
text-decoration: none !important;
font-size: 16px;
position: absolute;
top: -2px;
right: 4px;
}
/* Dashboard widgets */
.p_seperate {
margin-top: 12px;
border-top: 1px solid #ddd;
}
.um-metabox-holder p.sub {
padding: 0 4px 2px 4px;
margin: 0 0 8px 0;
color: #8F8F8F;
font-size: 14px;
border-bottom: 1px solid #ECECEC;
}
.um-metabox-holder .table {
float: left;
width: 45%;
}
.um-metabox-holder a.warning {
color: #C74A4A !important;
background: transparent !important;
border: 0;
}
.um-metabox-holder .table_right {
float: right;
width: 45%;
}
.um-metabox-holder td.b {
padding-right: 6px;
text-align: right;
font-family: Georgia,"Times New Roman","Bitstream Charter",Times,serif;
font-size: 14px;
width: 1%;
}
.um-metabox-holder td.b {
text-align: right;
font-family: Georgia,"Times New Roman","Bitstream Charter",Times,serif;
font-size: 14px;
}
.um-metabox-holder table td {
white-space: nowrap;
font-size: 12px;
}
.um-metabox-holder td.b a {
font-size: 18px;
}
.um-metabox-holder .norm i {
display: inline-block;
width: 30px;
text-align: center;
}
.um-metabox-holder .norm p {
margin: 5px 0;
}
.um-metabox-holder .norm .count {
font-size: 16px;
font-family: Gerogia;
color: #999;
width: 40px;
display: inline-block;
text-align: right;
margin-right: 10px;
}
/* Share bar */
.um-admin-dash-share {
margin-top: 11px !important;
float: left;
line-height: 28px;
font-size: 15px;
}
.um-admin-dash-share a {
margin: 0 15px 0 0 !important;
text-decoration: none !important;
color: #777 !important;
font-size: 22px !important;
}
.um-admin-dash-share a:hover {color: #0085ba !important}
@@ -1,61 +0,0 @@
/*
- General
*/
.um-admin-metabox * {
-webkit-font-smoothing: antialiased !important;
-moz-osx-font-smoothing: grayscale !important;
}
.um-admin-metabox h6 {
font-size: 14px;
margin: 12px 0 0 0;
}
/*
- Metabox layout
*/
.um-admin.post-type-um_form div#submitdiv,
.um-admin.post-type-um_form div#side-sortables
{display:none}
/*
- Boxed Links
*/
.um-admin-boxed-links {
width: 100%;
text-align: center;
}
.um-admin-boxed-links a {
width: 33.3%;
float: left;
border-left: 1px solid #fff;
border-right: 1px solid #fff;
padding: 30px 25px !important;
background: #f8f8f8;
text-align: center;
display: inline-block !important;
font-size: 14px;
transition: all .2s linear;
text-decoration: none;
color: #666;
margin: 0 !important;
box-sizing: border-box !important;
border-radius: 2px;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
font-weight: 600;
}
.um-admin-boxed-links i {
font-size: 28px;
vertical-align: middle;
margin: 0 10px 0 0;
}
.um-admin-boxed-links a:hover {
background: #eee;
}
@@ -1,417 +0,0 @@
.um-form-table.um-third-column .um-forms-line th {
width: 33%;
}
.um-form-table.um-half-column .um-forms-line th {
width: 50%;
}
.um-form-table.um-two-thirds-column .um-forms-line th {
width: 83%;
}
.um-form-table.um-top-label .um-forms-line td {
padding: 0 0 15px 0;
}
.um-form-table.um-top-label .um-forms-line td label {
margin: 0 0 5px 0;
display: inline-block;
}
.um-form-table.um-top-label .um-forms-line[data-field_type="icon"] td label {
width: 100%;
display: block;
margin: 0 0 5px 0;
}
.um_admin_fonticon_wrapper {
display: flex;
flex-direction: row;
flex-wrap: nowrap;
justify-content: flex-start;
align-items: center;
}
.um-admin-icon-value {
line-height: 1;
}
.um_admin_fonticon_wrapper .um-admin-icon-value i {
top: 0;
}
input[type=text].um-forms-field.um-long-field,
select.um-forms-field.um-long-field,
textarea.um-forms-field.um-long-field {
width:100% !important;
}
input[type=text].um-forms-field.um-medium-field,
select.um-forms-field.um-medium-field,
textarea.um-forms-field.um-medium-field {
width:50% !important;
}
input[type=text].um-forms-field.um-small-field,
select.um-forms-field.um-small-field,
textarea.um-forms-field.um-small-field {
width:25% !important;
}
.um-multi-text-list,
.um-multi-selects-list,
.um-md-default-filters-list {
float: left;
width:100%;
margin: 0 0 10px 0;
}
.um-hidden-multi-text,
.um-hidden-multi-selects,
.um-hidden-md-default-filters {
display: none !important;
}
.um-multi-text-option-line,
.um-multi-selects-option-line,
.um-md-default-filters-option-line {
float:left;
width:100%;
margin: 0;
padding: 0;
clear:both;
}
.um-md-default-filters-option-line {
border-bottom: 1px solid #eee;
padding: 0 0 5px 0;
margin: 5px 0 0 0;
}
.um-md-default-filters-option-line .um.um-field-wrapper2 {
margin: 5px 0 0 0;
}
.um-multi-selects-option-line.um-admin-drag-fld {
background: none;
border: none;
display: flex;
flex-direction: row;
justify-content: flex-start;
align-items: center;
flex-wrap: nowrap;
}
.um-multi-selects-option-line.um-admin-drag-fld .um-field-icon {
float: left;
width: 20px;
text-align: left;
line-height: 30px;
}
.um-multi-selects-option-line .um-field-wrapper {
float:left;
width: calc( 100% - 60px );
line-height: 30px;
box-sizing: border-box;
}
.um-multi-selects-option-line .um-field-wrapper.um-custom-order-fields {
margin: 5px 0 0 0;
}
.um-multi-selects-option-line .um-field-wrapper.um-custom-order-fields label {
float:left;
width: 100%;
line-height: 30px;
box-sizing: border-box;
margin: 0 !important;
padding: 0 !important;
font-weight: bold;
display: flex;
flex-direction: row;
flex-wrap: nowrap;
justify-content: space-between;
align-items: baseline;
}
.um-multi-selects-option-line .um-field-wrapper.um-custom-order-fields label input[type="text"] {
width: auto;
display: inline;
font-weight: normal;
max-width: 70%;
flex: 0.9;
}
.um-multi-selects-option-line .um-field-wrapper.um-custom-order-fields label select{
width: auto;
display: inline;
font-weight: normal;
max-width: 70%;
flex: 0.9;
}
.um-multi-selects-option-line.um-admin-drag-fld .um-field-wrapper {
width: calc( 100% - 90px );
}
.um-multi-text-option-line .um-field-wrapper {
float:left;
width: calc( 100% - 90px );
line-height: 30px;
box-sizing: border-box;
}
.um-md-default-filters-option-line .um-field-wrapper {
float:left;
width: calc( 100% - 60px );
line-height: 30px;
box-sizing: border-box;
}
.um-md-default-filters-option-line .um-field-wrapper2 {
float:left;
width: calc( 100% - 60px );
line-height: 30px;
box-sizing: border-box;
}
.um-md-default-filters-option-line .um-field-wrapper2 .ui-slider-range.ui-widget-header {
background: #44b0ec;
border: 1px solid #44b0ec !important;
margin-top: -1px;
}
.um-md-default-filters-option-line .um-field-wrapper2 select {
width: 100%;
float: left;
}
.um-md-default-filters-option-line .um-field-wrapper2 input {
width: 100%;
float: left;
}
.um-md-default-filters-option-line .um-field-wrapper2 input.um-timepicker-filter,
.um-md-default-filters-option-line .um-field-wrapper2 input.um-datepicker-filter {
width: calc( 50% - 7px ) !important;
float: left;
}
.um-md-default-filters-option-line .um-field-wrapper2 .um-slider {
margin: 5px 9px 0 9px;
width: calc( 100% - 18px );
box-sizing: border-box;
display: block;
}
.um-md-default-filters-option-line .um-field-wrapper2 input.um-timepicker-filter:first-child,
.um-md-default-filters-option-line .um-field-wrapper2 input.um-datepicker-filter:first-child {
margin-right: 11px;
}
.um-multi-text-option-line .um-field-wrapper input,
.um-multi-selects-option-line .um-field-wrapper select {
float:left;
width: 100%;
margin:0;
}
.um-multi-text-option-line .um-field-control,
.um-multi-selects-option-line .um-field-control,
.um-md-default-filters-option-line .um-field-control {
float:left;
width: 60px;
line-height: 30px;
padding: 0 10px;
box-sizing: border-box;
}
.um-form-table .description {
font-style: italic;
}
.um-form-field .description {
clear: both;
}
.um-form-fields-section {
float:left;
clear: none;
margin:0;
padding: 0 10px 0 0;
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
}
.um-form-fields-section label {
float:left;
width:100%;
margin:0;
padding:0;
}
.um-form-fields-section label input {
float:left;
margin-top:0;
}
.um-form-fields-section label span {
float:left;
width:calc( 100% - 20px );
}
.um-multi-text-option-line,
.um-multi-selects-option-line {
margin: 0 0 5px 0;
}
@media screen and (max-width: 782px) {
.um-form-fields-section {
width:100% !important;
}
.um-admin-metabox .um-form-fields-section label {
line-height: 22px !important;
margin: 0 0 12px 0 !important;
}
.um-form-fields-section label span {
width:calc( 100% - 30px );
}
.um-multi-text-option-line,
.um-multi-selects-option-line {
margin: 0 0 6px 0;
}
.um-forms-line label {
float:left;
width:100%;
}
.um-form-table.um-third-column .um-forms-line th,
.um-form-table.um-half-column .um-forms-line th,
.um-form-table.um-two-thirds-column .um-forms-line th {
float:left;
width: 100%;
}
.um-form-table.um-third-column .um-forms-line td,
.um-form-table.um-half-column .um-forms-line td,
.um-form-table.um-two-thirds-column .um-forms-line td {
float:left;
width: 100%;
}
.um-form-table.um-third-column .um-forms-line th label,
.um-form-table.um-half-column .um-forms-line th label,
.um-form-table.um-two-thirds-column .um-forms-line th label {
float:left;
width: 100%;
}
}
/*Multi text filed */
.um-forms-line .um-text-delete {
color: #a00;
float:left;
}
.um-forms-line .um-text-delete:hover {
color: red;
}
.um-forms-line .um-multi-text-add-option {
margin-bottom: 14px;
}
/* Media uploader */
.um-forms-line .icon_preview {
display: none;
max-width: 200px;
max-height: 200px;
padding: 5px;
cursor: pointer;
border: 1px solid #e3e3e3;
background: #f7f7f7;
border-radius: 3px;
height: auto;
width: auto !important;
}
.um-forms-line[data-conditional] {
display: none;
}
/* Same page update field */
.um-forms-line td .um-same-page-update-wrapper {
display: none;
margin: 7px 0 0 0;
}
.um-forms-line td .um-same-page-update-wrapper input.um-admin-form-same-page-update {
margin: 7px 0 0 0;
}
.um-forms-line td .um-same-page-update-wrapper .upgrade_log {
margin: 7px 0 0 0;
width:100%;
height:150px;
overflow: auto;
border: 1px solid #a1a1a1;
}
.um-forms-line[data-field_type="same_page_update"] {
vertical-align: baseline;
}
.um-forms-line[data-field_type="same_page_update"] th,
.um-forms-line[data-field_type="same_page_update"] td {
vertical-align: baseline;
}
.um-sortable-items-field .um-sortable-item {
cursor: move !important;
padding: 5px;
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
border: 1px solid #7e8993;
border-radius: 4px;
-moz-border-radius: 4px;
background: #f1f1f1;
height: 42px;
line-height: 28px;
display: flex;
flex-direction: row;
justify-content: flex-start;
align-items: center;
flex-wrap: nowrap;
}
.um-sortable-items-field .um-sortable-item.um-hidden-item {
display: none;
}
.um-sortable-items-field .um-sortable-item .um-field-icon {
font-size: 18px;
width: 20px;
text-align: left;
margin: 0 10px 0 0;
}
.um-form-table span.um-req {
margin: 0 0 0 4px;
color: #a00;
}
@@ -1,225 +0,0 @@
.um-admin-notice {
border-color: #0085ba !important;
color: #555;
}
.um-admin-notice.notice-warning {
border-color: #dba617 !important;
color: #555;
}
.um-admin-notice.upgraded {
border-color: #0085ba !important;
color: #555;
}
.um-admin-notice.error {
border-color: #dc3232 !important;
color: #555;
}
.um-admin-notice a.button-primary {
background-color: #0085ba !important;
border-color: #0085ba !important;
}
.um-admin-notice a.button-primary:hover {
background-color: #008ec2 !important;
border-color: #008ec2 !important;
}
.um-admin-notice a.button-secondary {opacity: 0.7}
.um-admin-notice a.button-secondary:hover {opacity: 0.9}
.um-admin-notice a {text-decoration: none;color: #0085ba}
.um-admin-notice a:hover {color: #44b0ec}
.um-filter {
padding: 12px;
border-color: #ddd !important;
margin: 20px 0 0 0 !important;
font-size: 14px;
line-height: 24px;
}
/*
- General metabox styling
*/
#um-admin-access-settings h3 {
padding: 10px 20px 10px 60px;
color: #fff;
background: #0085ba url(../img/logo-small.png) no-repeat 12px center;
font-weight: bold;
font-size: 14px !important;
-webkit-font-smoothing: antialiased !important;
-moz-osx-font-smoothing: grayscale !important;
}
#um-admin-access-settings h4 { margin: 10px 0 4px 0!important}
#um-admin-access-settings div.handlediv {
color: #fff !important;
-webkit-font-smoothing: antialiased !important;
-moz-osx-font-smoothing: grayscale !important;
}
#um-admin-access-settings p {font-size: 13px}
#um-admin-access-settings input[type=text] {font-size: 13px}
/*
- Nav Menu
*/
.um-nav-edit * {
-webkit-font-smoothing: antialiased !important;
-moz-osx-font-smoothing: grayscale !important;
}
.um-nav-edit-h2 {
padding: 10px 20px 10px 60px;
margin: 14px 12px 0 0;
border-radius: 3px;
color: #fff;
background: #0085ba url(../img/logo-small.png) no-repeat 12px center;
font-weight: bold;
}
.um-nav-mode {margin-top:10px}
.um-nav-roles {display: none;margin-top:5px}
/*
- jQuery Tooltips
*/
.um-admin-tip {
margin: 0 0 0 2px;
color: #0085ba !important;
vertical-align: middle;
position: relative;
top: -3px;
opacity: 0.8;
}
.um-admin-tip.n {margin-left: 5px}
.um-admin-tip i {cursor: pointer; vertical-align: middle; font-size: 20px; line-height: 20px;color: #0085ba !important;}
a.um-delete{ color: #a00; }
/* Roles metabox + table features */
.um-metabox-section .description {
font-style: italic;
}
.um-metabox-section th {
width: 35%;
}
.wp-list-table.roles .column-core,
.wp-list-table.roles .column-users,
.wp-list-table.roles .column-admin_access,
.wp-list-table.roles .column-priority {
width:15%;
text-align: center !important;
}
@media screen and (max-width: 782px) {
.wp-list-table.roles .column-core,
.wp-list-table.roles .column-users,
.wp-list-table.roles .column-admin_access,
.wp-list-table.roles .column-priority {
text-align: left !important;
}
}
#um-admin-form-wp-capabilities .um-metadata-line th {
width: auto;
}
#um-admin-form-wp-capabilities .um-metadata-line td {
width: 20px;
}
#um_edit_role #titlewrap > span {
width: 40px;
font-size: 24px;
float:left;
display: block;
line-height: 37px;
}
#um-roles .row-actions .reset a {
color:#a00;
}
#um-roles .row-actions .reset a:hover {
color:red;
}
/*Tooltip*/
.ui-tooltip.um_tooltip {
padding: 8px;
color: #eeeeee !important;
background: #333 !important;
position: absolute;
z-index: 1000000;
max-width: 300px;
font-size: 12px;
border-radius: 5px;
border: none !important;
text-shadow: none !important;
}
.ui-tooltip.um_tooltip a {
color: #eeeeee !important;
}
.um_tooltip.dashicons,
.um_tooltip.dashicons:before {
height:22px;
}
.um_tooltip.dashicons-editor-help::before {
float: left;
font-size: 20px;
line-height: 20px;
color: #333 !important;
}
.um_tooltip {
cursor: pointer;
vertical-align: middle;
}
.um_tooltip:hover {
opacity: 1;
}
.um_tooltip:hover:before {
opacity: 0.8;
}
.wp-admin p.um-nav-roles label input[type=checkbox] {
margin-top: 0 !important;
}
.wp-admin p.um-nav-roles label {
margin-top: 2px !important;
margin-bottom: 2px !important;
}
/*
- Restrict access
*/
.um_hidden_notice,
.um_block_settings .um_block_settings_hide{
display: none;
}
.um_block_settings .components-select-control .components-select-control__input[multiple]{
height: auto;
}
.um_block_settings .components-select-control .components-select-control__input[multiple] + .components-input-control__suffix{
display: none;
}
@@ -1,3 +0,0 @@
ul#adminmenu a.wp-has-current-submenu:after,ul#adminmenu>li.current>a.current:after {display: none !important}
ul#adminmenu li.wp-has-submenu.wp-not-current-submenu:hover:after{right:-9999999px}
-266
View File
@@ -1,266 +0,0 @@
/*
- Welcome
*/
.um-about-wrap * {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.um-about-wrap a.um-about-icon {
margin: 0 0 0 15px !important;
padding: 0 !important;
text-decoration: none !important;
color: #777 !important;
font-size: 22px !important;
}
.um-about-wrap a.um-about-icon:hover {color: #0085ba !important}
.um-badge {
color: #fff;
background: none !important;
background: #0085ba url(../img/logo_small.png) no-repeat center 0px !important;
}
.um-about-wrap .ultimatemember-actions a.button-primary,
.um-about-wrap .ultimatemember-actions a.button {
vertical-align: top;
margin: 0 5px 0 0;
}
.changelog a.button-primary {
height: 40px;
line-height: 38px;
}
.um-about-wrap a {text-decoration: none}
/*
- General
*/
body.um-admin-modal-open {
overflow: hidden;
}
.um-admin #major-publishing-actions{background-color: #fff !important;border-top:0}
.um-admin-hide {display: none}
.um-admin-field {
display: block;
width: 100%;
margin-top: 10px;
}
.um-admin-field a.button {
position: relative;
top: 1px;
height: 30px !important;
}
.um-admin-half {
float: left;
width: 48%;
}
.um-admin-tri {
float: left;
width: 33%;
}
.um-admin-left{float: left}
.um-admin-right {float: right}
.um-admin-clear {clear: both}
.um-admin a.um-admin-activebg,
.um-admin a.um-admin-activebg:hover{
/*background: #3ba1da;*/
background: #0085ba;
color: #fff;
}
.um-admin a.button i,
.um-admin a.button-primary i {
font-size: 15px !important;
height: 15px !important;
width: 15px !important;
text-align: center !important;
margin: 0 5px 0 0 !important;
display: inline-block;
}
.um-admin a.button i:before,
.um-admin a.button-primary i:before {
position: relative;
top: 1px;
}
/*
- Form Inputs
*/
.um-admin-metabox h3 {
padding-left: 0 !important;
}
.um-admin-metabox h4 {
font-size: 14px;
background: #f5f5f5;
padding: 8px 4px;
color: #333;
}
.um-admin-metabox p {margin: 10px 0 0 0}
.um-admin-metabox label{
display: block;
cursor: default;
margin: 0 0 8px 0 !important;
padding: 0!important;
font-size: 13px;
color: #666;
}
.um-admin-metabox input[type=text]:disabled{
opacity: 0.7 !important;
color: #aaa !important;
}
.um-admin-metabox input[type=text] {
height: auto !important;
}
.um-admin-metabox input[type=text],
.um-admin-metabox textarea {
width: 100%;
max-width: 100%;
display: block;
box-sizing: border-box !important;
font-size: 13px !important;
line-height: 1.4em !important;
padding: 4px 10px !important;
}
.um-admin-metabox textarea {
padding: 8px !important;
line-height: 1.6em;
color: #888 !important;
}
.um-admin-metabox input[type=text].um-admin-error,
.um-admin-metabox textarea.um-admin-error
{border-color: #C74A4A!important}
.um-admin-metabox input[type=text].small {width: 54px}
.um-admin-metabox textarea {min-height: 100px;height: 100px}
.um-admin-metabox textarea.tall {min-height: 200px;height: 200px}
.wp-picker-container input.wp-color-picker[type="text"] {
width: 68px !important;
float: left !important;
padding: 2px 4px !important;
border-width: 1px !important;
}
/*
- Error blocks
*/
.um-admin-error-block, .um-admin-success-block{
display: none;
width: 100%;
background: #C74A4A;
border-radius: 3px;
color: #fff;
box-sizing: border-box;
position: relative;
padding: 12px;
font-size: 13px;
line-height: 1em !important;
margin: 0 0 16px 0;
}
.um-admin-success-block {
background: #7ACF58;
}
/*
- Yes or NO UI
*/
p.disabled-on-off .um-admin-yesno {
opacity: 0.5!important;
cursor: default !important;
}
p.disabled-on-off .um-admin-yesno *{
cursor: default !important;
}
.um-admin-yesno {
width: 100px !important;
height: 26px;
display: block;
position: relative;
color: #fff;
}
.um-admin-yesno span.btn {
position: absolute;
left: 0;
top: -2px;
width: 50px;
height: 28px;
text-align: center;
background: #f9f9f9;
z-index: 999;
border-radius: 3px;
cursor: pointer;
border: solid 1px #D0D9DB;
margin: 0;
padding: 0 !important;
}
.um-admin-yesno span.btn.pos-1 {left: 48px}
.um-admin-yesno span.yes, .um-admin-yesno span.no {
width: 50px;
float: left;
line-height: 24px;
height: 26px;
cursor: default;
font-size: 14px;
color: #fff;
padding: 0 0 0 10px;
box-sizing: border-box;
}
.um-admin-yesno .yes {
background: #0085ba;
border-radius: 3px 0 0 3px;
border: 1px solid rgba(0,0,0,.2);
}
.um-admin-yesno .no {
padding: 0 10px 0 0 !important;
text-align: right;
float: right;
background: #fff;
color: #222 !important;
border-radius: 0 3px 3px 0;
border: 1px solid #ddd;
}
.um-admin.users-php .subsubsub li.subsep {
display: block;
visibility: hidden;
height: 0;
}
.um-admin-cur-condition-template {
display: none;
}
@@ -1,319 +0,0 @@
/*
- Overlay
*/
.um-admin-overlay {
background: rgba(0,0,0, .7);
width: 100%;
height: 100%;
position: fixed;
top: 0;
left: 0;
z-index: 10000;
}
/*
- modal
*/
.um-admin-modal * {
-webkit-font-smoothing: antialiased !important;
-moz-osx-font-smoothing: grayscale;
}
.um-admin-modal input[type=submit].button-primary,
.um-admin-modal a.button-primary,
.um-admin-modal a.button {
padding: 0 12px !important;
vertical-align: middle !important;
}
.um-admin .um-admin-modal a.button i:before {
display: block;
top: 0px;
}
.um-admin-modal input[type=submit].button-primary {
line-height: 24px !important;
}
.um-admin-modal {
border-radius: 3px;
background: #fff;
position: fixed;
top: 50% !important;
left: 50% !important;
display: none;
z-index: 10001;
box-sizing: border-box;
width: 730px;
margin-left: -365px;
}
.um-admin-modal.normal {width: 730px;margin-left: -365px;}
.um-admin-modal.smaller {width: 500px;margin-left: -250px;}
.um-admin-modal.small {width: 400px;margin-left: -200px;}
.um-admin-modal-close {
position: absolute;
color: #fff !important;
right: 16px;
top: 14px;
font-size: 22px;
text-decoration: none;
opacity: 0.4;
}
.um-admin-modal-close:hover{opacity:1}
.um-admin-modal-head {
padding: 4px 20px;
background: #0085ba;
position: relative;
border-radius: 3px 3px 0 0;
}
.um-admin-modal-body {
padding: 10px 20px 10px 20px;
max-height: 500px;
overflow: auto;
}
.um-admin-modal-body.um-admin-metabox label {margin: 0!important}
.um-admin-modal.loading .um-admin-modal-body {
height: 200px;
background: url(../img/ajax-loader.gif) no-repeat center;
}
.um-admin-modal-foot {
padding: 20px 0 !important;
border-top: 1px solid #ddd;
text-align: center;
background: #eee;
border-radius: 0 0 3px 3px;
}
.um-admin-modal-foot a,
.um-admin-modal-foot input{
margin: 0 10px !important;
font-size: 14px !important;
}
.um-admin-modal h3 {
font-size: 14px;
line-height: 14px;
font-weight: normal;
color: #fff;
}
.um-admin-modal h4 {
margin: 0 0 10px 0 !important;
}
.um-admin-modal label,
.um-admin-modal p {
font-size: 13px;
color: #aaa;
}
.um-admin-infobox p,
.um-admin-infobox label {
color: #666;
}
.um-admin-infobox p {
padding-top: 15px;
}
.um-admin-infobox > p:not(:first-child) {
border-top: 1px solid #e5e5e5;
}
.um-admin-infobox > .um-row > p {
border-top: 1px solid #e5e5e5;
}
.um-admin-infobox > p:first-child {
margin-top: 0;
padding-top: 0;
}
.um-admin-infobox label {
font-weight: bold;
display: block;
color: #333;
cursor: default;
}
/*
- Conditional fields
*/
.um-admin-btn-toggle {
padding: 10px 0;
}
.um-admin-btn-toggle p {
margin: 0 5px 0 0 !important;
}
.um-admin-btn-toggle p.um-admin-reset-conditions {
margin: 0 0 5px 0 !important;
}
.um-admin-btn-toggle a {
text-decoration: none;
color: #999;
}
.um-admin-btn-toggle a.active, .um-admin-btn-toggle a.active:hover {
color: #0085ba;
}
.um-admin-btn-toggle i {
margin: 0 5px 0 0 !important;
height: 100%;
color: #666;
position: relative;
top: 1px;
}
.um-admin-btn-content {
display: none;
padding: 5px 0 0 0;
}
.um-admin-btn-content p {
float: left;
margin-right: 10px !important;
padding: 0 !important;
}
.um-admin-btn-content p.um-admin-conditions-notice {
width: 100%;
margin: 0 0 9px 0 !important;
}
.um-admin-btn-content .um-admin-cur-condition:not(:last-child) {
margin: 0 0 5px 0;
}
.dynamic-mce-content {display: none}
/*
- Buttons and Links
*/
.um-admin-btns {
line-height: 1.5em;
margin: 0 0 5px 0;
}
.um-admin-btns a {
margin: 0 3px 8px 0!important;
font-size: 12px !important;
display: inline-block !important;
position: relative;
}
.um-admin-btns a.button.with-icon {
padding-right: 25px !important;
}
.um-admin-btns a span {
color: #aaa;
position: absolute !important;
width: 25px;
text-align: center;
right: 0;
top: 0;
font-size: 15px !important;
}
.um-admin-btns a span.remove:before{
font-family: "Ionicons" !important;
content: "\f128";
}
.um-admin-btns a span:hover{color: #cb3838}
/*
- WP Editor
*/
.um-admin-modal-body.um-admin-metabox .um-admin-editor-h {
margin-top: 12px;
}
.um-admin-modal-body.um-admin-metabox .um-admin-editor-h label,
.um-admin-modal-body.um-admin-metabox .wp-editor-wrap
{margin: 0 0 4px 0 !important}
.um-admin-modal-body.um-admin-metabox .wp-editor-wrap textarea {
border: 0 !important;
}
/*
- Boxes / Icons
*/
#UM_fonticons div.um-admin-metabox {
padding-bottom: 22px !important;
}
p._icon_search{
position: relative;
width: 85% !important;
margin: 0 auto !important;
padding: 12px 0 0 0 !important;
}
p._icon_search:before {
position: absolute;
right: 6px;
top: 12px;
font-size: 20px;
content: "\f4a4";
font-family: "Ionicons";
color: #999;
}
p._icon_search input[type=text]{padding-right: 40px!important}
.um-admin-icons {
padding: 0 0 15px 12px;
float: left;
}
.um-admin-icons span {
cursor: pointer;
float: left;
margin: 5px;
color: #777;
border: 4px solid #eee;
border-radius: 3px;
}
.um-admin-icons span:hover,
.um-admin-icons span.highlighted
{color: #0085ba;border-color: #0085ba}
.um-admin-icons i{vertical-align: middle !important;font-size: 24px;width: 24px;text-align: center;padding: 15px 20px;display: inline-block;}
span.um-admin-icon-value {
margin: 0 10px;
font-size: 13px;
}
span.um-admin-icon-value i {
font-size: 28px;
color: #0085ba;
position: relative;
top: 5px;
}
span.um-admin-icon-clear{
display: none;
cursor: pointer;
position: relative;
color: #ccc;
}
span.um-admin-icon-clear.show {display: inline-block}
span.um-admin-icon-clear:hover {color: #777}
span.um-admin-icon-clear i {font-size: 20px;vertical-align: middle;}
@@ -1,71 +0,0 @@
.um-admin-yesno span.yes, .um-admin-yesno span.no {
padding: 0 10px 0 0;
}
.um-admin-drag-ctrls-demo.um-admin-drag-ctrls {
left: 12px;
right: auto;
}
.um-admin-drag-row-icons {
left: 0;
right: auto;
}
.um-admin-drag-ctrls.columns {
right: 0 !important;
left: auto;
}
.um-admin-drag-ctrls.columns a {
float: right;
}
.um-admin-drag-rowsub-icons {
right: auto;
left: 0;
}
.um-admin-drag-row-icons a {
float: right;
}
.um-admin-drag-fld-icons a {
float: right;
}
.um-admin-drag-fld-icons {
float: left;
}
.um-admin-drag-fld-title, .um-admin-drag-fld-type {
float: right;
margin: 0 20px 0 0;
}
.select2-container .select2-choice > .select2-chosen {
text-align: right !important;
}
.select2-container .select2-choice .select2-arrow {
border: none !important;
right: auto !important;
left: 0 !important;
}
.select2-container .select2-choice > .select2-chosen {
margin-right: 10px !important;
margin-left: 26px !important;
}
.um-form-fields-section {
padding: 0 0 0 10px;
}
.um-form-fields-section {
float: right;
}
.um-form-fields-section label input {
float: right;
}
@@ -1,193 +0,0 @@
/*body.um-admin .select2-container {margin-right: 2px!important;}
body.um-admin .select2-drop,
body.um-admin .select2-drop.select2-drop-above,
body.um-admin .select2-drop-active,
body.um-admin .select2-container-multi .select2-choices
{border: 1px solid #ddd !important}
body.um-admin .select2-container .select2-choice
{
height: 27px !important;
line-height: 27px !important;
border: 1px solid #ddd !important;
color: #888 !important;
}
body.um-admin .select2-container .select2-choice > .select2-chosen {
font-size: 13px !important;
}
body.um-admin .select2-container .select2-choice {
font-size: 13px !important;
}
body.um-admin .select2-container .select2-choice .select2-arrow:before {
font-size: 23px !important;
line-height: 27px;
}
body.um-admin .select2-search-choice-close:before {
font-size: 20px !important;
color: #aaa;
line-height: 27px;
}
body.um-admin .select2-container-multi .select2-search-choice-close:before {
font-size: 15px !important;
}
body.um-admin .select2-search input[type=text] {
font-size: 13px !important;
}
body.um-admin .select2-results li {
font-size: 13px !important;
}
body.um-admin .select2-results .select2-no-results,
body.um-admin .select2-results .select2-searching,
body.um-admin .select2-results .select2-selection-limit {
font-size: 13px !important;
}
body.um-admin .select2-container-multi .select2-choices .select2-search-choice {
line-height: 13px !important;
font-size: 13px !important;
}
body.um-admin .select2-drop-mask {
z-index: 10020 !important;
}
body.um-admin .select2-drop {
z-index: 999999 !important;
}
body.um-admin .select2-search {
z-index: 10040 !important;
}*/
/* Select2 4.0*/
body.um-admin .select2.select2-container .select2-selection{
display: block !important;
height: 28px !important;
padding: 0 0 0 12px !important;
overflow: hidden !important;
position: relative !important;
white-space: nowrap !important;
line-height: 25px !important;
color: #666 !important;
font-size: 13px !important;
text-align: left !important;
text-decoration: none !important;
-moz-border-radius: 2px !important;
-webkit-border-radius: 2px !important;
border-radius: 2px !important;
background-clip: padding-box !important;
-webkit-touch-callout: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
background: none !important;
background-color: #fff !important;
border: 1px solid #ddd !important;
}
body.um-admin .select2.select2-container .select2-selection .select2-selection__arrow b[role=presentation]{
display:none;
}
body.um-admin .select2.select2-container .select2-selection .select2-selection__arrow:before{
content: "\f3d0" !important;
font-size: 27px !important;
font-family: "Ionicons" !important;
width: 100% !important;
display: block;
height: 100%;
line-height: 28px;
color: #aaaaaa;
}
body.um-admin .select2.select2-container .select2-selection .select2-selection__arrow {
display: inline-block !important;
width: 34px !important;
height: 100% !important;
position: absolute !important;
right: 0 !important;
top: 0 !important;
-moz-border-radius: 0 2px 2px 0 !important;
-webkit-border-radius: 0 2px 2px 0 !important;
border-radius: 0 2px 2px 0 !important;
background-clip: padding-box !important;
text-align: center !important;
background: transparent !important;
border-left: 0 !important;
}
body.um-admin .select2-container.select2-container--open .select2-dropdown{
border: 1px solid #ddd !important;
}
body.um-admin .select2-results li{
list-style: none;
display: list-item;
background-image: none;
font-size: 13px;
margin: 5px !important;
padding: 3px 0 !important;
color: #666 !important;
}
body.um-admin .select2-results li {
padding: 3px 7px 4px !important;
cursor: pointer;
min-height: 1em !important;
}
body.um-admin .select2-container--default .select2-selection--single .select2-selection__rendered {
line-height: 25px;
}
body.um-admin .select2-results li.select2-results__option.select2-results__option--highlighted{
background: none !important;
background: #f4f4f4 !important;
color: #666 !important;
}
body.um-admin .select2-container--default .select2-results__option[aria-selected=true] {
background: transparent !important;
}
body.um-admin .select2-selection__clear {
right: 10px;
font-size: 25px;
color: #aaaaaa !important;
font-weight: 300 !important;
}
body.um-admin .select2-container--default .select2-selection--multiple .select2-selection__rendered {
box-sizing: border-box;
list-style: none;
margin: 0;
padding: 0px;
width: 100%;
line-height: 20px;
font-size: 13px;
}
body.um-admin .select2.select2-container .select2-selection.select2-selection--multiple {
height: auto !important;
}
body.um-admin .select2-container--default .select2-selection--multiple .select2-selection__clear {
cursor: pointer;
float: right;
margin-top: 0px;
margin-right: 5px;
font-size: 25px;
}
body.um-admin .select2-container--default .select2-results__option[aria-selected=true] {
background-color: #ddd !important;
}
body.um-admin .select2-container .select2-search--inline {
line-height: 37px !important;
}
body.um-admin .select2-drop-active {
z-index: 99999 !important;
}
@@ -1,273 +0,0 @@
.um-settings-section .description {
font-style: italic;
}
.um-block-notice {
background: #fff;
font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;
font-size:13px;
padding: 20px;
border: 1px solid #000;
}
.um-notification-status {
margin-right: 18px;
font-size: 28px;
line-height: 22px;
}
.um-notification-status {
color: #a00;
float:left;
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
}
.um-notification-status.um-notification-is-active {
color: #46b450;
}
.um-email-configure span {
line-height: 24px;
}
.um-long-field {
width:100%;
}
.um-medium-field {
width:50%;
}
.um-small-field {
width:25%;
}
.column-configure {
width: 60px;
text-align: center;
}
.wp-list-table.templates .column-core_version {
width: 100px;
text-align: center;
}
.wp-list-table.templates .column-theme_version {
width: 100px;
text-align: center;
}
.wp-list-table.templates .column-status {
width: 260px;
}
th.column-email.column-primary {
padding-left: 48px;
}
.um-nav-tab-wrapper {
margin-right: 20px;
}
#um-settings-emails {
float:left;
width:calc( 100% - 20px );
margin-right: 20px;
}
#um-settings-form {
float:left;
width:calc( 100% - 10px );
margin-right: 10px;
}
#um-settings-form .subsubsub {
float:left;
width:100%;
}
.um-settings-line .multi-checkbox-line {
float:left;
width:100%;
clear: both;
margin: 0 0 10px 0;
padding: 0;
}
.um-settings-line .multi-checkbox-column {
float:left;
margin: 0;
padding:0;
}
.um-settings-line .multi-checkbox-column label {
float:left;
width:100%;
}
.wrap-licenses .form-table,
.wrap-licenses thead,
.wrap-licenses tbody,
.wrap-licenses tfoot,
.wrap-licenses tr,
.wrap-licenses td,
.wrap-licenses th,
.wrap-licenses caption {
display: block;
}
.wrap-licenses .form-table tr {
float: left;
margin: 0 15px 15px 0;
background: #fff;
border: 1px solid #ccc;
width: 30.5%;
max-width: 350px;
padding: 14px;
min-height: 240px;
position: relative;
box-sizing: border-box;
}
.wrap-licenses .form-table th {
background: #f9f9f9;
padding: 14px;
border-bottom: 1px solid #ccc;
margin: -14px -14px 20px;
width: 100%;
}
.wrap-licenses .form-table td {
padding: 0;
}
.wrap-licenses td input.regular-text {
margin: 0 0 8px;
width: 100%;
}
.wrap-licenses .edd-license-data[class*="edd-license-"] {
position: absolute;
background: #fafafa;
padding: 14px;
border-top: 1px solid #eee;
margin: 20px -14px -14px;
min-height: 67px;
width: 100%;
bottom: 14px;
box-sizing: border-box;
}
.wrap-licenses .edd-license-data[class*="edd-license-"] a {
color: #444;
}
.wrap-licenses .edd-license-data[class*="edd-license-"] a:hover {
text-decoration: none;
}
.wrap-licenses .edd-license-data.license-expires-soon-notice {
background-color: #00a0d2;
color: #fff;
border-color: #00a0d2;
}
.wrap-licenses .edd-license-data.edd-license-expired {
background-color: #e24e4e;
color: #fff;
border-color: #e24e4e;
}
.wrap-licenses .edd-license-data.edd-license-valid {
background-color: #5abc55;
color: #fff;
border-color: #5abc55;
}
.wrap-licenses .edd-license-data.edd-license-error,
.wrap-licenses .edd-license-data.edd-license-missing,
.wrap-licenses .edd-license-data.edd-license-invalid,
.wrap-licenses .edd-license-data.edd-license-site_inactive,
.wrap-licenses .edd-license-data.edd-license-item_name_mismatch {
background-color: #ffebcd;
border-color: #ffebcd;
}
.wrap-licenses .edd-license-data p {
font-size: 13px;
margin-top: 0;
}
.wrap-licenses .edd-license-data.license-expires-soon-notice a,
.wrap-licenses .edd-license-data.edd-license-expired a {
color: #fff;
}
.wrap-licenses .edd-license-data.license-expires-soon-notice a:hover,
.wrap-licenses .edd-license-data.edd-license-expired a:hover {
text-decoration: none;
}
.wrap-licenses ~ p.submit {
clear: both;
}
@media screen and (max-width: 980px) {
.wrap-licenses .form-table tr {
width:calc( 50% - 15px );
max-width: none;
}
}
@media screen and (max-width: 782px) {
.wrap-licenses .form-table tr {
width:100%;
margin-right: 0;
max-width: none;
}
.um-settings-line .multi-checkbox-column {
width:100% !important;
}
.um-settings-line .multi-checkbox-column label {
line-height: 30px !important;
}
.um-medium-field {
width:100%;
}
.um-small-field {
width:50%;
}
.wp-list-table.templates .column-core_version {
width: auto;
text-align: left;
}
.wp-list-table.templates .column-theme_version {
width: auto;
text-align: left;
}
}
/*
.email_template_wrapper .copy_button_overlay {
position:absolute;
top:0;
bottom:0;
width:calc( 100% - 30px );
z-index: 2;
background: rgba( 241, 241, 241, 0.95 );
text-align: center;
padding-top: 30%;
padding-right: 20px;
padding-left: 20px;
}
.email_template_wrapper .copy_button_overlay > span {
color: #444;
margin: 0 0 15px 0;
display: inline-block;
}
.email_template_wrapper.in_theme .copy_button_overlay {
display: none !important;
}
*/
.um_setting_ajax_button_response.complete {
color:darkgreen;
font-style: italic;
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.3 KiB

-86
View File
@@ -1,86 +0,0 @@
function um_builder_delete_field_ajax( callback ) {
if ( UM.admin.builder.fieldsToDelete.length > 0 ) {
let fieldDelete = UM.admin.builder.fieldsToDelete.shift();
let arg1 = jQuery( fieldDelete ).find('[data-silent_action="um_admin_remove_field"]').data('arg1');
let arg2 = jQuery( fieldDelete ).find('[data-silent_action="um_admin_remove_field"]').data('arg2');
jQuery.ajax({
url: wp.ajax.settings.url,
type: 'POST',
data: {
action:'um_do_ajax_action',
act_id : 'um_admin_remove_field',
arg1 : arg1,
arg2 : arg2,
nonce: um_admin_scripts.nonce
},
success: function( data ) {
um_builder_delete_field_ajax( callback );
},
error: function( data ) {
callback();
}
});
} else {
callback();
}
}
jQuery(document).ready(function() {
jQuery(document).ajaxStart( function() {
jQuery('.tipsy').hide();
});
jQuery( document.body ).on('click', 'a[data-silent_action^="um_"]', function() {
if ( typeof jQuery(this).attr('disabled') !== 'undefined' ) {
return false;
}
var act_id = jQuery(this).data('silent_action');
var arg1 = jQuery(this).data('arg1');
var arg2 = jQuery(this).data('arg2');
var in_row = '';
var in_sub_row = '';
var in_column = '';
var in_group = '';
var demon_settings = jQuery('.um-col-demon-settings');
if ( demon_settings.data('in_column') ) {
in_row = demon_settings.data('in_row');
in_sub_row = demon_settings.data('in_sub_row');
in_column = demon_settings.data('in_column');
in_group = demon_settings.data('in_group');
}
jQuery('.tipsy').hide();
um_admin_remove_modal();
jQuery.ajax({
url: wp.ajax.settings.url,
type: 'POST',
data: {
action:'um_do_ajax_action',
act_id : act_id,
arg1 : arg1,
arg2 : arg2,
in_row: in_row,
in_sub_row: in_sub_row,
in_column: in_column,
in_group: in_group,
nonce: um_admin_scripts.nonce
},
success: function( data ) {
demon_settings.data('in_row', '').data('in_sub_row', '').data('in_column', '').data('in_group', '');
um_admin_modal_responsive();
um_admin_update_builder();
},
error: function( data ) {
}
});
return false;
});
});
-197
View File
@@ -1,197 +0,0 @@
'use strict';
var um_components = wp.components,
umSelectControl = um_components.SelectControl,
umTextareaControl = um_components.TextareaControl;
function um_admin_blocks_custom_fields( um_condition_fields, props ) {
return wp.hooks.applyFilters( 'um_admin_blocks_custom_fields', [], um_condition_fields, props );
}
var um_block_restriction = wp.compose.createHigherOrderComponent(
function( BlockEdit ) {
var um_condition_fields = {
um_who_access: 'um_block_settings_hide',
um_roles_access: 'um_block_settings_hide',
um_message_type: 'um_block_settings_hide',
um_message_content: 'um_block_settings_hide'
};
um_condition_fields = wp.hooks.applyFilters( 'um_admin_blocks_condition_fields_default', um_condition_fields );
return function( props ) {
let initialIsRestrict = props.attributes.um_is_restrict !== undefined ? props.attributes.um_is_restrict : false;
if ( props.attributes.um_is_restrict !== true ) {
um_condition_fields['um_who_access'] = 'um_block_settings_hide';
um_condition_fields['um_roles_access'] = 'um_block_settings_hide';
um_condition_fields['um_message_type'] = 'um_block_settings_hide';
um_condition_fields['um_message_content'] = 'um_block_settings_hide';
} else {
um_condition_fields['um_who_access'] = '';
if ( parseInt( props.attributes.um_who_access ) === 0 || typeof props.attributes.um_who_access === 'undefined' ) {
um_condition_fields['um_roles_access'] = 'um_block_settings_hide';
um_condition_fields['um_message_type'] = 'um_block_settings_hide';
um_condition_fields['um_message_content'] = 'um_block_settings_hide';
} else if ( parseInt( props.attributes.um_who_access ) === 1 ) {
um_condition_fields['um_roles_access'] = '';
um_condition_fields['um_message_type'] = '';
if ( parseInt( props.attributes.um_message_type ) === 2 ) {
um_condition_fields['um_message_content'] = '';
} else {
um_condition_fields['um_message_content'] = 'um_block_settings_hide';
}
} else {
um_condition_fields['um_message_type'] = '';
if ( parseInt( props.attributes.um_message_type ) === 2 ) {
um_condition_fields['um_message_content'] = '';
} else {
um_condition_fields['um_message_content'] = 'um_block_settings_hide';
}
}
}
um_condition_fields = wp.hooks.applyFilters( 'um_admin_blocks_condition_fields', um_condition_fields, props );
return wp.element.createElement(
wp.element.Fragment,
{},
wp.element.createElement( BlockEdit, props ),
wp.element.createElement(
wp.blockEditor.InspectorControls,
{},
wp.element.createElement(
wp.components.PanelBody,
{
title: wp.i18n.__( 'Ultimate Member: Content Restriction', 'ultimate-member' ),
className: 'um_block_settings'
},
wp.element.createElement(
wp.components.ToggleControl,
{
label: wp.i18n.__( 'Restrict access?', 'ultimate-member' ),
checked: initialIsRestrict,
onChange: function onChange( value ) {
props.setAttributes( { um_is_restrict: value } );
if ( value === false ) {
um_condition_fields['um_who_access'] = 'um_block_settings_hide';
um_condition_fields['um_roles_access'] = 'um_block_settings_hide';
um_condition_fields['um_message_type'] = 'um_block_settings_hide';
um_condition_fields['um_message_content'] = 'um_block_settings_hide';
} else {
um_condition_fields['um_who_access'] = '';
}
um_condition_fields = wp.hooks.applyFilters( 'um_admin_blocks_condition_fields_on_change', um_condition_fields, 'um_is_restrict', value );
}
}
),
wp.element.createElement(
umSelectControl,
{
type: 'number',
className: um_condition_fields['um_who_access'],
label: wp.i18n.__( 'Who can access this block?', 'ultimate-member' ),
value: props.attributes.um_who_access,
options: [
{
label: wp.i18n.__( 'Everyone', 'ultimate-member' ),
value: 0
},
{
label: wp.i18n.__( 'Logged in users', 'ultimate-member' ),
value: 1
},
{
label: wp.i18n.__( 'Logged out users', 'ultimate-member' ),
value: 2
}
],
onChange: function onChange( value ) {
props.setAttributes( { um_who_access: value } );
if ( parseInt( value ) === 0 ) {
um_condition_fields['um_message_type'] = 'um_block_settings_hide';
um_condition_fields['um_message_content'] = 'um_block_settings_hide';
um_condition_fields['um_roles_access'] = 'um_block_settings_hide';
} else if ( parseInt( value ) === 1 ) {
um_condition_fields['um_message_type'] = '';
um_condition_fields['um_roles_access'] = '';
} else {
um_condition_fields['um_message_type'] = '';
um_condition_fields['um_roles_access'] = 'um_block_settings_hide';
}
um_condition_fields = wp.hooks.applyFilters( 'um_admin_blocks_condition_fields_on_change', um_condition_fields, 'um_who_access', value );
}
}
),
wp.element.createElement(
umSelectControl,
{
multiple: true,
className: um_condition_fields['um_roles_access'],
label: wp.i18n.__( 'What roles can access this block?', 'ultimate-member' ),
value: props.attributes.um_roles_access,
options: um_restrict_roles,
onChange: function onChange( value ) {
props.setAttributes( { um_roles_access: value } );
}
}
),
wp.element.createElement(
umSelectControl,
{
type: 'number',
className: um_condition_fields['um_message_type'],
label: wp.i18n.__( 'Restriction action', 'ultimate-member' ),
value: props.attributes.um_message_type,
options: [
{
label: wp.i18n.__( 'Hide block', 'ultimate-member' ),
value: 0
},
{
label: wp.i18n.__( 'Show global default message', 'ultimate-member' ),
value: 1
},
{
label: wp.i18n.__( 'Show custom message', 'ultimate-member' ),
value: 2
}
],
onChange: function onChange( value ) {
props.setAttributes( { um_message_type: value } );
if ( parseInt( value ) === 2 ) {
um_condition_fields['um_message_content'] = '';
} else {
um_condition_fields['um_message_content'] = 'um_block_settings_hide';
}
}
}
),
wp.element.createElement(
umTextareaControl,
{
type: 'number',
className: um_condition_fields['um_message_content'],
label: wp.i18n.__( 'Custom restricted access message', 'ultimate-member' ),
value: props.attributes.um_message_content,
onChange: function onChange( value ) {
props.setAttributes( { um_message_content: value } );
}
}
),
um_admin_blocks_custom_fields( um_condition_fields, props )
)
)
);
};
},
'um_block_restriction'
);
wp.hooks.addFilter( 'editor.BlockEdit', 'um-block/um_block_restriction', um_block_restriction );
@@ -1,45 +0,0 @@
/**
* This function updates the builder area with fields
*
* @returns {boolean}
*/
function um_admin_update_builder() {
var form_id = jQuery('.um-admin-builder').data('form_id');
jQuery('.tipsy').hide();
jQuery.ajax({
url: wp.ajax.settings.url,
type: 'POST',
data: {
action:'um_update_builder',
form_id: form_id,
nonce: um_admin_scripts.nonce
},
success: function( data ) {
jQuery('.um-admin-drag-ajax').html( data );
jQuery('.tipsy').hide();
/* trigger columns at start */
allow_update_via_col_click = false;
jQuery('.um-admin-drag-ctrls.columns a.active').each( function() {
jQuery(this).trigger('click');
}).promise().done( function(){
allow_update_via_col_click = true;
});
UM_Rows_Refresh();
},
error: function( data ) {
}
});
return false;
}
jQuery( document ).ready( function() {
if ( um_admin_builder_data.hide_footer ) {
jQuery('#wpfooter').hide();
}
});
@@ -1,467 +0,0 @@
if ( typeof (window.UM) !== 'object' ) {
window.UM = {};
}
if ( typeof (window.UM.admin) !== 'object' ) {
window.UM.admin = {};
}
UM.admin.builder = {
deleteProcess: [],
fieldsToDelete: [],
}
function UM_Drag_and_Drop() {
jQuery('.um-admin-drag-col,.um-admin-drag-group').sortable({
items: '.um-admin-drag-fld',
connectWith: '.um-admin-drag-col,.um-admin-drag-group',
placeholder: "um-fld-placeholder",
forcePlaceholderSize:true,
update: function(event, ui){
jQuery('#publish').attr('disabled','disabled');
if ( ui.item.hasClass('um-field-type-group') && ui.item.parents('.um-field-type-group').length > 0 ) {
jQuery('.um-admin-drag-col,.um-admin-drag-group').sortable('cancel');
jQuery('#publish').prop('disabled', false);
} else {
UM_Change_Field_Col();
UM_Change_Field_Grp();
UM_Rows_Refresh();
}
}
});
jQuery('.um-admin-drag-rowsubs').sortable({
items: '.um-admin-drag-rowsub',
placeholder: "um-rowsub-placeholder",
forcePlaceholderSize:true,
zIndex: 9999999999,
update: function(){
jQuery('#publish').attr('disabled','disabled');
UM_update_subrows();
UM_Rows_Refresh();
}
}).disableSelection();
jQuery('.um-admin-drag-rowsub').sortable({
items: '.um-admin-drag-col',
zIndex: 9999999999,
update: function(){
jQuery('#publish').attr('disabled','disabled');
row = jQuery(this);
row.find('.um-admin-drag-col').removeClass('cols-1 cols-2 cols-3 cols-last cols-middle');
row.find('.um-admin-drag-col').addClass('cols-' + row.find('.um-admin-drag-col').length );
row.find('.um-admin-drag-col:last').addClass('cols-last');
if ( row.find('.um-admin-drag-col').length == 3 ) {row.find('.um-admin-drag-col:eq(1)').addClass('cols-middle');}
UM_Change_Field_Col();
UM_Change_Field_Grp();
UM_Rows_Refresh();
}
}).disableSelection();
jQuery('.um-admin-drag-ajax').sortable({
items: '.um-admin-drag-row',
handle: ".um-admin-drag-row-start",
zIndex: 9999999999,
placeholder: "um-row-placeholder",
forcePlaceholderSize:true,
out: function(){
jQuery('.tipsy').remove();
},
update: function(){
jQuery('#publish').attr('disabled','disabled');
UM_update_rows();
UM_Change_Field_Col();
UM_Change_Field_Grp();
UM_Rows_Refresh();
}
}).disableSelection();
}
function UM_update_rows() {
var c = 0;
jQuery('a[data-remove_element="um-admin-drag-row"]').remove();
jQuery('.um-admin-drag-row').each(function(){
c++;
row = jQuery(this);
if ( c != 1 ) {
row.find('.um-admin-drag-row-icons').append( '<a href="#" class="um-admin-tipsy-n" title="Delete Row" data-remove_element="um-admin-drag-row"><i class="um-faicon-trash-o"></i></a>' );
}
});
}
function UM_update_subrows(){
jQuery('a[data-remove_element="um-admin-drag-rowsub"]').remove();
jQuery('.um-admin-drag-row').each(function(){
c = 0;
jQuery(this).find('.um-admin-drag-rowsub').each(function(){
c++;
row = jQuery(this);
if ( c != 1 ) {
row.find('.um-admin-drag-rowsub-icons').append('<a href="#" class="um-admin-tipsy-n" title="Delete Row" data-remove_element="um-admin-drag-rowsub"><i class="um-faicon-trash-o"></i></a>');
}
});
});
}
function UM_Change_Field_Col(){
jQuery('.um-admin-drag-col .um-admin-drag-fld').each(function(){
cols = jQuery(this).parents('.um-admin-drag-rowsub').find('.um-admin-drag-col').length;
col = jQuery(this).parents('.um-admin-drag-col');
if ( col.hasClass('cols-last') ) {
if ( cols == 1 ) {
saved_col = 1;
}
if ( cols == 3 ) {
saved_col = 3;
} else if ( cols == 2 ) {
saved_col = 2;
}
} else if ( col.hasClass('cols-middle') && cols == 3 ) {
saved_col = 2;
} else {
saved_col = 1;
}
jQuery(this).data('column', saved_col);
});
}
function UM_Change_Field_Grp(){
jQuery('.um-admin-drag-col .um-admin-drag-fld:not(.um-field-type-group)').each(function(){
if ( jQuery(this).parents('.um-admin-drag-group').length == 0 ){
jQuery(this).data('group', '');
} else {
jQuery(this).data('group', jQuery(this).parents('.um-admin-drag-fld.um-field-type-group').data('key') );
}
});
}
function UM_Rows_Refresh(){
jQuery('.um_update_order_fields').empty();
/* ROWS */
var c = 0;
jQuery('.um-admin-drag-row').each(function(){
c++;
row = jQuery(this);
col_num = '';
row.find('.um-admin-drag-rowsub').each(function(){
subrow = jQuery(this);
subrow.find('.um-admin-drag-col').removeClass('cols-1 cols-2 cols-3 cols-last cols-middle');
subrow.find('.um-admin-drag-col').addClass('cols-' + subrow.find('.um-admin-drag-col').length );
subrow.find('.um-admin-drag-col:last').addClass('cols-last');
if ( subrow.find('.um-admin-drag-col').length == 3 ) {subrow.find('.um-admin-drag-col:eq(1)').addClass('cols-middle');}
if ( !col_num ) {
col_num = subrow.find('.um-admin-drag-col').length;
} else {
col_num = col_num + ':' + subrow.find('.um-admin-drag-col').length;
}
});
jQuery('.um_update_order_fields').append('<input type="hidden" name="_um_rowcols_'+c+'_cols" id="_um_rowcols_'+c+'_cols" value="'+col_num+'" />');
sub_rows_count = row.find('.um-admin-drag-rowsub').length;
var origin_id = jQuery(this).attr('data-original');
jQuery('.um_update_order_fields').append('<input type="hidden" name="_um_row_'+c+'" id="_um_row_'+c+'" value="_um_row_'+c+'" />');
jQuery('.um_update_order_fields').append('<input type="hidden" name="_um_roworigin_'+c+'_val" id="_um_roworigin_'+c+'_val" value="'+origin_id+'" />');
jQuery('.um_update_order_fields').append('<input type="hidden" name="_um_rowsub_'+c+'_rows" id="_um_rowsub_'+c+'_rows" value="'+sub_rows_count+'" />');
jQuery(this).attr('data-original', '_um_row_'+c );
});
/* FIELDS */
var order;
order = 0;
jQuery('.um-admin-drag-col .um-admin-drag-fld').each(function(){
if ( !jQuery(this).hasClass('group') ) {
var group = jQuery(this).data('group');
if ( group != '' ) {
if ( jQuery('.um-admin-drag-fld.um-field-type-group.' + group ).find('.um-admin-drag-group').find( jQuery(this) ).length == 0 ) {
jQuery(this).appendTo( jQuery('.um-admin-drag-fld.um-field-type-group.' + group ).find('.um-admin-drag-group') );
} else {
//jQuery(this).prependTo( jQuery('.um-admin-drag-fld.um-field-type-group.' + group ).find('.um-admin-drag-group') );
}
jQuery('.um_update_order_fields').append('<input type="hidden" name="um_group_'+jQuery(this).data('key')+'" id="um_group_'+jQuery(this).data('key')+'" value="'+group+'" />');
} else {
jQuery('.um_update_order_fields').append('<input type="hidden" name="um_group_'+jQuery(this).data('key')+'" id="um_group_'+jQuery(this).data('key')+'" value="" />');
}
}
order++;
row = jQuery(this).parents('.um-admin-drag-row').index()+1;
row = '_um_row_'+row;
saved_col = jQuery(this).data('column');
if ( saved_col == 3 ){
jQuery(this).appendTo( jQuery(this).parents('.um-admin-drag-rowsub').find('.um-admin-drag-col:eq(2)') );
}
if ( saved_col == 2 ){
jQuery(this).appendTo( jQuery(this).parents('.um-admin-drag-rowsub').find('.um-admin-drag-col:eq(1)') );
}
sub_row = jQuery(this).parents('.um-admin-drag-rowsub').index();
jQuery('.um_update_order_fields').append('<input type="hidden" name="um_position_'+jQuery(this).data('key')+'" id="um_position_'+jQuery(this).data('key')+'" value="'+order+'" />');
jQuery('.um_update_order_fields').append('<input type="hidden" name="um_row_'+jQuery(this).data('key')+'" id="um_row_'+jQuery(this).data('key')+'" value="'+row+'" />');
jQuery('.um_update_order_fields').append('<input type="hidden" name="um_subrow_'+jQuery(this).data('key')+'" id="um_subrow_'+jQuery(this).data('key')+'" value="'+sub_row+'" />');
jQuery('.um_update_order_fields').append('<input type="hidden" name="um_col_'+jQuery(this).data('key')+'" id="um_col_'+jQuery(this).data('key')+'" value="'+saved_col+'" />');
});
UM_Drag_and_Drop();
UM_Add_Icon();
jQuery.ajax({
url: wp.ajax.settings.url,
type: 'POST',
data: jQuery( '.um_update_order' ).serialize(),
success: function(){
jQuery('#publish').prop('disabled', false);
}
});
}
function UM_Add_Icon(){
var add_icon_html = '<a href="#" class="um-admin-drag-add-field um-admin-tipsy-n" title="Add Field" data-modal="UM_fields" data-modal-size="normal" data-dynamic-content="um_admin_show_fields" data-arg2="'+jQuery('.um-admin-drag-ajax').data('form_id')+'" data-arg1=""><i class="um-icon-plus"></i></a>';
jQuery('.um-admin-drag-col').each(function(){
if ( jQuery(this).find('.um-admin-drag-add-field').length == 0 ) {
jQuery(this).append(add_icon_html);
} else {
jQuery(this).find('.um-admin-drag-add-field').remove();
jQuery(this).append(add_icon_html);
}
});
jQuery('.um-admin-drag-group').each(function(){
if ( jQuery(this).find('.um-admin-drag-add-field').length == 0 ) {
jQuery(this).append(add_icon_html);
} else {
jQuery(this).find('.um-admin-drag-add-field').remove();
jQuery(this).append(add_icon_html);
}
});
}
jQuery(document).ready(function() {
if ( !jQuery('.um-admin-drag').length ) {
return false;
}
UM_Drag_and_Drop();
/* add field to respected area */
jQuery( document.body ).on('click', 'a.um-admin-drag-add-field', function() {
in_row = jQuery(this).parents('.um-admin-drag-row').index();
in_sub_row = jQuery(this).parents('.um-admin-drag-rowsub').index();
if ( jQuery(this).parents('.um-admin-drag-rowsub').find('.um-admin-drag-col').length == 1 ) {
in_column = 1;
} else {
if ( jQuery(this).parents('.um-admin-drag-col').hasClass('cols-middle')){
in_column = 2;
} else if ( jQuery(this).parents('.um-admin-drag-col').hasClass('cols-last') ) {
if ( jQuery(this).parents('.um-admin-drag-rowsub').find('.um-admin-drag-col').length == 3 ) {
in_column = 3;
} else {
in_column = 2;
}
} else {
in_column = 1;
}
}
if ( jQuery(this).parents('.um-admin-drag-group').length ) {
in_group = jQuery(this).parents('.um-admin-drag-fld.um-field-type-group').data('key');
} else {
in_group = '';
}
jQuery('.um-col-demon-settings').data('in_row', in_row);
jQuery('.um-col-demon-settings').data('in_sub_row', in_sub_row);
jQuery('.um-col-demon-settings').data('in_column', in_column);
jQuery('.um-col-demon-settings').data('in_group', in_group);
});
/* add row */
jQuery(document.body).on('click', '*[data-row_action="add_row"]', function(){
var dragg = jQuery('.um-admin-drag-ajax');
dragg.append( '<div class="um-admin-drag-row">' + jQuery('.um-col-demon-row').html() + '</div>' );
dragg.find('.um-admin-drag-row:last').find('.um-admin-drag-row-icons').find('a.um-admin-drag-row-edit').attr('data-arg3', '_um_row_' + ( dragg.find('.um-admin-drag-row').length ) );
dragg.find('.um-admin-drag-row:last').attr('data-original', '_um_row_' + ( dragg.find('.um-admin-drag-row').length ) );
UM_update_rows();
UM_update_subrows();
UM_Rows_Refresh();
});
/* add sub row */
jQuery(document.body).on('click', '*[data-row_action="add_subrow"]', function(){
var dragg = jQuery(this).parents('.um-admin-drag-row').find('.um-admin-drag-rowsubs');
dragg.append( '<div class="um-admin-drag-rowsub">' + jQuery('.um-col-demon-subrow').html() + '</div>' );
UM_update_subrows();
UM_Rows_Refresh();
});
/* remove element: Row, Subrow */
jQuery(document.body).on('click', 'a[data-remove_element^="um-"]',function(){
let deleteButton = jQuery(this);
let element = jQuery(this).data('remove_element');
let loadingWrapper = jQuery(this).parents('.' + element ).children('.um-admin-row-loading');
let row = jQuery(this).parents('.um-admin-drag-row').index();
let subrow = jQuery(this).parents('.um-admin-drag-rowsub').index();
let fieldPosition= {row,subrow};
let deleteExists= false;
jQuery.each( UM.admin.builder.deleteProcess, function(i) {
if ( fieldPosition.row === UM.admin.builder.deleteProcess[i].row && fieldPosition.subrow === UM.admin.builder.deleteProcess[i].subrow ) {
deleteExists = true;
return false;
}
});
if ( deleteExists ) {
return;
}
loadingWrapper.show();
UM.admin.builder.deleteProcess.push({row,subrow});
UM.admin.builder.fieldsToDelete = jQuery(this).parents('.' +element).find('.um-admin-drag-fld').toArray();
if ( UM.admin.builder.fieldsToDelete.length > 0 ) {
um_builder_delete_field_ajax( function () {
deleteButton.parents('.' +element).remove();
jQuery('.tipsy').remove();
UM_Rows_Refresh();
jQuery.each( UM.admin.builder.deleteProcess, function(i) {
if ( fieldPosition.row === UM.admin.builder.deleteProcess[i].row && fieldPosition.subrow === UM.admin.builder.deleteProcess[i].subrow ) {
UM.admin.builder.deleteProcess.splice(i, 1);
return false;
}
});
loadingWrapper.hide();
} );
} else {
jQuery(this).parents('.' +element).remove();
jQuery('.tipsy').remove();
UM_Rows_Refresh();
jQuery.each( UM.admin.builder.deleteProcess, function(i) {
if ( fieldPosition.row === UM.admin.builder.deleteProcess[i].row && fieldPosition.subrow === UM.admin.builder.deleteProcess[i].subrow ) {
UM.admin.builder.deleteProcess.splice(i, 1);
return false;
}
});
loadingWrapper.hide();
}
});
/* dynamically change columns */
jQuery(document.body).on('click', '.um-admin-drag-ctrls.columns a', function(){
var row = jQuery(this).parents('.um-admin-drag-rowsub');
var tab = jQuery(this);
var tabs = jQuery(this).parent();
tabs.find('a').removeClass('active');
tab.addClass('active');
var existing_cols = row.find('.um-admin-drag-col').length;
var required_cols = tab.data('cols');
var needed_cols = required_cols - existing_cols;
if ( needed_cols > 0 ) {
for (i = 0; i < needed_cols; i++){
row.find('.um-admin-drag-col-dynamic').append('<div class="um-admin-drag-col"></div>');
}
row.find('.um-admin-drag-col').removeClass('cols-1 cols-2 cols-3 cols-last cols-middle');
row.find('.um-admin-drag-col').addClass('cols-' + row.find('.um-admin-drag-col').length );
row.find('.um-admin-drag-col:last').addClass('cols-last');
if ( row.find('.um-admin-drag-col').length == 3 ) {row.find('.um-admin-drag-col:eq(1)').addClass('cols-middle');}
} else if ( needed_cols < 0 ) {
needed_cols = needed_cols + 3;
if ( needed_cols == 2 ) {
row.find('.um-admin-drag-col:first').append( row.find('.um-admin-drag-col.cols-last').html() );
row.find('.um-admin-drag-col.cols-last').remove();
}
if ( needed_cols == 1 ) {
row.find('.um-admin-drag-col:first').append( row.find('.um-admin-drag-col.cols-last').html() );
row.find('.um-admin-drag-col:first').append( row.find('.um-admin-drag-col.cols-middle').html() );
row.find('.um-admin-drag-col.cols-last').remove();
row.find('.um-admin-drag-col.cols-middle').remove();
}
row.find('.um-admin-drag-col').removeClass('cols-1 cols-2 cols-3 cols-last cols-middle');
row.find('.um-admin-drag-col').addClass('cols-' + row.find('.um-admin-drag-col:visible').length );
row.find('.um-admin-drag-col:last').addClass('cols-last');
}
if ( allow_update_via_col_click == true ) {
UM_Change_Field_Col();
UM_Rows_Refresh();
}
});
/* trigger columns at start */
allow_update_via_col_click = false;
jQuery('.um-admin-drag-ctrls.columns a.active').each(function(){
jQuery(this).trigger('click');
}).promise().done( function(){ allow_update_via_col_click = true; } );
UM_Rows_Refresh();
});
-109
View File
@@ -1,109 +0,0 @@
jQuery(document).ready(function() {
/* Remove field permanently */
jQuery(document.body).on('click', '.um-admin-btns a span.remove', function(e){
e.preventDefault();
if ( confirm( wp.i18n.__( 'This will permanently delete this custom field from a database and from all forms on your site. Are you sure?', 'ultimate-member' ) ) ) {
jQuery(this).parents('a').remove();
var arg1 = jQuery(this).parents('a').data('arg1');
jQuery.ajax({
url: wp.ajax.settings.url,
type: 'POST',
data: {
action:'um_do_ajax_action',
act_id : 'um_admin_remove_field_global',
arg1 : arg1,
nonce: um_admin_scripts.nonce
},
success: function(data) {
jQuery('#um-admin-form-builder .' + arg1).remove();
},
error: function(data) {
}
});
}
return false;
});
/* Add a Field */
jQuery(document.body).on('submit', 'form.um_add_field', function(e){
e.preventDefault();
var conditions = jQuery('.um-admin-cur-condition');
//need fields refactor
jQuery(conditions).each( function ( i ) {
if ( jQuery( this ).find('[id^="_conditional_action"]').val() === '' ||
jQuery( this ).find('[id^="_conditional_field"]').val() === '' ||
jQuery( this ).find('[id^="_conditional_operator"]').val() ==='' )
{
jQuery(conditions[i]).find('.um-admin-remove-condition').trigger('click');
}
} );
conditions = jQuery('.um-admin-cur-condition');
jQuery(conditions).each( function ( i ) {
var id = i === 0 ? '' : i;
jQuery( this ).find('[id^="_conditional_action"]').attr('name', '_conditional_action' + id);
jQuery( this ).find('[id^="_conditional_action"]').attr('id', '_conditional_action' + id);
jQuery( this ).find('[id^="_conditional_field"]').attr('name', '_conditional_field' + id);
jQuery( this ).find('[id^="_conditional_field"]').attr('id', '_conditional_field' + id);
jQuery( this ).find('[id^="_conditional_operator"]').attr('name', '_conditional_operator' + id);
jQuery( this ).find('[id^="_conditional_operator"]').attr('id', '_conditional_operator' + id);
jQuery( this ).find('[id^="_conditional_value"]').attr('name', '_conditional_value' + id);
jQuery( this ).find('[id^="_conditional_value"]').attr('id', '_conditional_value' + id);
} );
var form = jQuery(this);
jQuery.ajax({
url: wp.ajax.settings.url,
type: 'POST',
dataType: 'json',
data: form.serialize(),
beforeSend: function(){
form.css({'opacity': 0.5});
jQuery('.um-admin-error').removeClass('um-admin-error');
form.find('.um-admin-error-block').hide();
form.find('.um-admin-success-block').hide();
},
complete: function(){
form.css({'opacity': 1});
},
success: function( response ){
if ( response.success ) {
let data = response.data;
if ( data.error ) {
let c = 0;
jQuery.each( data.error, function(i, v){
c++;
if ( 1 === c ) {
form.find('#' + i).addClass('um-admin-error').trigger('focus');
form.find('.um-admin-error-block').show().html(v);
}
});
um_admin_modal_responsive();
} else {
jQuery('.um-col-demon-settings').data('in_row', '').data('in_sub_row', '').data('in_column', '').data('in_group', '');
jQuery('.tipsy').hide();
um_admin_remove_modal();
um_admin_update_builder();
}
} else {
console.log( response );
}
},
error: function( response ){
console.log( response );
}
});
return false;
});
});
-32
View File
@@ -1,32 +0,0 @@
function um_form_select_tab( tab, set_val ) {
var mode_block = jQuery('input#form__um_mode');
tab.parents('.um-admin-boxed-links').find('a').removeClass('um-admin-activebg');
tab.addClass('um-admin-activebg');
jQuery('.um-admin div#side-sortables').show();
jQuery('div[id^="um-admin-form"]').hide();
jQuery('#submitdiv').show();
jQuery('div#um-admin-form-mode,div#um-admin-form-title,div#um-admin-form-builder,div#um-admin-form-shortcode').show();
jQuery('div[id^="um-admin-form-' + tab.data('role') + '"]').show();
if ( set_val ) {
mode_block.val( tab.data('role') );
}
jQuery('.empty-container').css({'border' : 'none'});
jQuery('.um-admin-builder').removeClass().addClass( 'um-admin-builder ' + mode_block.val() );
}
jQuery(document).ready(function() {
/* Default form tab */
if ( jQuery('.um-admin-boxed-links').length > 0 ) {
var tab = jQuery('.um-admin-boxed-links a[data-role="'+jQuery('input#form__um_mode').val()+'"]');
um_form_select_tab( tab, false );
}
/* Creating new form button */
jQuery('.um-admin-boxed-links:not(.is-core-form) a').on( 'click', function() {
um_form_select_tab( jQuery(this), true );
});
});
File diff suppressed because it is too large Load Diff
@@ -1,64 +0,0 @@
jQuery(document).ready(function() {
jQuery(document.body).on('click', '#um_add_review_love', function (e) {
jQuery(this).parents('#um_start_review_notice').hide();
jQuery('.um_hidden_notice[data-key="love"]').show();
});
jQuery(document.body).on('click', '#um_add_review_good', function (e) {
jQuery(this).parents('#um_start_review_notice').hide();
jQuery('.um_hidden_notice[data-key="good"]').show();
});
jQuery(document.body).on('click', '#um_add_review_bad', function (e) {
jQuery(this).parents('#um_start_review_notice').hide();
jQuery('.um_hidden_notice[data-key="bad"]').show();
});
jQuery(document.body).on('click', '.um_review_link', function (e) {
jQuery(this).parents('.um-admin-notice').find( '.notice-dismiss' ).trigger('click');
});
jQuery(document.body).on('click', '.um_secondary_dimiss', function (e) {
jQuery(this).parents('.um-admin-notice').find( '.notice-dismiss' ).trigger('click');
});
jQuery(document.body).on( 'click', '.um-admin-notice.is-dismissible .notice-dismiss', function(e) {
var notice_key = jQuery(this).parents('.um-admin-notice').data('key');
wp.ajax.send( 'um_dismiss_notice', {
data: {
key: notice_key,
nonce: um_admin_scripts.nonce
},
success: function( data ) {
return true;
},
error: function( data ) {
um_admin_dismiss_notice_fallback( notice_key );
return false;
}
});
});
});
/**
* Dismiss fallback of ajax request
*/
function um_admin_dismiss_notice_fallback( notice_key ) {
var href_index = "";
if ( window.location.href.indexOf("?") > -1 ) {
href_index = window.location.href + "&";
} else {
href_index = window.location.href + "?";
}
window.location.href = href_index + "um_dismiss_notice=" + notice_key + "&um_admin_nonce=" + um_admin_scripts.nonce;
}
-479
View File
@@ -1,479 +0,0 @@
var $um_tiny_editor = {};
function um_admin_live_update_scripts() {
jQuery('.um-adm-conditional').each( function() {
jQuery(this).trigger('change');
});
if ( jQuery('.um-admin-colorpicker').length ) {
jQuery('.um-admin-colorpicker').wpColorPicker();
}
}
function um_admin_new_modal( id, ajax, size ) {
var modal = jQuery('body').find('.um-admin-overlay');
jQuery('.tipsy').hide();
um_admin_remove_modal();
jQuery('body').addClass('um-admin-modal-open').append('<div class="um-admin-overlay"></div><div class="um-admin-modal"></div>');
jQuery('#' + id).prependTo('.um-admin-modal');
jQuery('#' + id).show();
jQuery('.um-admin-modal').show();
jQuery('.um-admin-modal-head').append('<a href="javascript:void(0);" data-action="UM_remove_modal" class="um-admin-modal-close"><i class="um-faicon-times"></i></a>');
if ( ajax == true ) {
um_admin_modal_size( size );
um_admin_modal_preload();
um_admin_modal_responsive();
} else {
um_admin_modal_responsive();
}
}
function um_tinymce_init( id, content ) {
var object = jQuery('#' + id);
if ( typeof( tinyMCE ) === 'object' && tinyMCE.get( id ) !== null ) {
tinyMCE.triggerSave();
tinyMCE.EditorManager.execCommand( 'mceRemoveEditor', true, id );
"4" === tinyMCE.majorVersion ? window.tinyMCE.execCommand( "mceRemoveEditor", !0, id ) : window.tinyMCE.execCommand( "mceRemoveControl", !0, id );
$um_tiny_editor = jQuery('<div>').append( object.parents( '#wp-' + id + '-wrap' ).clone() );
object.parents('#wp-' + id + '-wrap').replaceWith('<div class="um_tiny_placeholder"></div>');
jQuery('.um-admin-editor:visible').html( jQuery( $um_tiny_editor ).html() );
var init;
if( typeof tinyMCEPreInit.mceInit[ id ] == 'undefined' ){
init = tinyMCEPreInit.mceInit[ id ] = tinyMCE.extend( {}, tinyMCEPreInit.mceInit[ id ] );
} else {
init = tinyMCEPreInit.mceInit[ id ];
}
if ( typeof(QTags) == 'function' ) {
QTags( tinyMCEPreInit.qtInit[ id ] );
QTags._buttonsInit();
}
if ( typeof( window.switchEditors ) === 'object' ) {
window.switchEditors.go( id );
}
tinyMCE.init( init );
tinyMCE.get( id ).setContent( content );
object.html( content );
} else {
$um_tiny_editor = jQuery('<div>').append( object.parents('#wp-' + id + '-wrap').clone() );
object.parents('#wp-' + id + '-wrap').replaceWith('<div class="um_tiny_placeholder"></div>');
jQuery('.um-admin-editor:visible').html( jQuery( $um_tiny_editor ).html() );
if ( typeof(QTags) == 'function' ) {
QTags( tinyMCEPreInit.qtInit[ id ] );
QTags._buttonsInit();
}
//use duplicate because it's new element
jQuery('#' + id).html( content );
}
jQuery( 'body' ).on( 'click', '.wp-switch-editor', function() {
var target = jQuery(this);
if ( target.hasClass( 'wp-switch-editor' ) && typeof( window.switchEditors ) === 'object' ) {
var mode = target.hasClass( 'switch-tmce' ) ? 'tmce' : 'html';
window.switchEditors.go( id, mode );
}
});
}
function um_admin_modal_ajaxcall( act_id, arg1, arg2, arg3 ) {
in_row = '';
in_sub_row = '';
in_column = '';
in_group = '';
if ( jQuery('.um-col-demon-settings').data('in_column') ) {
in_row = jQuery('.um-col-demon-settings').data('in_row');
in_sub_row = jQuery('.um-col-demon-settings').data('in_sub_row');
in_column = jQuery('.um-col-demon-settings').data('in_column');
in_group = jQuery('.um-col-demon-settings').data('in_group');
}
var form_mode = jQuery('input[type=hidden][id=form__um_mode]').val();
jQuery.ajax({
url: wp.ajax.settings.url,
type: 'POST',
data: {
action:'um_dynamic_modal_content',
act_id: act_id,
arg1 : arg1,
arg2 : arg2,
arg3: arg3,
in_row: in_row,
in_sub_row: in_sub_row,
in_column: in_column,
in_group: in_group,
nonce: um_admin_scripts.nonce,
form_mode: form_mode
},
complete: function(){
um_admin_modal_loaded();
um_admin_modal_responsive();
},
success: function(data) {
jQuery('.um-admin-modal').find('.um-admin-modal-body').html( data );
um_responsive();
um_admin_live_update_scripts();
jQuery( "#_custom_dropdown_options_source" ).trigger('blur');
if ( jQuery('.um-admin-editor:visible').length > 0 ) {
if ( act_id == 'um_admin_edit_field_popup' ) {
um_tinymce_init( 'um_editor_edit', jQuery('.um-admin-modal:visible .dynamic-mce-content').html() );
} else {
um_tinymce_init( 'um_editor_new', '' );
}
}
if ( act_id === 'um_admin_preview_form' ) {
//fix for overlay in scrollable preview modal
jQuery('.um-admin-preview-overlay').css('height', jQuery('.um-admin-preview-overlay').siblings('.um').outerHeight(true)*1 + 20 + 'px' );
}
um_init_tooltips();
um_admin_init_datetimepicker();
},
error: function(data) {
}
});
return false;
}
function um_admin_modal_responsive() {
var required_margin = jQuery('.um-admin-modal:visible').innerHeight() / 2 + 'px';
jQuery('.um-admin-modal:visible').css({'margin-top': '-' + required_margin });
if ( jQuery('#UM_preview_form .um-s1').length ) {
jQuery("#UM_preview_form .um-s1").select2({
allowClear: true
});
}
if ( jQuery('#UM_preview_form .um-s2').length ) {
jQuery("#UM_preview_form .um-s2").select2({
allowClear: false,
minimumResultsForSearch: 10
});
}
}
function um_admin_remove_modal() {
if ( jQuery('.um-admin-editor:visible').length > 0 ) {
tinyMCE.triggerSave();
if ( jQuery('.um-admin-modal:visible').find('form').parent().attr('id') == 'UM_edit_field' ) {
jQuery('#wp-um_editor_edit-wrap').remove();
/*tinyMCE.execCommand('mceRemoveEditor', true, 'um_editor_edit');
jQuery('.um-hidden-editor-edit').html( jQuery('.um-admin-editor:visible').contents() );
tinyMCE.execCommand('mceAddEditor', true, 'um_editor_edit');*/
} else {
jQuery('#wp-um_editor_new-wrap').remove();
/*tinyMCE.execCommand('mceRemoveEditor', true, 'um_editor_new');
jQuery('.um-hidden-editor-new').html( jQuery('.um-admin-editor:visible').contents() );
tinyMCE.execCommand('mceAddEditor', true, 'um_editor_new');*/
}
jQuery('.um_tiny_placeholder').replaceWith( jQuery( $um_tiny_editor ).html() );
}
if ( 'undefined' !== typeof window.UM.admin.allTooltips && window.UM.admin.allTooltips.length > 0 && 'function' === typeof window.UM.admin.allTooltips.tooltip ) {
window.UM.admin.allTooltips.tooltip('close');
}
jQuery('.tipsy').hide();
jQuery('body').removeClass('um-admin-modal-open');
jQuery('.um-admin-modal div[id^="UM_"]').hide().appendTo('body');
jQuery('.um-admin-modal,.um-admin-overlay').remove();
}
function um_admin_modal_preload() {
jQuery('.um-admin-modal:visible').addClass('loading');
jQuery('.um-admin-modal-body:visible').empty();
}
function um_admin_modal_loaded() {
jQuery('.um-admin-modal:visible').removeClass('loading');
}
function um_admin_modal_size( aclass ) {
jQuery('.um-admin-modal:visible').addClass(aclass);
}
function um_admin_modal_add_attr( id, value ) {
jQuery('.um-admin-modal:visible').data( id, value );
}
/**
Custom modal scripting starts
**/
jQuery(document).ready(function() {
/**
disable link
**/
jQuery(document.body).on('click', '.um-admin-builder a, .um-admin-modal a:not(.um-preview-upload)', function(e){
e.preventDefault();
return false;
});
/**
toggle area
**/
jQuery(document.body).on('click', '.um-admin-btn-toggle a', function(e){
var content = jQuery(this).parent().find('.um-admin-btn-content');
var link = jQuery(this);
if ( content.is(':hidden') ) {
content.show();
link.find('i').removeClass().addClass('um-icon-minus');
link.addClass('active');
} else {
content.hide();
link.find('i').removeClass().addClass('um-icon-plus');
link.removeClass('active');
}
um_admin_modal_responsive();
});
/**
clone a condition
**/
jQuery(document.body).on('click', '.um-admin-new-condition', function() {
if ( jQuery(this).hasClass('disabled') )
return false;
var content = jQuery(this).parents('.um-admin-btn-content'),
length = content.find('.um-admin-cur-condition').length;
if ( length < 5 ) {
//content.find('select').select2('destroy');
var template = jQuery('.um-admin-btn-content').find('.um-admin-cur-condition-template').clone();
template.find('input[type=text]').val('');
template.find('select').val('');
template.appendTo( content );
jQuery(template).removeClass("um-admin-cur-condition-template");
jQuery(template).addClass("um-admin-cur-condition");
um_admin_live_update_scripts();
um_admin_modal_responsive();
} else {
jQuery(this).addClass('disabled');
alert( 'You already have 5 rules' );
}
//need fields refactor
var conditions = jQuery('.um-admin-cur-condition');
jQuery(conditions).each( function ( i ) {
id = i === 0 ? '' : i;
jQuery( this ).find('[id^="_conditional_action"]').attr('name', '_conditional_action' + id);
jQuery( this ).find('[id^="_conditional_action"]').attr('id', '_conditional_action' + id);
jQuery( this ).find('[id^="_conditional_field"]').attr('name', '_conditional_field' + id);
jQuery( this ).find('[id^="_conditional_field"]').attr('id', '_conditional_field' + id);
jQuery( this ).find('[id^="_conditional_operator"]').attr('name', '_conditional_operator' + id);
jQuery( this ).find('[id^="_conditional_operator"]').attr('id', '_conditional_operator' + id);
jQuery( this ).find('[id^="_conditional_value"]').attr('name', '_conditional_value' + id);
jQuery( this ).find('[id^="_conditional_value"]').attr('id', '_conditional_value' + id);
} );
});
/**
reset conditions
**/
jQuery(document.body).on('click', '.um-admin-reset-conditions a', function(){
var content = jQuery(this).parents('.um-admin-btn-content');
content.find('.um-admin-cur-condition').slice(1).remove();
content.find('input[type=text]').val('');
content.find('select').val('');
jQuery('.um-admin-new-condition').removeClass('disabled');
um_admin_live_update_scripts();
um_admin_modal_responsive();
});
/**
remove a condition
**/
jQuery(document.body).on('click', '.um-admin-remove-condition', function(){
var condition = jQuery(this).parents('.um-admin-cur-condition');
jQuery('.um-admin-new-condition').removeClass('disabled');
jQuery('.tipsy').remove();
condition.remove();
//need fields refactor
var conditions = jQuery('.um-admin-cur-condition');
jQuery(conditions).each( function ( i ) {
id = i === 0 ? '' : i;
jQuery( this ).find('[id^="_conditional_action"]').attr('name', '_conditional_action' + id);
jQuery( this ).find('[id^="_conditional_action"]').attr('id', '_conditional_action' + id);
jQuery( this ).find('[id^="_conditional_field"]').attr('name', '_conditional_field' + id);
jQuery( this ).find('[id^="_conditional_field"]').attr('id', '_conditional_field' + id);
jQuery( this ).find('[id^="_conditional_operator"]').attr('name', '_conditional_operator' + id);
jQuery( this ).find('[id^="_conditional_operator"]').attr('id', '_conditional_operator' + id);
jQuery( this ).find('[id^="_conditional_value"]').attr('name', '_conditional_value' + id);
jQuery( this ).find('[id^="_conditional_value"]').attr('id', '_conditional_value' + id);
} );
um_admin_live_update_scripts();
um_admin_modal_responsive();
});
/**
remove modal via action
**/
jQuery(document.body).on('click', '.um-admin-overlay, a[data-action="UM_remove_modal"]', function(){
jQuery('.tipsy').hide();
um_admin_remove_modal();
});
/**
fire new modal
**/
jQuery(document.body).on('click', 'a[data-modal^="UM_"], span[data-modal^="UM_"]', function(e){
e.preventDefault();
var modal_id = jQuery(this).attr('data-modal');
if ( jQuery(this).attr('data-back') ) {
jQuery('#UM_fonticons').find('a.um-admin-modal-back').attr("data-modal", jQuery(this).attr('data-back') );
var current_icon = jQuery( '#' + jQuery(this).attr('data-back') ).find('input#_icon').val();
if ( current_icon == '' ) {
jQuery('#UM_fonticons').find('.um-admin-icons span').removeClass('highlighted');
}
}
if ( jQuery(this).data('dynamic-content') ) {
um_admin_new_modal( modal_id, true, jQuery(this).data('modal-size') );
um_admin_modal_ajaxcall( jQuery(this).data('dynamic-content'), jQuery(this).data('arg1'), jQuery(this).data('arg2'), jQuery(this).data('arg3') );
} else {
um_admin_new_modal( modal_id );
}
return false;
});
/**
choose font icon
**/
jQuery(document.body).on('click', '.um-admin-icons span', function(){
var icon = jQuery(this).attr('data-code');
jQuery(this).parent().find('span').removeClass('highlighted');
jQuery(this).addClass('highlighted');
jQuery('#UM_fonticons').find('a.um-admin-modal-back').attr("data-code", icon);
});
/**
submit font icon
**/
jQuery(document.body).on('click', '#UM_fonticons a.um-admin-modal-back:not(.um-admin-modal-cancel)', function(){
var v_id = '';
var icon_selected = jQuery(this).attr('data-code');
if ( icon_selected != '' ) {
if ( jQuery(this).attr('data-modal') ) {
v_id = '#' + jQuery(this).attr('data-modal');
} else {
v_id = '.postbox';
}
jQuery( v_id ).find('input#_icon,input#_um_icon,input#notice__um_icon,input#um_profile_tab__icon').val( icon_selected );
jQuery( v_id ).find('span.um-admin-icon-value').html('<i class="'+icon_selected+'"></i>');
jQuery( v_id ).find('.um-admin-icon-clear').show();
}
jQuery(this).attr('data-code', '');
if ( v_id == '.postbox' ) {
jQuery('.tipsy').hide();
um_admin_remove_modal();
}
});
/**
restore font icon
**/
jQuery(document.body).on('click', 'span.um-admin-icon-clear', function(){
var element = jQuery(this).parents('p');
jQuery('#UM_fonticons a.um-admin-modal-back').attr('data-code', '');
element.find('input[type="hidden"]').val('');
element.find('.um-admin-icon-value').html( wp.i18n.__( 'No Icon', 'ultimate-member' ) );
element = jQuery(this).parents('td');
element.find('input[type="hidden"]').val('');
element.find('.um-admin-icon-value').html( wp.i18n.__( 'No Icon', 'ultimate-member' ) );
jQuery(this).hide();
});
/**
search font icons
**/
jQuery(document.body).on('keyup blur', '#_icon_search', function(){
if ( jQuery(this).val().toLowerCase() !== '' ) {
jQuery('.um-admin-icons span').hide();
jQuery('.um-admin-icons span[data-code*="'+jQuery(this).val().toLowerCase()+'"]').show();
} else {
jQuery('.um-admin-icons span:hidden').show();
}
um_admin_modal_responsive();
});
/**
* Retrieve options from a callback function
*/
jQuery(document.body).on('blur',"#_custom_dropdown_options_source", function(){
var me = jQuery(this);
var _options = jQuery('textarea[id=_options]');
if( me.val() != '' ){
var um_option_callback = me.val();
jQuery.ajax({
url: wp.ajax.settings.url,
type: 'POST',
data: {
action:'um_populate_dropdown_options',
um_option_callback: um_option_callback,
nonce: um_admin_scripts.nonce
},
complete: function(){
},
success: function( response ){
var arr_opts = [];
for (var key in response.data ){
arr_opts.push( response.data[ key ] );
}
_options.val( arr_opts.join('\n') );
}
});
}
});
}); // end jQuery(document).ready
@@ -1,36 +0,0 @@
jQuery(document).ready(function ($) {
var template = wp.template( 'um-nav-menus-fields' );
$( document ).on( 'menu-item-added', function ( e, $menuMarkup ) {
var id = $( $menuMarkup ).attr('id').substr(10);
var template_content = template({
menuItemID: id,
restriction_data:{
um_nav_public:0,
um_nav_roles:[]
}
});
if ( $( $menuMarkup ).find( 'fieldset.field-move' ).length > 0 ) {
$( $menuMarkup ).find( 'fieldset.field-move' ).before( template_content );
} else {
$( $menuMarkup ).find( '.menu-item-actions' ).before( template_content );
}
});
$( 'ul#menu-to-edit > li' ).each( function(){
var id = $(this).attr('id').substr(10);
var template_content = template({
menuItemID: id,
restriction_data: um_menu_restriction_data[ id ]
});
if ( $( this ).find( 'fieldset.field-move' ).length > 0 ) {
$( this ).find( 'fieldset.field-move' ).before( template_content );
} else {
$( this ).find( '.menu-item-actions' ).before( template_content );
}
});
});
@@ -1,42 +0,0 @@
jQuery( document ).ready( function() {
jQuery( '#role' ).on('change', function() {
if ( typeof um_roles == 'object' ) {
um_roles = Object.keys( um_roles ).map(function( key ) { return um_roles[ key ]; });
}
if ( jQuery.inArray( jQuery(this).val().substr(3), um_roles ) !== -1 ) {
jQuery( '#um_role_selector_wrapper' ).hide();
jQuery( '#um-role' ).val('');
var hide = wp.hooks.applyFilters( 'um_user_screen_block_hiding', true );
if ( hide ) {
jQuery( '#um_user_screen_block' ).hide();
}
} else {
jQuery( '#um_role_selector_wrapper' ).show();
jQuery( '#um_user_screen_block' ).show();
}
}).trigger('change');
jQuery( '#adduser-role' ).on('change', function() {
if ( typeof um_roles == 'object' ) {
um_roles = Object.keys( um_roles ).map(function( key ) { return um_roles[ key ]; });
}
if ( jQuery.inArray( jQuery(this).val().substr(3), um_roles ) !== -1 ) {
jQuery( '#um_role_existing_selector_wrapper' ).hide();
jQuery( '#um-role' ).val('');
var hide = wp.hooks.applyFilters( 'um_user_screen_block_hiding', true );
if ( hide ) {
jQuery( '#um_user_screen_block' ).hide();
}
} else {
jQuery( '#um_role_existing_selector_wrapper' ).show();
jQuery( '#um_user_screen_block' ).show();
}
}).trigger('change');
});
@@ -1,286 +0,0 @@
if ( typeof (window.UM) !== 'object' ) {
window.UM = {};
}
if ( typeof (window.UM.admin) !== 'object' ) {
window.UM.admin = {};
}
function um_admin_init_datetimepicker() {
jQuery('.um-datepicker:not(.picker__input)').each(function(){
elem = jQuery(this);
if ( typeof elem.attr('data-disabled_weekdays') != 'undefined' && elem.attr('data-disabled_weekdays') != '' ) {
var disable = JSON.parse( elem.attr('data-disabled_weekdays') );
} else {
var disable = false;
}
var years_n = null;
if ( typeof elem.attr('data-years') != 'undefined' ) {
years_n = elem.attr('data-years');
}
var minRange = elem.attr('data-date_min');
var maxRange = elem.attr('data-date_max');
var minSplit = [], maxSplit = [];
if ( typeof minRange != 'undefined' ) {
minSplit = minRange.split(",");
}
if ( typeof maxRange != 'undefined' ) {
maxSplit = maxRange.split(",");
}
var min = minSplit.length ? new Date(minSplit) : null;
var max = minSplit.length ? new Date(maxSplit) : null;
// fix min date for safari
if ( min && min.toString() == 'Invalid Date' && minSplit.length == 3 ) {
var minDateString = minSplit[1] + '/' + minSplit[2] + '/' + minSplit[0];
min = new Date(Date.parse(minDateString));
}
// fix max date for safari
if ( max && max.toString() == 'Invalid Date' && maxSplit.length == 3 ) {
var maxDateString = maxSplit[1] + '/' + maxSplit[2] + '/' + maxSplit[0];
max = new Date(Date.parse(maxDateString));
}
var data = {
disable: disable,
format: elem.attr( 'data-format' ),
formatSubmit: 'yyyy/mm/dd',
hiddenName: true,
onOpen: function() { elem.blur(); },
onClose: function() { elem.blur(); }
};
if ( years_n !== null ) {
data.selectYears = years_n;
}
if ( min !== null ) {
data.min = min;
}
if ( max !== null ) {
data.max = max;
}
elem.pickadate( data );
});
jQuery('.um-timepicker:not(.picker__input)').each(function(){
elem = jQuery(this);
elem.pickatime({
format: elem.attr('data-format'),
interval: parseInt( elem.attr('data-intervals') ),
formatSubmit: 'HH:i',
hiddenName: true,
onOpen: function() { elem.blur(); },
onClose: function() { elem.blur(); }
});
});
}
function um_init_tooltips() {
if ( jQuery( '.um_tooltip' ).length > 0 ) {
window.UM.admin.allTooltips = jQuery( '.um_tooltip' ).tooltip({
tooltipClass: "um_tooltip",
content: function () {
return jQuery( this ).attr( 'title' );
}
});
}
}
jQuery(document).ready(function() {
/**
clone a field dropdown
**/
jQuery(document.body).on('click', '.um-admin-clone', function(e){
e.preventDefault();
var container = jQuery(this).parents('.um-admin-field');
var parent = jQuery(this).parents('p').find('.um-admin-field:last-child');
container.find('select').select2('destroy');
var cloned = container.clone();
cloned.find('.um-admin-clone').replaceWith('<a href="#" class="um-admin-clone-remove button um-admin-tipsy-n" title="Remove Field"><i class="um-icon-close" style="margin-right:0!important"></i></a>');
cloned.insertAfter( parent );
cloned.find('select').val('');
jQuery('.um-admin-field select').select2({
allowClear: true,
minimumResultsForSearch: 10
});
return false;
});
/**
remove a field dropdown
**/
jQuery(document.body).on('click', '.um-admin-clone-remove', function(e){
e.preventDefault();
var container = jQuery(this).parents('.um-admin-field');
jQuery('.tipsy').remove();
container.remove();
jQuery('.um-admin-field select').select2({
allowClear: true,
minimumResultsForSearch: 10
});
return false;
});
/**
Ajax link
**/
jQuery('.um-admin-ajaxlink').on('click', function(e){
e.preventDefault();
return false;
});
/**
On/Off Buttons
**/
jQuery(document.body).on('click', '.um-admin-yesno span.btn', function(){
if (!jQuery(this).parents('p').hasClass('disabled-on-off')){
if ( jQuery(this).parent().find('input[type=hidden]').val() == 0 ){
update_val = 1;
jQuery(this).animate({'left': '48px'}, 200);
jQuery(this).parent().find('input[type=hidden]').val( update_val ).trigger('change');
} else {
update_val = 0;
jQuery(this).animate({'left': '0'}, 200);
jQuery(this).parent().find('input[type=hidden]').val( update_val ).trigger('change');
}
}
});
/**
WP Color Picker
**/
if ( jQuery('.um-admin-colorpicker').length ) {
jQuery('.um-admin-colorpicker').wpColorPicker();
}
/**
Tooltips
**/
um_init_tooltips();
if( typeof tipsy !== 'undefined' ){
jQuery('.um-admin-tipsy-n').tipsy({gravity: 'n', opacity: 1, live: 'a.live' });
jQuery('.um-admin-tipsy-w').tipsy({gravity: 'w', opacity: 1, live: 'a.live' });
jQuery('.um-admin-tipsy-e').tipsy({gravity: 'e', opacity: 1, live: 'a.live' });
jQuery('.um-admin-tipsy-s').tipsy({gravity: 's', opacity: 1, live: 'a.live' });
}
/**
Conditional fields
**/
jQuery( document.body ).on('change', '.um-adm-conditional', function(){
var value;
if ( jQuery(this).attr("type") == 'checkbox' ) {
value = jQuery(this).is(':checked') ? 1 : 0;
} else {
value = jQuery(this).val();
}
if ( jQuery(this).data('cond1') ) {
if ( value == jQuery(this).data('cond1') ) {
jQuery('.' + jQuery(this).data('cond1-show') ).show();
jQuery('.' + jQuery(this).data('cond1-hide') ).hide();
if ( jQuery(this).data('cond1-show') == '_roles' ) {
return false;
}
} else {
jQuery('.' + jQuery(this).data('cond1-show') ).hide();
jQuery('.' + jQuery(this).data('cond1-hide') ).show();
}
}
if ( jQuery(this).data('cond2') ) {
if ( value == jQuery(this).data('cond2') ) {
jQuery('.' + jQuery(this).data('cond2-show') ).show();
jQuery('.' + jQuery(this).data('cond2-hide') ).hide();
if ( jQuery(this).data('cond2-show') == '_roles' ) {
return false;
}
} else {
jQuery('.' + jQuery(this).data('cond2-show') ).hide();
jQuery('.' + jQuery(this).data('cond2-hide') ).show();
}
}
if ( jQuery(this).data('cond3') ) {
if ( value == jQuery(this).data('cond3') ) {
jQuery('.' + jQuery(this).data('cond3-show') ).show();
jQuery('.' + jQuery(this).data('cond3-hide') ).hide();
} else {
jQuery('.' + jQuery(this).data('cond3-show') ).hide();
jQuery('.' + jQuery(this).data('cond3-hide') ).show();
}
}
});jQuery('.um-adm-conditional').each(function(){jQuery(this).trigger('change');});
/**
Conditional fields for
Radio Group
**/
jQuery('.um-conditional-radio-group input[type=radio]').on('click', function(){
var holder = jQuery('.um-conditional-radio-group');
var val = jQuery(this).val();
var cond1 = holder.data('cond1');
var show1 = holder.data('cond1-show');
if ( val == cond1 ) { // condition met
jQuery('.' + show1).show();
} else {
jQuery('.' + show1).hide();
}
var val2 = jQuery(this).val();
var cond2 = holder.data('cond2');
var show2 = holder.data('cond2-show');
if ( val2 == cond2 ) { // condition met
jQuery('.' + show2).show();
} else {
jQuery('.' + show2).hide();
}
});jQuery('.um-conditional-radio-group input[type=radio]:checked').each(function(){jQuery(this).trigger('click');});
/**
Conditional fields for
nav-menu editor options
**/
jQuery('.um-nav-mode').each( function() {
if ( jQuery(this).find('select').val() == 2 ) {
jQuery(this).parents('.um-nav-edit').find('.um-nav-roles').show();
} else {
jQuery(this).parents('.um-nav-edit').find('.um-nav-roles').hide();
}
});
jQuery( document.body ).on('change', '.um-nav-mode select', function(){
if ( jQuery(this).val() == 2 ) {
jQuery(this).parents('.um-nav-edit').find('.um-nav-roles').show();
} else {
jQuery(this).parents('.um-nav-edit').find('.um-nav-roles').hide();
}
});
});
@@ -1,78 +0,0 @@
jQuery(document).on("ready", function(){
const scan_results_wrapper = jQuery(".um-secure-scan-results");
const scan_button_elem = jQuery(".um-secure-scan-content");
const scan_capabilities = jQuery("input[data-field_id^='banned_capabilities']");
var UM_Secure = {
init: function() {
scan_results_wrapper.css({
'margin-top': '10px',
'padding': '10px',
'padding-bottom': '10px',
'background-color': '#fff',
'display': 'block',
'max-height': '200px',
'height': '500px',
'overflow-y': 'scroll',
});
scan_button_elem.on("click", function(e){
UM_Secure.effect();
e.preventDefault();
var me = jQuery(this);
me.prop("disabled", true);
scan_results_wrapper.empty();
UM_Secure.log( wp.i18n.__( 'Scanning site..', 'ultimate-member' ) );
UM_Secure.ajax('');
});
scan_capabilities.on("change", function(){
scan_button_elem.after( ' <small style="color: red;">' + wp.i18n.__( 'You can start the scan now but you must save the settings to apply the selected capabilities after the scan is complete.', 'ultimate-member' ) + '</small>' );
scan_capabilities.off("change");
})
},
ajax: function( last_capability ) {
let checkedCaps = [];
let checkedCapsInputs = scan_results_wrapper.parents('.um-form-table').find('input[type="checkbox"][data-field_id^="banned_capabilities_"]:checked');
checkedCapsInputs.each(function (){
checkedCaps.push( jQuery(this).data('field_id').replace('banned_capabilities_', '') );
});
var request = {
nonce: um_admin_scripts.nonce,
capabilities: checkedCaps,
last_scanned_capability: last_capability,
};
wp.ajax.send('um_secure_scan_affected_users', {
data: request,
success: function (response) {
if ( ! response.completed ) {
UM_Secure.ajax( response.last_scanned_capability );
UM_Secure.log( response.message );
} else if ( response.completed ) {
scan_results_wrapper.empty();
UM_Secure.log( response.recommendations );
scan_results_wrapper.find('.current').removeClass('current');
scan_button_elem.removeAttr('disabled');
}
},
});
},
log: function( str ) {
scan_results_wrapper.find('.current').removeClass('current');
scan_results_wrapper.append( '<span class="current">' + str + '</span><br/>' );
},
effect: function() {
var blink = function(){
scan_results_wrapper.find(".current").fadeTo(100, 0.1).fadeTo(200, 1.0);
};
setInterval(blink, 1000);
}
};
UM_Secure.init();
});
@@ -1,49 +0,0 @@
jQuery( document ).ready( function() {
/**
* Licenses
*/
jQuery( document.body ).on( 'click', '.um_license_deactivate', function() {
jQuery(this).siblings('.um-option-field').val('');
if ( jQuery(this).siblings('#submit').length ) {
// clear = true for passing the empty field value to the license form submission
jQuery(this).siblings('#submit').trigger('click',[ true ]);
} else {
jQuery(this).parents('form.um-settings-form').trigger('submit');
}
});
jQuery( document.body ).on( 'click', '.um-settings-form #submit', function( e, clear ) {
if ( ! clear && '' === jQuery(this).siblings('.um-option-field').val() ) {
return false;
}
});
/**
* Not licenses page
*/
if ( jQuery( '#licenses_settings' ).length === 0 ) {
var changed = false;
jQuery( 'input, textarea, select' ).on('change', function() {
changed = true;
});
jQuery( '#um-settings-wrap .um-nav-tab-wrapper a, #um-settings-wrap .subsubsub a' ).on( 'click', function() {
if ( changed ) {
window.onbeforeunload = function() {
return wp.i18n.__( 'Are sure, maybe some settings not saved', 'ultimate-member' );
};
} else {
window.onbeforeunload = '';
}
});
jQuery( '.submit input' ).on( 'click', function() {
window.onbeforeunload = '';
});
}
});
+19 -71
View File
@@ -1,33 +1,24 @@
<?php
namespace um\admin;
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) exit;
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'um\admin\Admin_Functions' ) ) {
/**
* Class Admin_Functions
* @package um\admin\core
*/
class Admin_Functions {
/**
* Admin_Functions constructor.
*/
function __construct() {
}
/**
* Check wp-admin nonce
*
* @param bool $action
*/
function check_ajax_nonce( $action = false ) {
public function check_ajax_nonce( $action = false ) {
$nonce = isset( $_REQUEST['nonce'] ) ? sanitize_text_field( $_REQUEST['nonce'] ) : '';
$action = empty( $action ) ? 'um-admin-nonce' : $action;
@@ -36,83 +27,40 @@ if ( ! class_exists( 'um\admin\Admin_Functions' ) ) {
}
}
/**
* Boolean check if we're viewing UM backend
*
* @deprecated 2.8.0
*
* @return bool
*/
function is_um_screen() {
global $current_screen;
$is_um_screen = false;
if ( ! empty( $current_screen ) ) {
$screen_id = $current_screen->id;
if ( strstr( $screen_id, 'ultimatemember' ) ||
strstr( $screen_id, 'um_' ) ||
strstr( $screen_id, 'user' ) ||
strstr( $screen_id, 'profile' ) ||
$screen_id == 'nav-menus' ) {
$is_um_screen = true;
}
}
if ( $this->is_plugin_post_type() ) {
$is_um_screen = true;
}
if ( $this->is_restricted_entity() ) {
$is_um_screen = true;
}
return apply_filters( 'um_is_ultimatememeber_admin_screen', $is_um_screen );
public function is_um_screen() {
_deprecated_function( __METHOD__, '2.8.0', 'UM()->admin()->screen()->is_own_screen()' );
return UM()->admin()->screen()->is_own_screen();
}
/**
* Check if current page load UM post type
*
* @deprecated 2.8.0
*
* @return bool
*/
function is_plugin_post_type() {
$cpt = UM()->cpt_list();
if ( isset( $_REQUEST['post_type'] ) ) {
$post_type = sanitize_key( $_REQUEST['post_type'] );
if ( in_array( $post_type, $cpt ) ) {
return true;
}
} elseif ( isset( $_REQUEST['action'] ) && sanitize_key( $_REQUEST['action'] ) == 'edit' ) {
$post_type = get_post_type();
if ( in_array( $post_type, $cpt ) ) {
return true;
}
}
return false;
public function is_plugin_post_type() {
_deprecated_function( __METHOD__, '2.8.0', 'UM()->admin()->screen()->is_own_post_type()' );
return UM()->admin()->screen()->is_own_post_type();
}
/**
* If page now show content with restricted post/taxonomy
*
* @deprecated 2.8.0
*
* @return bool
*/
function is_restricted_entity() {
$restricted_posts = UM()->options()->get( 'restricted_access_post_metabox' );
$restricted_taxonomies = UM()->options()->get( 'restricted_access_taxonomy_metabox' );
global $typenow, $taxnow;
if ( ! empty( $typenow ) && ! empty( $restricted_posts[ $typenow ] ) ) {
return true;
}
if ( ! empty( $taxnow ) && ! empty( $restricted_taxonomies[ $taxnow ] ) ) {
return true;
}
return false;
public function is_restricted_entity() {
_deprecated_function( __METHOD__, '2.8.0', 'UM()->admin()->screen()->is_restricted_entity()' );
return UM()->admin()->screen()->is_restricted_entity();
}
}
}
+16 -46
View File
@@ -24,43 +24,35 @@ if ( ! class_exists( 'um\admin\Admin' ) ) {
*/
public $role_meta;
/**
* @var array
*/
public $restriction_term_meta;
/**
* @var array
*/
public $member_directory_meta;
/**
* @var array
*/
public $form_meta;
/**
* @var array
*/
public $builder_input;
/**
* @var array
*/
public $restriction_post_meta;
/**
* Admin constructor.
*/
public function __construct() {
parent::__construct();
$this->templates_path = UM_PATH . 'includes/admin/templates/';
add_action( 'admin_init', array( &$this, 'admin_init' ), 0 );
@@ -78,8 +70,6 @@ if ( ! class_exists( 'um\admin\Admin' ) ) {
add_action( 'um_admin_do_action__install_core_pages', array( &$this, 'install_core_pages' ) );
add_filter( 'admin_body_class', array( &$this, 'admin_body_class' ), 999 );
add_action( 'parent_file', array( &$this, 'parent_file' ), 9 );
add_filter( 'gettext', array( &$this, 'gettext' ), 10, 4 );
add_filter( 'post_updated_messages', array( &$this, 'post_updated_messages' ) );
@@ -92,7 +82,7 @@ if ( ! class_exists( 'um\admin\Admin' ) ) {
$this->site_health();
}
function init_variables() {
public function init_variables() {
$this->role_meta = apply_filters(
'um_role_meta_map',
array(
@@ -841,7 +831,6 @@ if ( ! class_exists( 'um\admin\Admin' ) ) {
);
}
/**
* @param array|string $value
*
@@ -892,7 +881,6 @@ if ( ! class_exists( 'um\admin\Admin' ) ) {
return $value;
}
/**
* @param array|string $value
*
@@ -916,7 +904,6 @@ if ( ! class_exists( 'um\admin\Admin' ) ) {
return $value;
}
/**
* @param array|string $value
*
@@ -940,7 +927,6 @@ if ( ! class_exists( 'um\admin\Admin' ) ) {
return $value;
}
/**
* @param array|string $value
*
@@ -970,7 +956,6 @@ if ( ! class_exists( 'um\admin\Admin' ) ) {
return $value;
}
/**
* @param array|string $value
*
@@ -987,7 +972,6 @@ if ( ! class_exists( 'um\admin\Admin' ) ) {
return $value;
}
/**
* @param array|string $value
*
@@ -1004,7 +988,6 @@ if ( ! class_exists( 'um\admin\Admin' ) ) {
return $value;
}
/**
* @param array|string $value
*
@@ -1028,7 +1011,6 @@ if ( ! class_exists( 'um\admin\Admin' ) ) {
return $value;
}
/**
* @param array|string $value
*
@@ -1052,7 +1034,6 @@ if ( ! class_exists( 'um\admin\Admin' ) ) {
return $value;
}
/**
* @param array|string $value
*
@@ -1068,7 +1049,6 @@ if ( ! class_exists( 'um\admin\Admin' ) ) {
return $value;
}
/**
* @param $value
*
@@ -1158,7 +1138,6 @@ if ( ! class_exists( 'um\admin\Admin' ) ) {
return $data;
}
/**
* Sanitize post restriction meta fields when wp-admin form has been submitted
*
@@ -1214,7 +1193,6 @@ if ( ! class_exists( 'um\admin\Admin' ) ) {
return $data;
}
/**
* Sanitize term restriction meta fields when wp-admin form has been submitted
*
@@ -1270,7 +1248,6 @@ if ( ! class_exists( 'um\admin\Admin' ) ) {
return $data;
}
/**
* Sanitize member directory meta when wp-admin form has been submitted
*
@@ -1346,7 +1323,6 @@ if ( ! class_exists( 'um\admin\Admin' ) ) {
return $data;
}
/**
* Sanitize builder field meta when wp-admin form has been submitted
*
@@ -1435,7 +1411,6 @@ if ( ! class_exists( 'um\admin\Admin' ) ) {
return $data;
}
/**
* Sanitize form meta when wp-admin form has been submitted
*
@@ -1511,7 +1486,6 @@ if ( ! class_exists( 'um\admin\Admin' ) ) {
return $data;
}
/**
* Sanitize options when wp-admin form has been submitted
*
@@ -1590,21 +1564,6 @@ if ( ! class_exists( 'um\admin\Admin' ) ) {
return $data;
}
/**
* Adds class to our admin pages
*
* @param $classes
*
* @return string
*/
public function admin_body_class( $classes ) {
if ( $this->is_um_screen() ) {
return "$classes um-admin";
}
return $classes;
}
/**
*
*/
@@ -2012,9 +1971,9 @@ if ( ! class_exists( 'um\admin\Admin' ) ) {
*
* @return string
*/
function gettext( $translation, $text, $domain ) {
public function gettext( $translation, $text, $domain ) {
global $post;
if ( isset( $post->post_type ) && $this->is_plugin_post_type() ) {
if ( isset( $post->post_type ) && $this->screen()->is_own_post_type() ) {
$translations = get_translations_for_domain( $domain );
if ( $text == 'Publish' ) {
return $translations->translate( 'Create' );
@@ -2026,7 +1985,6 @@ if ( ! class_exists( 'um\admin\Admin' ) ) {
return $translation;
}
/**
* Fix parent file for correct highlighting
*
@@ -2034,7 +1992,7 @@ if ( ! class_exists( 'um\admin\Admin' ) ) {
*
* @return string
*/
function parent_file( $parent_file ) {
public function parent_file( $parent_file ) {
global $current_screen;
$screen_id = $current_screen->id;
if ( strstr( $screen_id, 'um_' ) ) {
@@ -2067,6 +2025,18 @@ if ( ! class_exists( 'um\admin\Admin' ) ) {
return UM()->classes['admin_notices'];
}
/**
* @since 2.8.0
*
* @return Screen
*/
public function screen() {
if ( empty( UM()->classes['um\admin\screen'] ) ) {
UM()->classes['um\admin\screen'] = new Screen();
}
return UM()->classes['um\admin\screen'];
}
/**
* @since 2.6.8
*
File diff suppressed because it is too large Load Diff
+114
View File
@@ -0,0 +1,114 @@
<?php
namespace um\admin;
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Class Screen
*
* @since 2.8.0
*
* @package um\admin
*/
class Screen {
/**
* Boolean check if we're viewing UM backend.
*
* @since 2.8.0
*
* @return bool
*/
public function is_own_screen() {
global $current_screen;
$is_um_screen = false;
if ( ! empty( $current_screen ) && isset( $current_screen->id ) ) {
$screen_id = $current_screen->id;
if ( 'nav-menus' === $screen_id ||
strstr( $screen_id, 'ultimatemember' ) ||
strstr( $screen_id, 'um_' ) ||
strstr( $screen_id, 'user' ) ||
strstr( $screen_id, 'profile' ) ) {
$is_um_screen = true;
}
}
if ( $this->is_own_post_type() ) {
$is_um_screen = true;
}
if ( $this->is_restricted_entity() ) {
$is_um_screen = true;
}
/**
* Filters marker about displaying Ultimate Member screen in wp-admin or another one.
*
* @since 2.8.0
* @hook um_is_ultimatememeber_admin_screen
*
* @param {array} $variables Data to localize.
*
* @return {array} Data to localize.
*
* @example <caption>Add `my_custom_variable` to common scripts to be callable via `um_common_variables.my_custom_variable` in JS.</caption>
* function um_custom_common_js_variables( $variables ) {
* $variables['{my_custom_variable}'] = '{my_custom_variable_value}';
* return $variables;
* }
* add_filter( 'um_common_js_variables', 'um_custom_common_js_variables' );
*/
return apply_filters( 'um_is_ultimatememeber_admin_screen', $is_um_screen );
}
/**
* Check if current page load UM post type.
*
* @since 2.8.0
*
* @return bool
*/
public function is_own_post_type() {
$cpt = UM()->common()->cpt()->get_list();
if ( isset( $_REQUEST['post_type'] ) ) {
$post_type = sanitize_key( $_REQUEST['post_type'] );
if ( in_array( $post_type, $cpt, true ) ) {
return true;
}
} elseif ( isset( $_REQUEST['action'] ) && 'edit' === sanitize_key( $_REQUEST['action'] ) ) {
$post_type = get_post_type();
if ( in_array( $post_type, $cpt, true ) ) {
return true;
}
}
return false;
}
/**
* If page now show content with restricted post/taxonomy.
*
* @since 2.8.0
*
* @return bool
*/
public function is_restricted_entity() {
$restricted_posts = UM()->options()->get( 'restricted_access_post_metabox' );
$restricted_taxonomies = UM()->options()->get( 'restricted_access_taxonomy_metabox' );
global $typenow, $taxnow;
if ( ! empty( $typenow ) && ! empty( $restricted_posts[ $typenow ] ) ) {
return true;
}
if ( ! empty( $taxnow ) && ! empty( $restricted_taxonomies[ $taxnow ] ) ) {
return true;
}
return false;
}
}
+9 -19
View File
@@ -49,22 +49,9 @@ if ( ! class_exists( 'um\admin\Secure' ) ) {
add_action( 'um_settings_before_save', array( $this, 'check_secure_changes' ) );
add_action( 'um_settings_save', array( $this, 'on_settings_save' ) );
add_action( 'admin_enqueue_scripts', array( $this, 'admin_scripts' ) );
add_action( 'wp_ajax_um_secure_scan_affected_users', array( $this, 'ajax_scanner' ) );
}
public function admin_scripts( $hook ) {
// phpcs:disable WordPress.Security.NonceVerification
if ( 'ultimate-member_page_um_options' !== $hook || ( isset( $_GET['tab'] ) && 'secure' !== $_GET['tab'] ) ) {
return;
}
// phpcs:enable WordPress.Security.NonceVerification
wp_register_script( 'um_admin_secure', UM()->admin()->enqueue()->js_url . 'um-admin-secure.js', array( 'jquery' ), UM_VERSION, true );
wp_enqueue_script( 'um_admin_secure' );
}
/**
* Filter users by Register Date
*
@@ -79,13 +66,16 @@ if ( ! class_exists( 'um\admin\Secure' ) ) {
$date_to = isset( $_GET['um_secure_date_to'] ) ? $_GET['um_secure_date_to'] : null;
// phpcs:enable WordPress.Security.NonceVerification
if ( $date_from ) {
$date_query_attr = array(
'after' => human_time_diff( $date_from, strtotime( current_time( 'mysql' ) ) ) . ' ago',
'inclusive' => true,
'after' => gmdate( get_option( 'date_format', 'F j, Y' ), strtotime( '-1 day', $date_from ) ),
'before' => gmdate( get_option( 'date_format', 'F j, Y' ), strtotime( '+1 day', $date_from ) ),
);
if ( $date_to ) {
$date_query_attr['before'] = human_time_diff( $date_to, strtotime( current_time( 'mysql' ) ) ) . ' ago';
$date_query_attr['before'] = gmdate( get_option( 'date_format', 'F j, Y' ), strtotime( '+1 day', $date_to ) );
}
$query->set( 'date_query', $date_query_attr );
}
}
@@ -177,7 +167,7 @@ if ( ! class_exists( 'um\admin\Secure' ) ) {
// Don't need to reset a password.
if ( UM()->options()->get( 'display_login_form_notice' ) ) {
update_user_meta( $user_id, 'um_secure_has_reset_password', true );
update_user_meta( $user_id, 'um_secure_has_reset_password__timestamp', current_time( 'mysql' ) );
update_user_meta( $user_id, 'um_secure_has_reset_password__timestamp', current_time( 'mysql', true ) );
}
// Clear Cache.
@@ -215,7 +205,7 @@ if ( ! class_exists( 'um\admin\Secure' ) ) {
$scan_status = get_option( 'um_secure_scan_status' );
$last_scanned_time = get_option( 'um_secure_last_time_scanned' );
if ( ! empty( $last_scanned_time ) ) {
$scanner_content .= human_time_diff( strtotime( $last_scanned_time ), strtotime( current_time( 'mysql' ) ) ) . ' ' . esc_html__( 'ago', 'ultimate-member' );
$scanner_content .= human_time_diff( strtotime( $last_scanned_time ) ) . ' ' . esc_html__( 'ago', 'ultimate-member' );
if ( 'started' === $scan_status ) {
$scanner_content .= ' - ' . esc_html__( 'Not Completed.', 'ultimate-member' );
}
@@ -338,7 +328,7 @@ if ( ! class_exists( 'um\admin\Secure' ) ) {
$restore_account_url = admin_url( 'users.php?user_id=' . $user_id . '&um_secure_restore_account=1&_wpnonce=' . $nonce );
$action = ' &#183; <a href=" ' . esc_attr( $restore_account_url ) . ' " onclick=\'return confirm("' . esc_js( __( 'Are you sure that you want to restore this account after getting flagged for suspicious activity?', 'ultimate-member' ) ) . '");\'><small>' . esc_html__( 'Restore Account', 'ultimate-member' ) . '</small></a>';
if ( ! empty( $datetime ) ) {
$val .= '<div><small>' . human_time_diff( strtotime( $datetime ), strtotime( current_time( 'mysql' ) ) ) . ' ' . __( 'ago', 'ultimate-member' ) . '</small>' . $action . '</div>';
$val .= '<div><small>' . human_time_diff( strtotime( $datetime ) ) . ' ' . __( 'ago', 'ultimate-member' ) . '</small>' . $action . '</div>';
}
}
um_reset_user();
+138 -45
View File
@@ -656,7 +656,7 @@ class Site_Health {
/**
* Filters a privacy list extend.
*
* @since 2.6.13
* @since 2.7.0
* @hook um_profile_tabs_privacy_list
*
* @param {array} $privacy_option Add options for profile tabs' privacy.
@@ -686,8 +686,9 @@ class Site_Health {
'value' => $tab_enabled ? $labels['yes'] : $labels['no'],
);
if ( ! isset( $tab['default_privacy'] ) ) {
if ( ! empty( $tab_enabled ) ) {
if ( ! isset( $tab['default_privacy'] ) && ! empty( $tab_enabled ) ) {
$privacy = UM()->options()->get( 'profile_tab_' . $id . '_privacy' );
if ( is_numeric( $privacy ) ) {
$appearance_settings[ 'um-profile_tab_' . $id . '_privacy' ] = array(
// translators: %s Profile Tab Title
'label' => sprintf( __( 'Who can see %s Tab?', 'ultimate-member' ), $tab['name'] ),
@@ -699,7 +700,7 @@ class Site_Health {
/**
* Filters appearance settings for Site Health extend.
*
* @since 2.6.13
* @since 2.7.0
* @hook um_profile_tabs_site_health
*
* @param {array} $appearance_settings Appearance settings for Site Health.
@@ -716,9 +717,9 @@ class Site_Health {
$appearance_settings = apply_filters( 'um_profile_tabs_site_health', $appearance_settings );
/**
* Filters extend user profile tabs
* Filters user profile tabs
*
* @since 2.6.13
* @since 2.7.0
* @hook um_profile_tabs
*
* @param {array} $tabs tabs list.
@@ -905,10 +906,20 @@ class Site_Health {
// Secure settings
$secure_ban_admins_accounts = UM()->options()->get( 'secure_ban_admins_accounts' );
$banned_capabilities_opt = UM()->options()->get( 'banned_capabilities' );
$banned_capabilities = array();
if ( ! empty( $banned_capabilities_opt ) ) {
if ( is_string( $banned_capabilities_opt ) ) {
$banned_capabilities = array( $banned_capabilities_opt );
} else {
$banned_capabilities = $banned_capabilities_opt;
}
}
$secure_settings = array(
'um-banned_capabilities' => array(
'label' => __( 'Banned Administrative Capabilities', 'ultimate-member' ),
'value' => implode( ', ', UM()->options()->get( 'banned_capabilities' ) ),
'value' => ! empty( $banned_capabilities ) ? implode( ', ', $banned_capabilities ) : '',
),
'um-lock_register_forms' => array(
'label' => __( 'Lock All Register Forms', 'ultimate-member' ),
@@ -963,7 +974,7 @@ class Site_Health {
/**
* Filters licenses settings for Site Health.
*
* @since 2.6.13
* @since 2.7.0
* @hook um_licenses_site_health
*
* @param {array} $license_settings licenses settings for Site Health.
@@ -995,9 +1006,9 @@ class Site_Health {
$k = $priority . '-' . $role;
$roles_array[ $k ] = $role . '(' . $priority . ')';
}
krsort( $roles_array, SORT_NUMERIC );
krsort( $roles_array, SORT_NUMERIC );
}
$info['ultimate-member-user-roles'] = array(
'label' => __( 'User roles', 'ultimate-member' ),
@@ -1067,12 +1078,22 @@ class Site_Health {
}
if ( array_key_exists( '_um_can_edit_everyone', $rolemeta ) && 1 === absint( $rolemeta['_um_can_edit_everyone'] ) ) {
$can_edit_roles_meta = ! empty( $rolemeta['_um_can_edit_roles'] ) ? $rolemeta['_um_can_edit_roles'] : array();
$can_edit_roles = array();
if ( ! empty( $can_edit_roles_meta ) ) {
if ( is_string( $can_edit_roles_meta ) ) {
$can_edit_roles = array( $can_edit_roles_meta );
} else {
$can_edit_roles = $can_edit_roles_meta;
}
}
$info[ 'ultimate-member-' . $key ]['fields'] = array_merge(
$info[ 'ultimate-member-' . $key ]['fields'],
array(
'um-can_edit_roles' => array(
'label' => __( 'Can edit these user roles only', 'ultimate-member' ),
'value' => ! empty( $rolemeta['_um_can_edit_roles'] ) ? implode( ', ', $rolemeta['_um_can_edit_roles'] ) : $labels['all'],
'value' => ! empty( $can_edit_roles ) ? implode( ', ', $can_edit_roles ) : $labels['all'],
),
)
);
@@ -1091,12 +1112,22 @@ class Site_Health {
}
if ( array_key_exists( '_um_can_delete_everyone', $rolemeta ) && 1 === absint( $rolemeta['_um_can_delete_everyone'] ) ) {
$can_delete_roles_meta = ! empty( $rolemeta['_um_can_delete_roles'] ) ? $rolemeta['_um_can_delete_roles'] : array();
$can_delete_roles = array();
if ( ! empty( $can_delete_roles_meta ) ) {
if ( is_string( $can_delete_roles_meta ) ) {
$can_delete_roles = array( $can_delete_roles_meta );
} else {
$can_delete_roles = $can_delete_roles_meta;
}
}
$info[ 'ultimate-member-' . $key ]['fields'] = array_merge(
$info[ 'ultimate-member-' . $key ]['fields'],
array(
'um-can_delete_roles' => array(
'label' => __( 'Can delete these user roles only', 'ultimate-member' ),
'value' => ! empty( $rolemeta['_um_can_delete_roles'] ) ? implode( ', ', $rolemeta['_um_can_delete_roles'] ) : $labels['all'],
'value' => ! empty( $can_delete_roles ) ? implode( ', ', $can_delete_roles ) : $labels['all'],
),
)
);
@@ -1139,12 +1170,22 @@ class Site_Health {
}
if ( array_key_exists( '_um_can_view_all', $rolemeta ) && 1 === absint( $rolemeta['_um_can_view_all'] ) ) {
$can_view_roles_meta = ! empty( $rolemeta['_um_can_view_roles'] ) ? $rolemeta['_um_can_view_roles'] : array();
$can_view_roles = array();
if ( ! empty( $can_view_roles_meta ) ) {
if ( is_string( $can_view_roles_meta ) ) {
$can_view_roles = array( $can_view_roles_meta );
} else {
$can_view_roles = $can_view_roles_meta;
}
}
$info[ 'ultimate-member-' . $key ]['fields'] = array_merge(
$info[ 'ultimate-member-' . $key ]['fields'],
array(
'um-can_view_roles' => array(
'label' => __( 'Can view these user roles only', 'ultimate-member' ),
'value' => ! empty( $rolemeta['_um_can_view_roles'] ) ? implode( ', ', $rolemeta['_um_can_view_roles'] ) : $labels['all'],
'value' => ! empty( $can_view_roles ) ? implode( ', ', $can_view_roles ) : $labels['all'],
),
)
);
@@ -1652,19 +1693,19 @@ class Site_Health {
$info[ 'ultimate-member-' . $key ]['fields'] = array_merge(
$info[ 'ultimate-member-' . $key ]['fields'],
array(
'um-profile_role' => array(
'um-profile_role' => array(
'label' => __( 'Make this profile form role-specific', 'ultimate-member' ),
'value' => ! empty( get_post_meta( $key, '_um_profile_role', true ) ) ? get_post_meta( $key, '_um_profile_role', true ) : $labels['all'],
),
'um-profile_template' => array(
'um-profile_template' => array(
'label' => __( 'Template', 'ultimate-member' ),
'value' => 0 === absint( get_post_meta( $key, '_um_profile_template', true ) ) ? $labels['default'] : get_post_meta( $key, '_um_profile_template', true ),
),
'um-profile_primary_btn_word' => array(
'um-profile_primary_btn_word' => array(
'label' => __( 'Primary Button Text', 'ultimate-member' ),
'value' => ! get_post_meta( $key, '_um_profile_primary_btn_word', true ) ? $labels['default'] : get_post_meta( $key, '_um_profile_primary_btn_word', true ),
),
'um-profile_cover_enabled' => array(
'um-profile_cover_enabled' => array(
'label' => __( 'Enable Cover Photos', 'ultimate-member' ),
'value' => get_post_meta( $key, '_um_profile_cover_enabled', true ) ? $labels['yes'] : $labels['no'],
),
@@ -1788,43 +1829,75 @@ class Site_Health {
$key = substr( $key, 3 );
}
$view_type = get_post_meta( $key, '_um_view_type', true );
$_um_view_types_value = get_post_meta( $key, '_um_view_types', true );
$_um_view_types_value = empty( $_um_view_types_value ) ? array( 'grid', 'list' ) : $_um_view_types_value;
$_um_view_types_value = is_string( $_um_view_types_value ) ? array( $_um_view_types_value ) : $_um_view_types_value;
$info[ 'ultimate-member-directory-' . $key ] = array(
'label' => ' - ' . $directory . __( ' directory settings', 'ultimate-member' ),
'description' => __( 'This debug information for your Ultimate Member directory.', 'ultimate-member' ),
'fields' => array(
'um-directory-shortcode' => array(
'um-directory-shortcode' => array(
'label' => __( 'Shortcode', 'ultimate-member' ),
'value' => '[ultimatemember_directory id="' . $key . '"]',
),
'um-directory_template' => array(
'um-directory_template' => array(
'label' => __( 'Template', 'ultimate-member' ),
'value' => get_post_meta( $key, '_um_directory_template', true ) ? get_post_meta( $key, '_um_directory_template', true ) : $labels['default'],
),
'um-directory-view_type' => array(
'label' => __( 'View type', 'ultimate-member' ),
'value' => $view_type,
'um-directory-view_types' => array(
'label' => __( 'View types', 'ultimate-member' ),
'value' => implode( ', ', $_um_view_types_value ),
),
'um-directory-default_view' => array(
'label' => __( 'Default view type', 'ultimate-member' ),
'value' => get_post_meta( $key, '_um_default_view', true ),
),
),
);
if ( 'grid' === $view_type ) {
$info[ 'ultimate-member-directory-' . $key ]['fields']['um-directory-grid_columns'] = get_post_meta( $key, '_um_grid_columns', true );
}
if ( isset( $options[ get_post_meta( $key, '_um_sortby', true ) ] ) ) {
$sortby_label = $options[ get_post_meta( $key, '_um_sortby', true ) ];
} else {
$sortby_label = get_post_meta( $key, '_um_sortby', true );
}
$directory_roles_meta = get_post_meta( $key, '_um_roles', true );
$directory_roles = array();
if ( ! empty( $directory_roles_meta ) ) {
if ( is_string( $directory_roles_meta ) ) {
$directory_roles = array( $directory_roles_meta );
} else {
$directory_roles = $directory_roles_meta;
}
}
$directory_show_these_users_meta = get_post_meta( $key, '_um_show_these_users', true );
$show_these_users = array();
if ( ! empty( $directory_show_these_users_meta ) ) {
if ( is_string( $directory_show_these_users_meta ) ) {
$show_these_users = array( $directory_show_these_users_meta );
} else {
$show_these_users = $directory_show_these_users_meta;
}
}
$directory_exclude_these_users_meta = get_post_meta( $key, '_um_exclude_these_users', true );
$exclude_these_users = array();
if ( ! empty( $directory_exclude_these_users_meta ) ) {
if ( is_string( $directory_exclude_these_users_meta ) ) {
$exclude_these_users = array( $directory_exclude_these_users_meta );
} else {
$exclude_these_users = $directory_exclude_these_users_meta;
}
}
$info[ 'ultimate-member-directory-' . $key ]['fields'] = array_merge(
$info[ 'ultimate-member-directory-' . $key ]['fields'],
array(
'um-directory-roles' => array(
'label' => __( 'Default view type', 'ultimate-member' ),
'value' => ! empty( get_post_meta( $key, '_um_roles', true ) ) ? implode( ', ', get_post_meta( $key, '_um_roles', true ) ) : $labels['all'],
'label' => __( 'User Roles to display', 'ultimate-member' ),
'value' => ! empty( $directory_roles ) ? implode( ', ', $directory_roles ) : $labels['all'],
),
'um-directory-has_profile_photo' => array(
'label' => __( 'Only show members who have uploaded a profile photo', 'ultimate-member' ),
@@ -1836,11 +1909,11 @@ class Site_Health {
),
'um-directory-show_these_users' => array(
'label' => __( 'Only show specific users (Enter one username per line)', 'ultimate-member' ),
'value' => ! empty( get_post_meta( $key, '_um_show_these_users', true ) ) ? implode( ', ', get_post_meta( $key, '_um_show_these_users', true ) ) : '',
'value' => ! empty( $show_these_users ) ? implode( ', ', $show_these_users ) : '',
),
'um-directory-exclude_these_users' => array(
'label' => __( 'Exclude specific users (Enter one username per line)', 'ultimate-member' ),
'value' => ! empty( get_post_meta( $key, '_um_exclude_these_users', true ) ) ? implode( ', ', get_post_meta( $key, '_um_exclude_these_users', true ) ) : '',
'value' => ! empty( $exclude_these_users ) ? implode( ', ', $exclude_these_users ) : '',
),
)
);
@@ -1861,18 +1934,18 @@ class Site_Health {
$info[ 'ultimate-member-directory-' . $key ]['fields'] = array_merge(
$info[ 'ultimate-member-directory-' . $key ]['fields'],
array(
'um-directory-sortby_custom' => array(
'label' => __( 'Meta key', 'ultimate-member' ),
'um-directory-enable_sorting' => array(
'label' => __( 'Enable custom sorting', 'ultimate-member' ),
'value' => get_post_meta( $key, '_um_enable_sorting', true ) ? $labels['yes'] : $labels['no'],
),
'um-directory-sortby_custom' => array(
'label' => __( 'Custom sorting meta key', 'ultimate-member' ),
'value' => get_post_meta( $key, '_um_sortby_custom', true ),
),
'um-directory-sortby_custom_label' => array(
'label' => __( 'Label of custom sort', 'ultimate-member' ),
'value' => get_post_meta( $key, '_um_sortby_custom_label', true ),
),
'um-directory-enable_sorting' => array(
'label' => __( 'Enable custom sorting', 'ultimate-member' ),
'value' => get_post_meta( $key, '_um_enable_sorting', true ) ? $labels['yes'] : $labels['no'],
),
)
);
}
@@ -2002,12 +2075,22 @@ class Site_Health {
);
if ( 1 === absint( get_post_meta( $key, '_um_search', true ) ) ) {
$directory_roles_can_search_meta = get_post_meta( $key, '_um_roles_can_search', true );
$roles_can_search = array();
if ( ! empty( $directory_roles_can_search_meta ) ) {
if ( is_string( $directory_roles_can_search_meta ) ) {
$roles_can_search = array( $directory_roles_can_search_meta );
} else {
$roles_can_search = $directory_roles_can_search_meta;
}
}
$info[ 'ultimate-member-directory-' . $key ]['fields'] = array_merge(
$info[ 'ultimate-member-directory-' . $key ]['fields'],
array(
'um-directory-roles_can_search' => array(
'label' => __( 'User Roles that can use search', 'ultimate-member' ),
'value' => ! empty( get_post_meta( $key, '_um_roles_can_search', true ) ) ? implode( ', ', get_post_meta( $key, '_um_roles_can_search', true ) ) : $labels['all'],
'value' => ! empty( $roles_can_search ) ? implode( ', ', $roles_can_search ) : $labels['all'],
),
)
);
@@ -2024,12 +2107,22 @@ class Site_Health {
);
if ( 1 === absint( get_post_meta( $key, '_um_filters', true ) ) ) {
$directory_roles_can_filter_meta = get_post_meta( $key, '_um_roles_can_filter', true );
$roles_can_filter = array();
if ( ! empty( $directory_roles_can_filter_meta ) ) {
if ( is_string( $directory_roles_can_filter_meta ) ) {
$roles_can_filter = array( $directory_roles_can_filter_meta );
} else {
$roles_can_filter = $directory_roles_can_filter_meta;
}
}
$info[ 'ultimate-member-directory-' . $key ]['fields'] = array_merge(
$info[ 'ultimate-member-directory-' . $key ]['fields'],
array(
'um-directory-roles_can_filter' => array(
'label' => __( 'User Roles that can use filters', 'ultimate-member' ),
'value' => ! empty( get_post_meta( $key, '_um_roles_can_filter', true ) ) ? implode( ', ', get_post_meta( $key, '_um_roles_can_filter', true ) ) : $labels['all'],
'value' => ! empty( $roles_can_filter ) ? implode( ', ', $roles_can_filter ) : $labels['all'],
),
)
);
@@ -2096,15 +2189,15 @@ class Site_Health {
$info[ 'ultimate-member-directory-' . $key ]['fields'] = array_merge(
$info[ 'ultimate-member-directory-' . $key ]['fields'],
array(
'um-directory-must_search' => array(
'um-directory-must_search' => array(
'label' => __( 'Show results only after search/filtration', 'ultimate-member' ),
'value' => get_post_meta( $key, '_um_must_search', true ) ? $labels['yes'] : $labels['no'],
),
'um-directory-max_users' => array(
'um-directory-max_users' => array(
'label' => __( 'Maximum number of profiles', 'ultimate-member' ),
'value' => get_post_meta( $key, '_um_max_users', true ),
),
'um-directory-profiles_per_page' => array(
'um-directory-profiles_per_page' => array(
'label' => __( 'Number of profiles per page', 'ultimate-member' ),
'value' => get_post_meta( $key, '_um_profiles_per_page', true ),
),
@@ -2112,15 +2205,15 @@ class Site_Health {
'label' => __( 'Maximum number of profiles', 'ultimate-member' ),
'value' => get_post_meta( $key, '_um_profiles_per_page_mobile', true ),
),
'um-directory-directory_header' => array(
'um-directory-directory_header' => array(
'label' => __( 'Results Text', 'ultimate-member' ),
'value' => get_post_meta( $key, '_um_directory_header', true ),
),
'um-directory-directory_header_single' => array(
'um-directory-directory_header_single' => array(
'label' => __( 'Single Result Text', 'ultimate-member' ),
'value' => get_post_meta( $key, '_um_directory_header_single', true ),
),
'um-directory-directory_no_users' => array(
'um-directory-directory_no_users' => array(
'label' => __( 'Custom text if no users were found', 'ultimate-member' ),
'value' => get_post_meta( $key, '_um_directory_no_users', true ),
),
+66 -60
View File
@@ -248,9 +248,9 @@ if ( ! class_exists( 'um\admin\core\Admin_Builder' ) ) {
<?php $metabox->field_input( '_conditional_operator', $form_id ); ?>
<?php $metabox->field_input( '_conditional_value', $form_id ); ?>
<p><a href="javascript:void(0);" class="um-admin-remove-condition button um-admin-tipsy-n" title="Remove condition"><i class="um-icon-close" style="margin-right:0!important"></i></a></p>
<p><a href="javascript:void(0);" class="um-admin-remove-condition button um-tip-n" title="Remove condition"><i class="um-icon-close" style="margin-right:0!important"></i></a></p>
<div class="um-admin-clear"></div>
<div class="clear"></div>
</div>
<p class="um-admin-conditions-notice">
<small>
@@ -259,10 +259,10 @@ if ( ! class_exists( 'um\admin\core\Admin_Builder' ) ) {
<br><?php _e( 'Use the condition operator `contains` if the parent field has multiple options.', 'ultimate-member' ); ?>
</small>
</p>
<p><a href="javascript:void(0);" class="um-admin-new-condition button button-primary um-admin-tipsy-n" title="Add new condition"><?php _e( 'Add new rule', 'ultimate-member' ); ?></a></p>
<p><a href="javascript:void(0);" class="um-admin-new-condition button button-primary um-tip-n" title="Add new condition"><?php _e( 'Add new rule', 'ultimate-member' ); ?></a></p>
<p class="um-admin-reset-conditions"><a href="javascript:void(0);" class="button"><?php _e( 'Reset all rules', 'ultimate-member' ); ?></a></p>
<div class="um-admin-clear"></div>
<div class="clear"></div>
<?php if ( isset( $edit_array['conditions'] ) && count( $edit_array['conditions'] ) != 0 ) {
@@ -277,9 +277,9 @@ if ( ! class_exists( 'um\admin\core\Admin_Builder' ) ) {
<?php $metabox->field_input( '_conditional_operator' . $k, $form_id ); ?>
<?php $metabox->field_input( '_conditional_value' . $k, $form_id ); ?>
<p><a href="#" class="um-admin-remove-condition button um-admin-tipsy-n" title="Remove condition"><i class="um-icon-close" style="margin-right:0!important"></i></a></p>
<p><a href="#" class="um-admin-remove-condition button um-tip-n" title="Remove condition"><i class="um-icon-close" style="margin-right:0!important"></i></a></p>
<div class="um-admin-clear"></div>
<div class="clear"></div>
</div>
<?php
@@ -294,9 +294,9 @@ if ( ! class_exists( 'um\admin\core\Admin_Builder' ) ) {
<?php $metabox->field_input( '_conditional_operator', $form_id ); ?>
<?php $metabox->field_input( '_conditional_value', $form_id ); ?>
<p><a href="#" class="um-admin-remove-condition button um-admin-tipsy-n" title="Remove condition"><i class="um-icon-close" style="margin-right:0!important"></i></a></p>
<p><a href="#" class="um-admin-remove-condition button um-tip-n" title="Remove condition"><i class="um-icon-close" style="margin-right:0!important"></i></a></p>
<div class="um-admin-clear"></div>
<div class="clear"></div>
</div>
<?php } ?>
@@ -333,33 +333,32 @@ if ( ! class_exists( 'um\admin\core\Admin_Builder' ) ) {
die;
}
/**
* Sort array function
* Sort sub-row fields by position.
* Callback for `uasort()` function
*
* @param array $arr
* @param string $col
* @param int $dir
* @param array $a Array item.
* @param array $b Array item.
*
* @return array
* @return int
*/
function array_sort_by_column( $arr, $col, $dir = SORT_ASC ) {
$sort_col = array();
foreach ( $arr as $key => $row ) {
if ( ! empty( $row[ $col ] ) ) {
$sort_col[ $key ] = $row[ $col ];
}
public function sorting_fields_by_position( $a, $b ) {
if ( empty( $a['position'] ) ) {
$a['position'] = 0;
}
if ( ! empty( $sort_col ) ) {
array_multisort( $sort_col, $dir, $arr );
if ( empty( $b['position'] ) ) {
$b['position'] = 0;
}
$a['position'] = absint( $a['position'] );
$b['position'] = absint( $b['position'] );
return $arr;
if ( $a['position'] === $b['position'] ) {
return 0;
}
return ( $a['position'] < $b['position'] ) ? -1 : 1;
}
/**
* Get fields in row
*
@@ -419,11 +418,11 @@ if ( ! class_exists( 'um\admin\core\Admin_Builder' ) ) {
<span class="um-admin-row-loading"><span></span></span>
<!-- Master Row Actions -->
<div class="um-admin-drag-row-icons">
<a href="javascript:void(0);" class="um-admin-drag-rowsub-add um-admin-tipsy-n" title="<?php esc_attr_e( 'Add Row', 'ultimate-member' ); ?>" data-row_action="add_subrow"><i class="um-icon-plus"></i></a>
<a href="javascript:void(0);" class="um-admin-drag-row-edit um-admin-tipsy-n" title="<?php esc_attr_e( 'Edit Row', 'ultimate-member' ); ?>" data-modal="UM_edit_row" data-modal-size="normal" data-dynamic-content="um_admin_edit_field_popup" data-arg1="row" data-arg2="<?php echo esc_attr( $this->form_id ); ?>" data-arg3="_um_row_1"><i class="um-faicon-pencil"></i></a>
<a href="javascript:void(0);" class="um-admin-drag-rowsub-add um-tip-n" title="<?php esc_attr_e( 'Add Row', 'ultimate-member' ); ?>" data-row_action="add_subrow"><i class="um-icon-plus"></i></a>
<a href="javascript:void(0);" class="um-admin-drag-row-edit um-tip-n" title="<?php esc_attr_e( 'Edit Row', 'ultimate-member' ); ?>" data-modal="UM_edit_row" data-modal-size="normal" data-dynamic-content="um_admin_edit_field_popup" data-arg1="row" data-arg2="<?php echo esc_attr( $this->form_id ); ?>" data-arg3="_um_row_1"><i class="um-faicon-pencil"></i></a>
<span class="um-admin-drag-row-start"><i class="um-icon-arrow-move"></i></span>
</div>
<div class="um-admin-clear"></div>
<div class="clear"></div>
<div class="um-admin-drag-rowsubs">
<div class="um-admin-drag-rowsub">
<span class="um-admin-row-loading"><span></span></span>
@@ -436,11 +435,11 @@ if ( ! class_exists( 'um\admin\core\Admin_Builder' ) ) {
<!-- Sub Row Actions -->
<div class="um-admin-drag-rowsub-icons">
<span class="um-admin-drag-rowsub-start"><i class="um-icon-arrow-move"></i></span>
</div><div class="um-admin-clear"></div>
</div><div class="clear"></div>
<!-- Columns -->
<div class="um-admin-drag-col"></div>
<div class="um-admin-drag-col-dynamic"></div>
<div class="um-admin-clear"></div>
<div class="clear"></div>
</div>
</div>
</div>
@@ -473,14 +472,14 @@ if ( ! class_exists( 'um\admin\core\Admin_Builder' ) ) {
<span class="um-admin-row-loading"><span></span></span>
<!-- Master Row Actions -->
<div class="um-admin-drag-row-icons">
<a href="javascript:void(0);" class="um-admin-drag-rowsub-add um-admin-tipsy-n" title="<?php esc_attr_e( 'Add Row', 'ultimate-member' ); ?>" data-row_action="add_subrow"><i class="um-icon-plus"></i></a>
<a href="javascript:void(0);" class="um-admin-drag-row-edit um-admin-tipsy-n" title="<?php esc_attr_e( 'Edit Row', 'ultimate-member' ); ?>" data-modal="UM_edit_row" data-modal-size="normal" data-dynamic-content="um_admin_edit_field_popup" data-arg1="row" data-arg2="<?php echo esc_attr( $this->form_id ); ?>" data-arg3="<?php echo esc_attr( $row_id ); ?>"><i class="um-faicon-pencil"></i></a>
<a href="javascript:void(0);" class="um-admin-drag-rowsub-add um-tip-n" title="<?php esc_attr_e( 'Add Row', 'ultimate-member' ); ?>" data-row_action="add_subrow"><i class="um-icon-plus"></i></a>
<a href="javascript:void(0);" class="um-admin-drag-row-edit um-tip-n" title="<?php esc_attr_e( 'Edit Row', 'ultimate-member' ); ?>" data-modal="UM_edit_row" data-modal-size="normal" data-dynamic-content="um_admin_edit_field_popup" data-arg1="row" data-arg2="<?php echo esc_attr( $this->form_id ); ?>" data-arg3="<?php echo esc_attr( $row_id ); ?>"><i class="um-faicon-pencil"></i></a>
<span class="um-admin-drag-row-start"><i class="um-icon-arrow-move"></i></span>
<?php if ( '_um_row_1' !== $row_id ) { ?>
<a href="javascript:void(0);" class="um-admin-tipsy-n" title="<?php esc_attr_e( 'Delete Row', 'ultimate-member' ); ?>" data-remove_element="um-admin-drag-row"><i class="um-faicon-trash-o"></i></a>
<a href="javascript:void(0);" class="um-tip-n" title="<?php esc_attr_e( 'Delete Row', 'ultimate-member' ); ?>" data-remove_element="um-admin-drag-row"><i class="um-faicon-trash-o"></i></a>
<?php } ?>
</div>
<div class="um-admin-clear"></div>
<div class="clear"></div>
<div class="um-admin-drag-rowsubs">
<?php
$row_fields = $this->get_fields_by_row( $row_id );
@@ -515,15 +514,15 @@ if ( ! class_exists( 'um\admin\core\Admin_Builder' ) ) {
<div class="um-admin-drag-rowsub-icons">
<span class="um-admin-drag-rowsub-start"><i class="um-icon-arrow-move"></i></span>
<?php if ( $c > 0 ) { ?>
<a href="javascript:void(0);" class="um-admin-tipsy-n" title="<?php esc_attr_e( 'Delete Row', 'ultimate-member' ); ?>" data-remove_element="um-admin-drag-rowsub"><i class="um-faicon-trash-o"></i></a>
<a href="javascript:void(0);" class="um-tip-n" title="<?php esc_attr_e( 'Delete Row', 'ultimate-member' ); ?>" data-remove_element="um-admin-drag-rowsub"><i class="um-faicon-trash-o"></i></a>
<?php } ?>
</div>
<div class="um-admin-clear"></div>
<div class="clear"></div>
<!-- Columns -->
<div class="um-admin-drag-col">
<?php
if ( is_array( $subrow_fields ) ) {
$subrow_fields = $this->array_sort_by_column( $subrow_fields, 'position' );
uasort( $subrow_fields, array( &$this, 'sorting_fields_by_position' ) );
foreach ( $subrow_fields as $key => $keyarray ) {
if ( ! array_key_exists( 'type', $keyarray ) || ! array_key_exists( 'title', $keyarray ) ) {
continue;
@@ -550,15 +549,15 @@ if ( ! class_exists( 'um\admin\core\Admin_Builder' ) ) {
</div>
<div class="um-admin-drag-fld-type um-field-type-<?php echo esc_attr( $field_type ); ?>"><?php echo esc_html( $field_name ); ?></div>
<div class="um-admin-drag-fld-icons um-field-type-<?php echo esc_attr( $field_type ); ?>">
<a href="javascript:void(0);" class="um-admin-tipsy-n" title="<?php esc_attr_e( 'Edit', 'ultimate-member' ); ?>" data-modal="UM_edit_field" data-modal-size="normal" data-dynamic-content="um_admin_edit_field_popup" data-arg1="<?php echo esc_attr( $field_type ); ?>" data-arg2="<?php echo esc_attr( $this->form_id ); ?>" data-arg3="<?php echo esc_attr( $key ); ?>"><i class="um-faicon-pencil"></i></a>
<a href="javascript:void(0);" class="um-admin-tipsy-n um_admin_duplicate_field" title="<?php esc_attr_e( 'Duplicate', 'ultimate-member' ); ?>" data-silent_action="um_admin_duplicate_field" data-arg1="<?php echo esc_attr( $key ); ?>" data-arg2="<?php echo esc_attr( $this->form_id ); ?>"><i class="um-faicon-files-o"></i></a>
<a href="javascript:void(0);" class="um-tip-n" title="<?php esc_attr_e( 'Edit', 'ultimate-member' ); ?>" data-modal="UM_edit_field" data-modal-size="normal" data-dynamic-content="um_admin_edit_field_popup" data-arg1="<?php echo esc_attr( $field_type ); ?>" data-arg2="<?php echo esc_attr( $this->form_id ); ?>" data-arg3="<?php echo esc_attr( $key ); ?>"><i class="um-faicon-pencil"></i></a>
<a href="javascript:void(0);" class="um-tip-n um_admin_duplicate_field" title="<?php esc_attr_e( 'Duplicate', 'ultimate-member' ); ?>" data-silent_action="um_admin_duplicate_field" data-arg1="<?php echo esc_attr( $key ); ?>" data-arg2="<?php echo esc_attr( $this->form_id ); ?>"><i class="um-faicon-files-o"></i></a>
<?php if ( 'group' === $field_type ) { ?>
<a href="javascript:void(0);" class="um-admin-tipsy-n" title="<?php esc_attr_e( 'Delete Group', 'ultimate-member' ); ?>" data-remove_element="um-admin-drag-fld.um-field-type-group" data-silent_action="um_admin_remove_field" data-arg1="<?php echo esc_attr( $key ); ?>" data-arg2="<?php echo esc_attr( $this->form_id ); ?>"><i class="um-faicon-trash-o"></i></a>
<a href="javascript:void(0);" class="um-tip-n" title="<?php esc_attr_e( 'Delete Group', 'ultimate-member' ); ?>" data-remove_element="um-admin-drag-fld.um-field-type-group" data-silent_action="um_admin_remove_field" data-arg1="<?php echo esc_attr( $key ); ?>" data-arg2="<?php echo esc_attr( $this->form_id ); ?>"><i class="um-faicon-trash-o"></i></a>
<?php } else { ?>
<a href="javascript:void(0);" class="um-admin-tipsy-n" title="<?php esc_attr_e( 'Delete', 'ultimate-member' ); ?>" data-silent_action="um_admin_remove_field" data-arg1="<?php echo esc_attr( $key ); ?>" data-arg2="<?php echo esc_attr( $this->form_id ); ?>"><i class="um-faicon-trash-o"></i></a>
<a href="javascript:void(0);" class="um-tip-n" title="<?php esc_attr_e( 'Delete', 'ultimate-member' ); ?>" data-silent_action="um_admin_remove_field" data-arg1="<?php echo esc_attr( $key ); ?>" data-arg2="<?php echo esc_attr( $this->form_id ); ?>"><i class="um-faicon-trash-o"></i></a>
<?php } ?>
</div>
<div class="um-admin-clear"></div>
<div class="clear"></div>
<?php if ( 'group' === $field_type ) { ?>
<div class="um-admin-drag-group"></div>
<?php } ?>
@@ -569,7 +568,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Builder' ) ) {
?>
</div>
<div class="um-admin-drag-col-dynamic"></div>
<div class="um-admin-clear"></div>
<div class="clear"></div>
</div>
<?php
}
@@ -655,6 +654,9 @@ if ( ! class_exists( 'um\admin\core\Admin_Builder' ) ) {
}
} elseif ( false !== strpos( $key, 'um_editor' ) ) {
if ( 'block' === $array['post']['_type'] ) {
// the nl2br() function does not work as expected, there is an extra empty line left
// use str_replace for correct work
$val = str_replace( "\r\n\r\n", '<br>', $val );
$save[ $field_id ]['content'] = wp_kses_post( $val );
} else {
$save[ $field_id ]['content'] = sanitize_textarea_field( $val );
@@ -821,10 +823,10 @@ if ( ! class_exists( 'um\admin\core\Admin_Builder' ) ) {
</div>
<div class="um-admin-icons">
<?php foreach ( UM()->fonticons()->all as $icon ) { ?>
<span data-code="<?php echo esc_attr( $icon ); ?>" title="<?php echo esc_attr( $icon ); ?>" class="um-admin-tipsy-n"><i class="<?php echo esc_attr( $icon ); ?>"></i></span>
<span data-code="<?php echo esc_attr( $icon ); ?>" title="<?php echo esc_attr( $icon ); ?>" class="um-tip-n"><i class="<?php echo esc_attr( $icon ); ?>"></i></span>
<?php } ?>
</div>
<div class="um-admin-clear"></div>
<div class="clear"></div>
<?php
$output = ob_get_clean();
break;
@@ -875,21 +877,25 @@ if ( ! class_exists( 'um\admin\core\Admin_Builder' ) ) {
<div class="um-admin-btns">
<?php
if ( UM()->builtin()->custom_fields ) {
foreach ( UM()->builtin()->custom_fields as $field_key => $field_data ) {
if ( empty( $field_data['title'] ) || empty( $field_data['type'] ) ) {
foreach ( UM()->builtin()->custom_fields as $field_key => $array ) {
if ( empty( $array['title'] ) || empty( $array['type'] ) ) {
continue;
}
?>
<?php // translators: %s is a field metakey. ?>
<a href="javascript:void(0);" class="button with-icon" <?php disabled( in_array( $field_key, $form_fields, true ) ); ?> data-silent_action="um_admin_add_field_from_list" data-arg1="<?php echo esc_attr( $field_key ); ?>" data-arg2="<?php echo esc_attr( $arg2 ); ?>" title="<?php echo esc_attr( sprintf( __( 'Meta Key - %s', 'ultimate-member' ), $field_key ) ); ?>"><?php echo esc_html( um_trim_string( $field_data['title'] ) ); ?> <small>(<?php echo esc_html( ucfirst( $field_data['type'] ) ); ?>)</small><span class="remove"></span></a>
<a href="javascript:void(0);" class="button with-icon" <?php disabled( in_array( $field_key, $form_fields, true ) ) ?> data-silent_action="um_admin_add_field_from_list" data-arg1="<?php echo esc_attr( $field_key ); ?>" data-arg2="<?php echo esc_attr( $arg2 ); ?>" title="<?php echo esc_attr( sprintf( __( 'Meta Key - %s', 'ultimate-member' ), $field_key ) ); ?>">
<?php echo esc_html( um_trim_string( stripslashes( $array['title'] ) ) ); ?> (<?php echo esc_html( ucfirst( $array['type'] ) ); ?>)
<span class="remove dashicons dashicons-dismiss"></span>
</a>
<?php
}
} else {
?>
<p><?php esc_html_e( 'You did not create any custom fields.', 'ultimate-member' ); ?></p>
<?php
}
?>
<p class="um-no-custom-fields"<?php if ( UM()->builtin()->custom_fields ) { ?> style="display: none;"<?php } ?>>
<?php esc_html_e( 'You did not create any custom fields.', 'ultimate-member' ); ?>
</p>
</div>
<?php
$output = ob_get_clean();
@@ -962,7 +968,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Builder' ) ) {
}
?>
</div>
<div class="um-admin-clear"></div>
<div class="clear"></div>
<?php
if ( array_key_exists( 'col3', $field_type_data ) && is_array( $field_type_data['col3'] ) ) {
foreach ( $field_type_data['col3'] as $opt ) {
@@ -970,7 +976,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Builder' ) ) {
}
}
?>
<div class="um-admin-clear"></div>
<div class="clear"></div>
<?php
if ( array_key_exists( 'col_full', $field_type_data ) && is_array( $field_type_data['col_full'] ) ) {
foreach ( $field_type_data['col_full'] as $opt ) {
@@ -1008,7 +1014,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Builder' ) ) {
<?php
if ( is_array( $field_type_data['col1'] ) ) {
foreach ( $field_type_data['col1'] as $opt ) {
$metabox->field_input( $opt );
$metabox->field_input( $opt, $arg2 );
}
}
?>
@@ -1017,24 +1023,24 @@ if ( ! class_exists( 'um\admin\core\Admin_Builder' ) ) {
<?php
if ( array_key_exists( 'col2', $field_type_data ) && is_array( $field_type_data['col2'] ) ) {
foreach ( $field_type_data['col2'] as $opt ) {
$metabox->field_input( $opt );
$metabox->field_input( $opt, $arg2 );
}
}
?>
</div>
<div class="um-admin-clear"></div>
<div class="clear"></div>
<?php
if ( array_key_exists( 'col3', $field_type_data ) && is_array( $field_type_data['col3'] ) ) {
foreach ( $field_type_data['col3'] as $opt ) {
$metabox->field_input( $opt );
$metabox->field_input( $opt, $arg2 );
}
}
?>
<div class="um-admin-clear"></div>
<div class="clear"></div>
<?php
if ( array_key_exists( 'col_full', $field_type_data ) && is_array( $field_type_data['col_full'] ) ) {
foreach ( $field_type_data['col_full'] as $opt ) {
$metabox->field_input( $opt );
$metabox->field_input( $opt, $arg2 );
}
}
+21 -16
View File
@@ -1,9 +1,11 @@
<?php
namespace um\admin\core;
use WP_Post;
if ( ! defined( 'ABSPATH' ) ) exit;
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'um\admin\core\Admin_Columns' ) ) {
@@ -14,11 +16,10 @@ if ( ! class_exists( 'um\admin\core\Admin_Columns' ) ) {
*/
class Admin_Columns {
/**
* Admin_Columns constructor.
*/
function __construct() {
public function __construct() {
add_filter( 'manage_edit-um_form_columns', array( &$this, 'manage_edit_um_form_columns' ) );
add_action( 'manage_um_form_posts_custom_column', array( &$this, 'manage_um_form_posts_custom_column' ), 10, 3 );
@@ -31,14 +32,13 @@ if ( ! class_exists( 'um\admin\core\Admin_Columns' ) ) {
// Add a post display state for special UM pages.
add_filter( 'display_post_states', array( &$this, 'add_display_post_states' ), 10, 2 );
add_filter( 'post_row_actions', array( &$this, 'remove_bulk_actions_um_form_inline' ) );
add_filter( 'post_row_actions', array( &$this, 'remove_bulk_actions_um_form_inline' ), 10, 2 );
add_filter( 'manage_users_columns', array( &$this, 'manage_users_columns' ) );
add_filter( 'manage_users_custom_column', array( &$this, 'manage_users_custom_column' ), 10, 3 );
}
/**
* Filter: Add column 'Status'
*
@@ -71,34 +71,39 @@ if ( ! class_exists( 'um\admin\core\Admin_Columns' ) ) {
return $val;
}
/**
* This will remove the "Edit" bulk action, which is actually quick edit.
*
* @param array $actions
* @param WP_Post $post
*
* @return array;
* @return array
*/
function remove_bulk_actions_um_form_inline( $actions ) {
if ( UM()->admin()->is_plugin_post_type() ) {
public function remove_bulk_actions_um_form_inline( $actions, $post ) {
$remove_quick_edit = array(
'um_form',
'um_directory',
);
$remove_quick_edit = apply_filters( 'um_cpt_remove_quick_edit', $remove_quick_edit );
if ( in_array( $post->post_type, $remove_quick_edit, true ) ) {
unset( $actions['inline hide-if-no-js'] );
return $actions;
}
return $actions;
}
/**
* Custom row actions
*
* @param array $actions
* @param \WP_Post $post
* @param WP_Post $post
*
* @return mixed
*/
function post_row_actions( $actions, $post ) {
public function post_row_actions( $actions, $post ) {
//check for your post type
if ( $post->post_type == "um_form" ) {
if ( 'um_form' === $post->post_type ) {
$actions['um_duplicate'] = '<a href="' . esc_url( $this->duplicate_uri( $post->ID ) ) . '">' . __( 'Duplicate', 'ultimate-member' ) . '</a>';
}
return $actions;
@@ -232,7 +237,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Columns' ) ) {
* Add a post display state for special UM pages in the page list table.
*
* @param array $post_states An array of post display states.
* @param \WP_Post $post The current post object.
* @param WP_Post $post The current post object.
*
* @return mixed
*/
+10 -10
View File
@@ -178,12 +178,12 @@ if ( ! class_exists( 'um\admin\core\Admin_DragDrop' ) ) {
<span class="um-admin-row-loading"><span></span></span>
<div class="um-admin-drag-row-icons">
<a href="javascript:void(0);" class="um-admin-drag-rowsub-add um-admin-tipsy-n" title="<?php esc_attr_e( 'Add Row', 'ultimate-member' ); ?>" data-row_action="add_subrow"><i class="um-icon-plus"></i></a>
<a href="javascript:void(0);" class="um-admin-drag-row-edit um-admin-tipsy-n" title="<?php esc_attr_e( 'Edit Row', 'ultimate-member' ); ?>" data-modal="UM_edit_row" data-modal-size="normal" data-dynamic-content="um_admin_edit_field_popup" data-arg1="row" data-arg2="<?php echo esc_attr( get_the_ID() ); ?>"><i class="um-faicon-pencil"></i></a>
<a href="javascript:void(0);" class="um-admin-drag-rowsub-add um-tip-n" title="<?php esc_attr_e( 'Add Row', 'ultimate-member' ); ?>" data-row_action="add_subrow"><i class="um-icon-plus"></i></a>
<a href="javascript:void(0);" class="um-admin-drag-row-edit um-tip-n" title="<?php esc_attr_e( 'Edit Row', 'ultimate-member' ); ?>" data-modal="UM_edit_row" data-modal-size="normal" data-dynamic-content="um_admin_edit_field_popup" data-arg1="row" data-arg2="<?php echo esc_attr( get_the_ID() ); ?>"><i class="um-faicon-pencil"></i></a>
<span class="um-admin-drag-row-start"><i class="um-icon-arrow-move"></i></span>
<a href="javascript:void(0);" class="um-admin-tipsy-n" title="<?php esc_attr_e( 'Delete Row', 'ultimate-member' ); ?>" data-remove_element="um-admin-drag-row"><i class="um-faicon-trash-o"></i></a>
<a href="javascript:void(0);" class="um-tip-n" title="<?php esc_attr_e( 'Delete Row', 'ultimate-member' ); ?>" data-remove_element="um-admin-drag-row"><i class="um-faicon-trash-o"></i></a>
</div>
<div class="um-admin-clear"></div>
<div class="clear"></div>
<div class="um-admin-drag-rowsubs">
<div class="um-admin-drag-rowsub">
@@ -197,15 +197,15 @@ if ( ! class_exists( 'um\admin\core\Admin_DragDrop' ) ) {
<div class="um-admin-drag-rowsub-icons">
<span class="um-admin-drag-rowsub-start"><i class="um-icon-arrow-move"></i></span>
<a href="javascript:void(0);" class="um-admin-tipsy-n" title="<?php esc_attr_e( 'Delete Row', 'ultimate-member' ); ?>" data-remove_element="um-admin-drag-rowsub"><i class="um-faicon-trash-o"></i></a>
</div><div class="um-admin-clear"></div>
<a href="javascript:void(0);" class="um-tip-n" title="<?php esc_attr_e( 'Delete Row', 'ultimate-member' ); ?>" data-remove_element="um-admin-drag-rowsub"><i class="um-faicon-trash-o"></i></a>
</div><div class="clear"></div>
<div class="um-admin-drag-col">
</div>
<div class="um-admin-drag-col-dynamic"></div>
<div class="um-admin-clear"></div>
<div class="clear"></div>
</div>
</div>
@@ -222,15 +222,15 @@ if ( ! class_exists( 'um\admin\core\Admin_DragDrop' ) ) {
<div class="um-admin-drag-rowsub-icons">
<span class="um-admin-drag-rowsub-start"><i class="um-icon-arrow-move"></i></span>
<a href="javascript:void(0);" class="um-admin-tipsy-n" title="<?php esc_attr_e( 'Delete Row', 'ultimate-member' ); ?>" data-remove_element="um-admin-drag-rowsub"><i class="um-faicon-trash-o"></i></a>
</div><div class="um-admin-clear"></div>
<a href="javascript:void(0);" class="um-tip-n" title="<?php esc_attr_e( 'Delete Row', 'ultimate-member' ); ?>" data-remove_element="um-admin-drag-rowsub"><i class="um-faicon-trash-o"></i></a>
</div><div class="clear"></div>
<div class="um-admin-drag-col">
</div>
<div class="um-admin-drag-col-dynamic"></div>
<div class="um-admin-clear"></div>
<div class="clear"></div>
</div>
+17 -15
View File
@@ -234,7 +234,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Forms' ) ) {
}
if ( ! empty( $data['description'] ) )
$html .= '<div class="um-admin-clear"></div><p class="description">' . $data['description'] . '</p>';
$html .= '<div class="clear"></div><p class="description">' . $data['description'] . '</p>';
$html .= '</td></tr>';
@@ -256,7 +256,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Forms' ) ) {
}
if ( ! empty( $data['description'] ) )
$html .= '<div class="um-admin-clear"></div><p class="description">' . $data['description'] . '</p>';
$html .= '<div class="clear"></div><p class="description">' . $data['description'] . '</p>';
$html .= '</td></tr>';
@@ -277,7 +277,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Forms' ) ) {
}
if ( ! empty( $data['description'] ) )
$html .= '<div class="um-admin-clear"></div><p class="description">' . $data['description'] . '</p>';
$html .= '<div class="clear"></div><p class="description">' . $data['description'] . '</p>';
$html .= '</td></tr>';
@@ -534,29 +534,31 @@ if ( ! class_exists( 'um\admin\core\Admin_Forms' ) ) {
*
* @return bool|string
*/
function render_icon( $field_data ) {
public function render_icon( $field_data ) {
if ( empty( $field_data['id'] ) ) {
return false;
}
$id = ( ! empty( $this->form_data['prefix_id'] ) ? $this->form_data['prefix_id'] : '' ) . '_' . $field_data['id'];
// Required modal scripts for proper functioning
UM()->admin()->enqueue()->load_modal();
$id = ( ! empty( $this->form_data['prefix_id'] ) ? $this->form_data['prefix_id'] : '' ) . '_' . $field_data['id'];
$id_attr = ' id="' . esc_attr( $id ) . '" ';
$name = $field_data['id'];
$name = ! empty( $this->form_data['prefix_id'] ) ? $this->form_data['prefix_id'] . '[' . $name . ']' : $name;
$name_attr = ' name="' . $name . '" ';
$name = $field_data['id'];
$name = ! empty( $this->form_data['prefix_id'] ) ? $this->form_data['prefix_id'] . '[' . $name . ']' : $name;
$name_attr = ' name="' . esc_attr( $name ) . '" ';
$value = $this->get_field_value( $field_data );
$value_attr = ' value="' . $value . '" ';
$value = $this->get_field_value( $field_data );
$value_attr = ' value="' . esc_attr( $value ) . '" ';
$html = '<span class="um_admin_fonticon_wrapper"><a href="javascript:void(0);" class="button" data-modal="UM_fonticons" data-modal-size="normal" data-dynamic-content="um_admin_fonticon_selector" data-arg1="" data-arg2="" data-back="">' . __( 'Choose Icon', 'ultimate-member' ) . '</a>
$html = '<span class="um_admin_fonticon_wrapper"><a href="javascript:void(0);" class="button" data-modal="UM_fonticons" data-modal-size="normal" data-dynamic-content="um_admin_fonticon_selector" data-arg1="" data-arg2="" data-back="" data-icon_field="' . esc_attr( $id ) . '">' . esc_html__( 'Choose Icon', 'ultimate-member' ) . '</a>
<span class="um-admin-icon-value">';
if ( ! empty( $value ) ) {
$html .= '<i class="' . $value . '"></i>';
$html .= '<i class="' . esc_attr( $value ) . '"></i>';
} else {
$html .= __( 'No Icon', 'ultimate-member' );
$html .= esc_html__( 'No Icon', 'ultimate-member' );
}
$html .= '</span><input type="hidden" ' . $name_attr . ' ' . $id_attr . ' ' . $value_attr . ' />';
@@ -569,12 +571,12 @@ if ( ! class_exists( 'um\admin\core\Admin_Forms' ) ) {
$html .= '</span></span>';
// Required include the fonticons modal *.php file.
UM()->metabox()->init_icon = true;
return $html;
}
/**
* @param $field_data
*
+1 -1
View File
@@ -67,7 +67,7 @@ if ( ! class_exists( 'um\admin\core\Admin_GDPR' ) ) {
'um_user_profile_url_slug_name_dash' => __( 'Profile Slug "First and Last Name with \'-\'"', 'ultimate-member' ),
'um_user_profile_url_slug_name_plus' => __( 'Profile Slug "First and Last Name with \'+\'"', 'ultimate-member' ),
'um_user_profile_url_slug_user_id' => __( 'Profile Slug "User ID"', 'ultimate-member' ),
'_um_last_login' => __( 'Last Login Timestamp', 'ultimate-member' ),
'_um_last_login' => __( 'Last Login date', 'ultimate-member' ),
//Private content extension
'_um_private_content_post_id' => __( 'Private Content Post ID', 'ultimate-member' ),
+6 -8
View File
@@ -1,12 +1,11 @@
<?php
namespace um\admin\core;
use \RecursiveDirectoryIterator;
if ( ! defined( 'ABSPATH' ) ) exit;
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'um\admin\core\Admin_Menu' ) ) {
@@ -74,7 +73,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Menu' ) ) {
?>
<script type="text/javascript">
jQuery( 'a.um-admin-rating-link' ).click(function() {
jQuery( document.body ).on('click', 'a.um-admin-rating-link', function() {
jQuery.ajax({
url: wp.ajax.settings.url,
type: 'post',
@@ -82,8 +81,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Menu' ) ) {
action: 'um_rated',
nonce: um_admin_scripts.nonce
},
success: function(){
success: function() {
}
});
jQuery(this).parent().text( jQuery( this ).data( 'rated' ) );
@@ -322,7 +320,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Menu' ) ) {
</div>
</div>
<div class="um-admin-clear"></div>
<div class="clear"></div>
<script type="text/javascript">
//<![CDATA[
+153 -53
View File
@@ -71,6 +71,9 @@ if ( ! class_exists( 'um\admin\core\Admin_Metabox' ) ) {
add_action( 'admin_head', array( &$this, 'admin_head' ), 9 );
add_action( 'admin_footer', array( &$this, 'load_modal_content' ), 9 );
add_action( 'admin_init', array( &$this, 'remove_meta_box' ), 0 );
add_filter( 'enter_title_here', array( &$this, 'enter_title_here' ), 10, 2 );
add_action( 'load-post.php', array( &$this, 'add_metabox' ), 9 );
add_action( 'load-post-new.php', array( &$this, 'add_metabox' ), 9 );
@@ -85,6 +88,34 @@ if ( ! class_exists( 'um\admin\core\Admin_Metabox' ) ) {
add_filter( 'um_member_directory_meta_value_before_save', array( UM()->member_directory(), 'before_save_data' ), 10, 3 );
}
public function remove_meta_box() {
remove_meta_box( 'submitdiv', 'um_form', 'core' );
remove_meta_box( 'slugdiv', 'um_form', 'core' );
remove_meta_box( 'submitdiv', 'um_directory', 'core' );
remove_meta_box( 'slugdiv', 'um_directory', 'core' );
}
/**
* Enter title placeholder
*
* @param string $title
* @param WP_Post $post
*
* @return string
*/
public function enter_title_here( $title, $post ) {
if ( ! isset( $post->post_type ) ) {
return $title;
}
if ( 'um_directory' === $post->post_type ) {
$title = __( 'e.g. Member Directory', 'ultimate-member' );
} elseif ( 'um_form' === $post->post_type ) {
$title = __( 'e.g. New Registration Form', 'ultimate-member' );
}
return $title;
}
/**
* Hide Woocommerce Shop page restrict content metabox
@@ -144,32 +175,28 @@ if ( ! class_exists( 'um\admin\core\Admin_Metabox' ) ) {
return false;
}
/**
* Runs on admin head
*/
function admin_head(){
public function admin_head() {
global $post;
if ( UM()->admin()->is_plugin_post_type() && isset($post->ID) ){
$this->postmeta = $this->get_custom_post_meta($post->ID);
if ( isset( $post->ID ) && UM()->admin()->screen()->is_own_post_type() ) {
$this->postmeta = $this->get_custom_post_meta( $post->ID );
}
}
/**
* Init the metaboxes
*/
function add_metabox() {
public function add_metabox() {
global $current_screen;
if ( $current_screen->id == 'um_form' ) {
add_action( 'add_meta_boxes', array(&$this, 'add_metabox_form'), 1 );
add_action( 'save_post', array(&$this, 'save_metabox_form'), 10, 2 );
}
if ( $current_screen->id == 'um_directory' ) {
add_action( 'add_meta_boxes', array(&$this, 'add_metabox_directory'), 1 );
add_action( 'save_post', array(&$this, 'save_metabox_directory'), 10, 2 );
if ( 'um_form' === $current_screen->id ) {
add_action( 'add_meta_boxes', array( &$this, 'add_metabox_form' ), 1 );
add_action( 'save_post', array( &$this, 'save_metabox_form' ), 10, 2 );
} elseif ( 'um_directory' === $current_screen->id ) {
add_action( 'add_meta_boxes', array( &$this, 'add_metabox_directory' ), 1 );
add_action( 'save_post', array( &$this, 'save_metabox_directory' ), 10, 2 );
}
//restrict content metabox
@@ -827,14 +854,15 @@ if ( ! class_exists( 'um\admin\core\Admin_Metabox' ) ) {
/**
* Add directory metabox
*/
function add_metabox_directory() {
public function add_metabox_directory() {
add_meta_box( 'submitdiv', __( 'Publish', 'ultimate-member' ), array( &$this, 'custom_submitdiv' ), 'um_directory', 'side', 'high' );
add_meta_box( 'um-admin-form-general', __( 'General Options', 'ultimate-member' ), array( &$this, 'load_metabox_directory' ), 'um_directory', 'normal', 'default' );
add_meta_box( 'um-admin-form-sorting', __( 'Sorting', 'ultimate-member' ), array( &$this, 'load_metabox_directory' ), 'um_directory', 'normal', 'default' );
add_meta_box( 'um-admin-form-profile', __( 'Profile Card', 'ultimate-member' ), array( &$this, 'load_metabox_directory' ), 'um_directory', 'normal', 'default' );
add_meta_box( 'um-admin-form-search', __( 'Search Options', 'ultimate-member' ), array( &$this, 'load_metabox_directory' ), 'um_directory', 'normal', 'default' );
add_meta_box( 'um-admin-form-pagination', __( 'Results &amp; Pagination', 'ultimate-member' ), array( &$this, 'load_metabox_directory' ), 'um_directory', 'normal', 'default' );
add_meta_box( 'um-admin-form-shortcode', __( 'Shortcode', 'ultimate-member' ), array( &$this, 'load_metabox_directory' ), 'um_directory', 'side', 'default' );
add_meta_box( 'um-admin-form-appearance', __( 'Styling: General', 'ultimate-member' ), array( &$this, 'load_metabox_directory'), 'um_directory', 'side', 'default' );
add_meta_box( 'um-admin-form-appearance', __( 'Styling: General', 'ultimate-member' ), array( &$this, 'load_metabox_directory' ), 'um_directory', 'side', 'default' );
}
@@ -987,14 +1015,19 @@ if ( ! class_exists( 'um\admin\core\Admin_Metabox' ) ) {
}
}
/**
* Add form metabox
*/
function add_metabox_form() {
public function add_metabox_form() {
add_meta_box( 'submitdiv', __( 'Publish', 'ultimate-member' ), array( $this, 'custom_submitdiv' ), 'um_form', 'side', 'high' );
if ( defined( 'UM_LEGACY_BUILDER_OFF' ) && UM_LEGACY_BUILDER_OFF ) {
// Do new metabox.
} else {
add_meta_box( 'um-admin-form-mode', __( 'Select Form Type', 'ultimate-member' ), array( &$this, 'load_metabox_form' ), 'um_form', 'normal', 'default' );
add_meta_box( 'um-admin-form-builder', __( 'Form Builder', 'ultimate-member' ), array( &$this, 'load_metabox_form' ), 'um_form', 'normal', 'default' );
}
add_meta_box( 'um-admin-form-mode', __( 'Select Form Type', 'ultimate-member' ), array( &$this, 'load_metabox_form' ), 'um_form', 'normal', 'default' );
add_meta_box( 'um-admin-form-builder', __( 'Form Builder', 'ultimate-member' ), array( &$this, 'load_metabox_form' ), 'um_form', 'normal', 'default' );
add_meta_box( 'um-admin-form-shortcode', __( 'Shortcode', 'ultimate-member' ), array( &$this, 'load_metabox_form' ), 'um_form', 'side', 'default' );
add_meta_box( 'um-admin-form-register_customize', __( 'Customize this form', 'ultimate-member' ), array( &$this, 'load_metabox_form' ), 'um_form', 'side', 'default' );
@@ -1063,6 +1096,57 @@ if ( ! class_exists( 'um\admin\core\Admin_Metabox' ) ) {
do_action( 'um_admin_custom_login_metaboxes' );
}
/**
*
*/
public function custom_submitdiv() {
global $post, $current_screen;
?>
<div class="submitbox" id="submitpost">
<div id="major-publishing-actions">
<?php do_action( 'post_submitbox_start' ); ?>
<div id="delete-action">
<?php if ( current_user_can( 'delete_post', $post->ID ) ) {
if ( ! EMPTY_TRASH_DAYS ) {
$delete_text = __( 'Delete Permanently', 'ultimate-member' );
} else {
$delete_text = __( 'Move to Trash', 'ultimate-member' );
} ?>
<a class="submitdelete deletion" href="<?php echo esc_url( get_delete_post_link( $post->ID ) ); ?>"> <?php echo esc_html( $delete_text ); ?> </a>
<?php } ?>
</div>
<div id="publishing-action">
<span class="spinner"></span>
<?php if ( ! in_array( $post->post_status, array( 'publish', 'future', 'private' ) ) || 0 == $post->ID ) {
$post_type = $post->post_type; // get current post_type
$post_type_object = get_post_type_object( $post_type );
$can_publish = current_user_can( $post_type_object->cap->publish_posts );
if ( $can_publish ) { ?>
<input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e( 'Create', 'ultimate-member' ) ?>" />
<?php submit_button( __( 'Create', 'ultimate-member' ), 'primary button-large', 'publish', false, array( 'accesskey' => 'p' ) ); ?>
<?php }
} else { ?>
<input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Update', 'ultimate-member' ); ?>" />
<?php submit_button( __( 'Update', 'ultimate-member' ), 'primary button-large', 'save', false, array( 'accesskey' => 'p' ) ); ?>
<?php } ?>
</div>
<?php
if ( isset( $current_screen->base ) && 'post' === $current_screen->base && isset( $current_screen->action ) && 'add' === $current_screen->action ) {
if ( isset( $_GET['um_mode'] ) ) {
$mode = sanitize_key( $_GET['um_mode'] ); ?>
<input type="hidden" name="form[_um_mode]" id="form__um_mode" value="<?php echo esc_attr( $mode ); ?>" />
<?php }
}?>
<div class="clear"></div>
</div>
</div>
<?php
}
/**
* Save directory metabox
*
@@ -1267,10 +1351,16 @@ if ( ! class_exists( 'um\admin\core\Admin_Metabox' ) ) {
*/
public function field_input( $attribute, $form_id = null, $field_args = array() ) {
if ( $this->in_edit == true ) { // we're editing a field
$real_attr = substr( $attribute, 1 );
if ( $this->in_edit ) {
// We're editing a field.
$real_attr = substr( $attribute, 1 );
$this->edit_mode_value = isset( $this->edit_array[ $real_attr ] ) ? $this->edit_array[ $real_attr ] : null;
}
$form_data = UM()->query()->post_data( $form_id );
if ( empty( $form_data['mode'] ) && ! empty( $_POST['form_mode'] ) ) {
// Case when we add new form with no form mode in postmeta. Then get form mode from AJAX request.
$form_data['mode'] = sanitize_key( $_POST['form_mode'] );
}
switch ( $attribute ) {
default:
@@ -1404,6 +1494,9 @@ if ( ! class_exists( 'um\admin\core\Admin_Metabox' ) ) {
break;
case '_validate':
if ( array_key_exists( 'mode', $form_data ) && 'login' === $form_data['mode'] && in_array( $field_args['metakey'], array( 'username', 'user_login', 'user_email' ), true ) ) {
return;
}
?>
<p><label for="_validate"><?php _e( 'Validate', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'Does this field require a special validation', 'ultimate-member' ) ); ?></label>
@@ -1462,18 +1555,21 @@ if ( ! class_exists( 'um\admin\core\Admin_Metabox' ) ) {
if ( 'row' === $this->set_field_type ) {
$back = 'UM_edit_row';
?>
<p class="_heading_text"><label for="_icon"><?php esc_html_e( 'Icon', 'ultimate-member' ); ?> <?php UM()->tooltip( __( 'Select an icon to appear in the field. Leave blank if you do not want an icon to show in the field.', 'ultimate-member' ) ); ?></label>
<a href="javascript:void(0);" class="button" data-modal="UM_fonticons" data-modal-size="normal" data-dynamic-content="um_admin_fonticon_selector" data-arg1="" data-arg2="" data-back="<?php echo esc_attr( $back ); ?>"><?php esc_html_e( 'Choose Icon', 'ultimate-member' ); ?></a>
<p class="_heading_text">
<label for="_icon"><?php esc_html_e( 'Icon', 'ultimate-member' ); ?> <?php UM()->tooltip( __( 'Select an icon to appear in the field. Leave blank if you do not want an icon to show in the field.', 'ultimate-member' ) ); ?></label>
<span class="um_admin_fonticon_wrapper">
<a href="javascript:void(0);" class="button" data-modal="UM_fonticons" data-modal-size="normal" data-dynamic-content="um_admin_fonticon_selector" data-arg1="" data-arg2="" data-back="<?php echo esc_attr( $back ); ?>"><?php esc_html_e( 'Choose Icon', 'ultimate-member' ); ?></a>
<span class="um-admin-icon-value"><?php if ( ! empty( $this->edit_mode_value ) ) { ?><i class="<?php echo esc_attr( $this->edit_mode_value ); ?>"></i><?php } else { ?><?php esc_html_e( 'No Icon', 'ultimate-member' ); ?><?php } ?></span>
<span class="um-admin-icon-value"><?php if ( ! empty( $this->edit_mode_value ) ) { ?><i class="<?php echo esc_attr( $this->edit_mode_value ); ?>"></i><?php } else { ?><?php esc_html_e( 'No Icon', 'ultimate-member' ); ?><?php } ?></span>
<input type="hidden" name="_icon" id="_icon" value="<?php echo ! empty( $this->edit_mode_value ) ? esc_attr( $this->edit_mode_value ) : ''; ?>" />
<input type="hidden" name="_icon" id="_icon" value="<?php echo ! empty( $this->edit_mode_value ) ? esc_attr( $this->edit_mode_value ) : ''; ?>" />
<?php if ( ! empty( $this->edit_mode_value ) ) { ?>
<span class="um-admin-icon-clear show"><i class="um-icon-android-cancel"></i></span>
<?php } else { ?>
<span class="um-admin-icon-clear"><i class="um-icon-android-cancel"></i></span>
<?php } ?>
<?php if ( ! empty( $this->edit_mode_value ) ) { ?>
<span class="um-admin-icon-clear show"><i class="um-icon-android-cancel"></i></span>
<?php } else { ?>
<span class="um-admin-icon-clear"><i class="um-icon-android-cancel"></i></span>
<?php } ?>
</span>
</p>
<?php
} else {
@@ -1486,18 +1582,19 @@ if ( ! class_exists( 'um\admin\core\Admin_Metabox' ) ) {
<div class="um-admin-tri">
<p>
<label for="_icon"><?php esc_html_e( 'Icon', 'ultimate-member' ); ?> <?php UM()->tooltip( __( 'Select an icon to appear in the field. Leave blank if you do not want an icon to show in the field.', 'ultimate-member' ) ); ?></label>
<span class="um_admin_fonticon_wrapper">
<a href="javascript:void(0);" class="button" data-modal="UM_fonticons" data-modal-size="normal" data-dynamic-content="um_admin_fonticon_selector" data-arg1="" data-arg2="" data-back="<?php echo esc_attr( $back ); ?>"><?php esc_html_e( 'Choose Icon', 'ultimate-member' ); ?></a>
<a href="javascript:void(0);" class="button" data-modal="UM_fonticons" data-modal-size="normal" data-dynamic-content="um_admin_fonticon_selector" data-arg1="" data-arg2="" data-back="<?php echo esc_attr( $back ); ?>"><?php esc_html_e( 'Choose Icon', 'ultimate-member' ); ?></a>
<span class="um-admin-icon-value"><?php if ( ! empty( $this->edit_mode_value ) ) { ?><i class="<?php echo esc_attr( $this->edit_mode_value ); ?>"></i><?php } else { ?><?php esc_html_e( 'No Icon', 'ultimate-member' ) ?><?php } ?></span>
<span class="um-admin-icon-value"><?php if ( ! empty( $this->edit_mode_value ) ) { ?><i class="<?php echo esc_attr( $this->edit_mode_value ); ?>"></i><?php } else { ?><?php esc_html_e( 'No Icon', 'ultimate-member' ) ?><?php } ?></span>
<input type="hidden" name="_icon" id="_icon" value="<?php echo ! empty( $this->edit_mode_value ) ? esc_attr( $this->edit_mode_value ) : ''; ?>" />
<input type="hidden" name="_icon" id="_icon" value="<?php echo ! empty( $this->edit_mode_value ) ? esc_attr( $this->edit_mode_value ) : ''; ?>" />
<?php if ( ! empty( $this->edit_mode_value ) ) { ?>
<span class="um-admin-icon-clear show"><i class="um-icon-android-cancel"></i></span>
<?php } else { ?>
<span class="um-admin-icon-clear"><i class="um-icon-android-cancel"></i></span>
<?php } ?>
<?php if ( ! empty( $this->edit_mode_value ) ) { ?>
<span class="um-admin-icon-clear show"><i class="um-icon-android-cancel"></i></span>
<?php } else { ?>
<span class="um-admin-icon-clear"><i class="um-icon-android-cancel"></i></span>
<?php } ?>
</span>
</p>
</div>
<?php
@@ -1803,10 +1900,10 @@ if ( ! class_exists( 'um\admin\core\Admin_Metabox' ) ) {
case '_pretty_format':
?>
<p><label for="_pretty_format"><?php _e( 'Displayed Date Format', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'Whether you wish to show the date in full or only show the years e.g. 25 Years', 'ultimate-member' ) ); ?></label>
<p><label for="_pretty_format"><?php esc_html_e( 'Displayed Date Format', 'ultimate-member' ); ?> <?php UM()->tooltip( __( 'Whether you wish to show the date in full or only show the years e.g. 25 Years', 'ultimate-member' ) ); ?></label>
<select name="_pretty_format" id="_pretty_format" style="width: 100%">
<option value="0" <?php selected( 0, $this->edit_mode_value ); ?>><?php _e( 'Show full date', 'ultimate-member' ) ?></option>
<option value="1" <?php selected( 1, $this->edit_mode_value ); ?>><?php _e( 'Show years only', 'ultimate-member' ) ?></option>
<option value="0" <?php selected( 0, $this->edit_mode_value ); ?>><?php esc_html_e( 'Show full date', 'ultimate-member' ); ?></option>
<option value="1" <?php selected( 1, $this->edit_mode_value ); ?>><?php esc_html_e( 'Show years only', 'ultimate-member' ); ?></option>
</select>
</p>
@@ -2395,7 +2492,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Metabox' ) ) {
case '_custom_dropdown_options_source':
?>
<p><label for="_custom_dropdown_options_source"><?php _e( 'Choices Callback', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'Add a callback source to retrieve choices.', 'ultimate-member' ) ); ?></label>
<p><label for="_custom_dropdown_options_source"><?php esc_html_e( 'Choices Callback', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'Add a callback source to retrieve choices.', 'ultimate-member' ) ); ?></label>
<input type="text" name="_custom_dropdown_options_source" id="_custom_dropdown_options_source" value="<?php echo esc_attr( $this->edit_mode_value ); ?>" />
</p>
@@ -2405,17 +2502,20 @@ if ( ! class_exists( 'um\admin\core\Admin_Metabox' ) ) {
case '_parent_dropdown_relationship':
?>
<p><label for="_parent_dropdown_relationship"><?php _e( 'Parent Option', 'ultimate-member' ) ?><?php UM()->tooltip( __( 'Dynamically populates the option based from selected parent option.', 'ultimate-member' ) ); ?></label>
<p><label for="_parent_dropdown_relationship"><?php esc_html_e( 'Parent Option', 'ultimate-member' ); ?><?php UM()->tooltip( __( 'Dynamically populates the option based from selected parent option.', 'ultimate-member' ) ); ?></label>
<select name="_parent_dropdown_relationship" id="_parent_dropdown_relationship" style="width: 100%">
<option value=""><?php _e( 'No Selected', 'ultimate-member' ) ?></option>
<?php if ( UM()->builtin()->custom_fields ) {
foreach ( UM()->builtin()->custom_fields as $field_key => $array ) {
if ( in_array( $array['type'], array( 'select' ) ) && ( ! isset( $field_args['metakey'] ) || $field_args['metakey'] != $array['metakey'] ) && isset( $array['title'] ) ) { ?>
<option value="<?php echo esc_attr( $array['metakey'] ) ?>" <?php selected( $array['metakey'], $this->edit_mode_value ) ?>><?php echo $array['title'] ?></option>
<?php }
<option value=""><?php esc_html_e( 'No Selected', 'ultimate-member' ); ?></option>
<?php
if ( UM()->builtin()->custom_fields ) {
foreach ( UM()->builtin()->custom_fields as $array ) {
if ( array_key_exists( 'type', $array ) && 'select' === $array['type'] && ( ! isset( $field_args['metakey'] ) || $field_args['metakey'] != $array['metakey'] ) && isset( $array['title'] ) ) {
?>
<option value="<?php echo esc_attr( $array['metakey'] ); ?>" <?php selected( $array['metakey'], $this->edit_mode_value ); ?>><?php echo esc_html( $array['title'] ); ?></option>
<?php
}
}
} ?>
}
?>
</select>
</p>
@@ -29,8 +29,6 @@ if ( ! class_exists( 'um\admin\core\Admin_Navmenu' ) ) {
);
add_action( 'customize_controls_print_footer_scripts', array( &$this, '_wp_template' ) );
add_action( 'load-customize.php', array( &$this, 'enqueue_nav_menus_scripts' ) );
add_action( 'wp_update_nav_menu_item', array( &$this, '_save' ), 10, 3 );
add_action( 'wp_nav_menu_item_custom_fields', array( $this, 'wp_nav_menu_item_custom_fields' ), 20, 5 );
@@ -149,46 +147,6 @@ if ( ! class_exists( 'um\admin\core\Admin_Navmenu' ) ) {
}
}
/**
*
*/
function enqueue_nav_menus_scripts() {
add_action( 'admin_enqueue_scripts', array( &$this, 'admin_enqueue_scripts' ) );
}
/**
*
*/
function admin_enqueue_scripts() {
UM()->admin()->enqueue()->load_nav_manus_scripts();
$menu_restriction_data = array();
$menus = get_posts( 'post_type=nav_menu_item&numberposts=-1' );
foreach ( $menus as $data ) {
$_nav_roles_meta = get_post_meta( $data->ID, 'menu-item-um_nav_roles', true );
$um_nav_roles = array();
if ( $_nav_roles_meta ) {
foreach ( $_nav_roles_meta as $key => $value ) {
if ( is_int( $key ) ) {
$um_nav_roles[] = $value;
}
}
}
$menu_restriction_data[ $data->ID ] = array(
'um_nav_public' => get_post_meta( $data->ID, 'menu-item-um_nav_public', true ),
'um_nav_roles' => $um_nav_roles,
);
}
wp_localize_script( 'um_admin_nav_manus', 'um_menu_restriction_data', $menu_restriction_data );
}
/**
*
*/
+12 -12
View File
@@ -55,7 +55,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) {
$this->child_theme_required();
// removed for now to avoid the bad reviews
// Removed for now to avoid the bad reviews.
//$this->reviews_notice();
//$this->future_changed();
@@ -83,7 +83,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) {
}
public function create_list_for_screen() {
if ( UM()->admin()->is_um_screen() ) {
if ( UM()->admin()->screen()->is_own_screen() ) {
$this->secure_settings();
}
}
@@ -403,7 +403,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) {
<p>
<a href="<?php echo esc_url( $url ); ?>" class="button button-primary"><?php esc_html_e( 'Create Pages', 'ultimate-member' ); ?></a>
&nbsp;
<a href="javascript:void(0);" class="button-secondary um_secondary_dimiss"><?php esc_html_e( 'No thanks', 'ultimate-member' ); ?></a>
<a href="javascript:void(0);" class="button-secondary um_secondary_dismiss"><?php esc_html_e( 'No thanks', 'ultimate-member' ); ?></a>
</p>
<?php
@@ -682,23 +682,23 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) {
}
}
/**
*
* @note Removed for now to avoid the bad reviews.
* @deprecated 2.8.0
*/
function reviews_notice() {
private function reviews_notice() {
$first_activation_date = get_option( 'um_first_activation_date', false );
if ( empty( $first_activation_date ) ) {
return;
}
if ( $first_activation_date + 2*WEEK_IN_SECONDS > time() ) {
if ( $first_activation_date + 2 * WEEK_IN_SECONDS > time() ) {
return;
}
ob_start(); ?>
ob_start();
?>
<div id="um_start_review_notice">
<p>
@@ -713,7 +713,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) {
<a href="javascript:void(0);" id="um_add_review_bad"><?php _e('I don\'t like the plugin', 'ultimate-member' ) ?></a>
</p>
</div>
<div class="um_hidden_notice" data-key="love">
<div class="um-hidden-notice" data-key="love">
<p>
<?php printf( __( 'Great! We\'re happy to hear that you love the plugin. It would be amazing if you could let others know why you like %s by leaving a review of the plugin. This will help %s to grow and become more popular and would be massively appreciated by us!' ), UM_PLUGIN_NAME, UM_PLUGIN_NAME ); ?>
</p>
@@ -722,7 +722,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) {
<a href="https://wordpress.org/support/plugin/ultimate-member/reviews/?rate=5#new-post" target="_blank" class="button button-primary um_review_link"><?php _e( 'Leave Review', 'ultimate-member' ) ?></a>
</p>
</div>
<div class="um_hidden_notice" data-key="good">
<div class="um-hidden-notice" data-key="good">
<p>
<?php _e( 'We\'re glad to hear that you like the plugin but we would love to get your feedback so we can make the plugin better.' ); ?>
</p>
@@ -731,7 +731,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) {
<a href="https://ultimatemember.com/feedback/" target="_blank" class="button button-primary um_review_link"><?php _e( 'Provide Feedback', 'ultimate-member' ) ?></a>
</p>
</div>
<div class="um_hidden_notice" data-key="bad">
<div class="um-hidden-notice" data-key="bad">
<p>
<?php printf( __( 'We\'re sorry to hear that. If you\'re having the issue with the plugin you can create a topic on our <a href="%s" target="_blank">support forum</a> and we will try and help you out with the issue. Alternatively if you have an idea on how we can make the plugin better or want to tell us what you don\'t like about the plugin you can tell us know by giving us feedback.' ), 'https://wordpress.org/support/plugin/ultimate-member' ); ?>
</p>
+52 -102
View File
@@ -245,12 +245,10 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
}
}
/**
*
*/
public function init_variables() {
$settings_map = array();
$general_pages_fields = array(
@@ -2768,24 +2766,19 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
if ( ! empty( $license->error ) ) {
switch ( $license->error ) {
case 'expired' :
case 'expired':
$class = 'expired';
$messages[] = sprintf(
// translators: %1$s is a expiry date; %2$s is a renew link.
// translators: %1$s is an expiry date; %2$s is a renewal link.
__( 'Your license key expired on %1$s. Please <a href="%2$s" target="_blank">renew your license key</a>.', 'ultimate-member' ),
date_i18n( get_option( 'date_format' ), strtotime( $license->expires, current_time( 'timestamp' ) ) ),
wp_date( get_option( 'date_format', 'F j, Y' ), strtotime( $license->expires ), new \DateTimeZone( 'UTC' ) ),
'https://ultimatemember.com/checkout/?edd_license_key=' . $value . '&utm_campaign=admin&utm_source=licenses&utm_medium=expired'
);
$license_status = 'license-' . $class . '-notice';
break;
case 'revoked' :
$class = 'error';
case 'revoked':
$class = 'error';
$messages[] = sprintf(
// translators: %s: support link name.
__( 'Your license key has been disabled. Please <a href="%s" target="_blank">contact support</a> for more information.', 'ultimate-member' ),
@@ -2793,12 +2786,9 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
);
$license_status = 'license-' . $class . '-notice';
break;
case 'missing' :
$class = 'error';
case 'missing':
$class = 'error';
$messages[] = sprintf(
// translators: %s: account page.
__( 'Invalid license. Please <a href="%s" target="_blank">visit your account page</a> and verify it.', 'ultimate-member' ),
@@ -2806,13 +2796,10 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
);
$license_status = 'license-' . $class . '-notice';
break;
case 'invalid' :
case 'site_inactive' :
$class = 'error';
case 'invalid':
case 'site_inactive':
$class = 'error';
$messages[] = sprintf(
// translators: %1$s is a item name title; %2$s is a account page.
__( 'Your %1$s is not active for this URL. Please <a href="%2$s" target="_blank">visit your account page</a> to manage your license key URLs.', 'ultimate-member' ),
@@ -2821,41 +2808,30 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
);
$license_status = 'license-' . $class . '-notice';
break;
case 'item_name_mismatch' :
case 'item_name_mismatch':
$class = 'error';
// translators: %s: item name.
$messages[] = sprintf( __( 'This appears to be an invalid license key for %s.', 'ultimate-member' ), $field_data['item_name'] );
$license_status = 'license-' . $class . '-notice';
break;
case 'no_activations_left':
$class = 'error';
// translators: %s: account link.
$messages[] = sprintf( __( 'Your license key has reached its activation limit. <a href="%s">View possible upgrades</a> now.', 'ultimate-member' ), 'https://ultimatemember.com/account' );
$license_status = 'license-' . $class . '-notice';
break;
case 'license_not_activable':
$class = 'error';
$class = 'error';
$messages[] = __( 'The key you entered belongs to a bundle, please use the product specific license key.', 'ultimate-member' );
$license_status = 'license-' . $class . '-notice';
break;
default :
default:
$class = 'error';
$error = ! empty( $license->error ) ? $license->error : __( 'unknown_error', 'ultimate-member' );
$error = ! empty( $license->error ) ? $license->error : __( 'unknown_error', 'ultimate-member' );
// translators: %1$s is an error; %2$s is a support link.
$messages[] = sprintf( __( 'There was an error with this license key: %1$s. Please <a href="%2$s">contact our support team</a>.', 'ultimate-member' ), $error, 'https://ultimatemember.com/support' );
@@ -2870,14 +2846,12 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
$license_status = 'license-' . $class . '-notice';
}
} elseif ( ! empty( $license->errors ) ) {
$errors = array_keys( $license->errors );
$errors = array_keys( $license->errors );
$errors_data = array_values( $license->errors );
$class = 'error';
$error = ! empty( $errors[0] ) ? $errors[0] : __( 'unknown_error', 'ultimate-member' );
$class = 'error';
$error = ! empty( $errors[0] ) ? $errors[0] : __( 'unknown_error', 'ultimate-member' );
$errors_data = ! empty( $errors_data[0][0] ) ? ', ' . $errors_data[0][0] : '';
// translators: %1$s is an error; %2$s is a error data; %3$s is a support link.
$messages[] = sprintf( __( 'There was an error with this license key: %1$s%2$s. Please <a href="%3$s">contact our support team</a>.', 'ultimate-member' ), $error, $errors_data, 'https://ultimatemember.com/support' );
@@ -2886,25 +2860,20 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
} else {
switch( $license->license ) {
case 'expired' :
$class = 'expired';
switch ( $license->license ) {
case 'expired':
$class = 'expired';
$messages[] = sprintf(
// translators: %1$s is a expiry date; %2$s is a renew link.
__( 'Your license key expired on %1$s. Please <a href="%2$s" target="_blank">renew your license key</a>.', 'ultimate-member' ),
date_i18n( get_option( 'date_format' ), strtotime( $license->expires, current_time( 'timestamp' ) ) ),
wp_date( get_option( 'date_format', 'F j, Y' ), strtotime( $license->expires ), new \DateTimeZone( 'UTC' ) ),
'https://ultimatemember.com/checkout/?edd_license_key=' . $value . '&utm_campaign=admin&utm_source=licenses&utm_medium=expired'
);
$license_status = 'license-' . $class . '-notice';
break;
case 'revoked' :
$class = 'error';
case 'revoked':
$class = 'error';
$messages[] = sprintf(
// translators: %s: support link name.
__( 'Your license key has been disabled. Please <a href="%s" target="_blank">contact support</a> for more information.', 'ultimate-member' ),
@@ -2912,12 +2881,9 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
);
$license_status = 'license-' . $class . '-notice';
break;
case 'missing' :
$class = 'error';
case 'missing':
$class = 'error';
$messages[] = sprintf(
// translators: %s: account page.
__( 'Invalid license. Please <a href="%s" target="_blank">visit your account page</a> and verify it.', 'ultimate-member' ),
@@ -2925,13 +2891,10 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
);
$license_status = 'license-' . $class . '-notice';
break;
case 'invalid' :
case 'site_inactive' :
$class = 'error';
case 'invalid':
case 'site_inactive':
$class = 'error';
$messages[] = sprintf(
// translators: %1$s is a item name title; %2$s is a account page.
__( 'Your %1$s is not active for this URL. Please <a href="%2$s" target="_blank">visit your account page</a> to manage your license key URLs.', 'ultimate-member' ),
@@ -2940,57 +2903,46 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
);
$license_status = 'license-' . $class . '-notice';
break;
case 'item_name_mismatch' :
case 'item_name_mismatch':
$class = 'error';
// translators: %s: item name.
$messages[] = sprintf( __( 'This appears to be an invalid license key for %s.', 'ultimate-member' ), $field_data['item_name'] );
$license_status = 'license-' . $class . '-notice';
break;
case 'no_activations_left':
$class = 'error';
// translators: %s: account link.
$messages[] = sprintf( __( 'Your license key has reached its activation limit. <a href="%s">View possible upgrades</a> now.', 'ultimate-member' ), 'https://ultimatemember.com/account' );
$license_status = 'license-' . $class . '-notice';
break;
case 'license_not_activable':
$class = 'error';
$class = 'error';
$messages[] = __( 'The key you entered belongs to a bundle, please use the product specific license key.', 'ultimate-member' );
$license_status = 'license-' . $class . '-notice';
break;
case 'valid' :
case 'valid':
default:
$class = 'valid';
$now = current_time( 'timestamp' );
$expiration = strtotime( $license->expires, $now );
$now = time();
$expiration = strtotime( $license->expires );
if( 'lifetime' === $license->expires ) {
if ( 'lifetime' === $license->expires ) {
$messages[] = __( 'License key never expires.', 'ultimate-member' );
$license_status = 'license-lifetime-notice';
} elseif( $expiration > $now && $expiration - $now < ( DAY_IN_SECONDS * 30 ) ) {
} elseif ( $expiration > $now && $expiration - $now < ( DAY_IN_SECONDS * 30 ) ) {
$messages[] = sprintf(
// translators: %1$s is a expiry date; %2$s is a renew link.
// translators: %1$s is an expiry date; %2$s is a renewal link.
__( 'Your license key expires soon! It expires on %1$s. <a href="%2$s" target="_blank">Renew your license key</a>.', 'ultimate-member' ),
date_i18n( get_option( 'date_format' ), strtotime( $license->expires, current_time( 'timestamp' ) ) ),
wp_date( get_option( 'date_format', 'F j, Y' ), strtotime( $license->expires ), new \DateTimeZone( 'UTC' ) ),
'https://ultimatemember.com/checkout/?edd_license_key=' . $value . '&utm_campaign=admin&utm_source=licenses&utm_medium=renew'
);
@@ -3001,7 +2953,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
$messages[] = sprintf(
// translators: %s: expiry date.
__( 'Your license key expires on %s.', 'ultimate-member' ),
date_i18n( get_option( 'date_format' ), strtotime( $license->expires, current_time( 'timestamp' ) ) )
wp_date( get_option( 'date_format', 'F j, Y' ), strtotime( $license->expires ), new \DateTimeZone( 'UTC' ) )
);
$license_status = 'license-expiration-date-notice';
@@ -3009,11 +2961,8 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
}
break;
}
}
} else {
$class = 'empty';
@@ -3025,22 +2974,23 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
$license_status = null;
} ?>
}
?>
<tr class="um-settings-line">
<th><label for="um_options_<?php echo esc_attr( $field_data['id'] ) ?>"><?php echo esc_html( $field_data['label'] ) ?></label></th>
<th><label for="um_options_<?php echo esc_attr( $field_data['id'] ); ?>"><?php echo esc_html( $field_data['label'] ); ?></label></th>
<td>
<form method="post" action="" name="um-settings-form" class="um-settings-form">
<input type="hidden" value="save" name="um-settings-action" />
<input type="hidden" name="licenses_settings" value="1" />
<?php $um_settings_nonce = wp_create_nonce( 'um-settings-nonce' ); ?>
<input type="hidden" name="__umnonce" value="<?php echo esc_attr( $um_settings_nonce ); ?>" />
<input type="text" id="um_options_<?php echo esc_attr( $field_data['id'] ) ?>" name="um_options[<?php echo esc_attr( $field_data['id'] ) ?>]" value="<?php echo $value ?>" class="um-option-field um-long-field" data-field_id="<?php echo esc_attr( $field_data['id'] ) ?>" />
<input type="text" id="um_options_<?php echo esc_attr( $field_data['id'] ); ?>" name="um_options[<?php echo esc_attr( $field_data['id'] ); ?>]" value="<?php echo $value ?>" class="um-option-field um-long-field" data-field_id="<?php echo esc_attr( $field_data['id'] ); ?>" />
<?php if ( ! empty( $field_data['description'] ) ) { ?>
<div class="description"><?php echo $field_data['description'] ?></div>
<div class="description"><?php echo $field_data['description']; ?></div>
<?php } ?>
<?php if ( ! empty( $value ) && ( ( is_object( $license ) && 'valid' == $license->license ) || 'valid' == $license ) ) { ?>
<?php if ( ! empty( $value ) && ( ( is_object( $license ) && 'valid' === $license->license ) || 'valid' === $license ) ) { ?>
<input type="button" class="button um_license_deactivate" id="<?php echo esc_attr( $field_data['id'] ) ?>_deactivate" value="<?php esc_attr_e( 'Clear License', 'ultimate-member' ) ?>"/>
<?php } elseif ( empty( $value ) ) { ?>
<input type="submit" name="submit" id="submit" class="button button-primary" value="<?php esc_attr_e( 'Activate', 'ultimate-member' ) ?>" />
@@ -3063,8 +3013,8 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
</tbody>
</table>
</div>
<?php $section = ob_get_clean();
<?php
$section = ob_get_clean();
return $section;
}
@@ -3104,7 +3054,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
<?php
if ( false !== $um_check_version ) {
// translators: %s: Last checking templates time.
echo esc_html( sprintf( __( 'Last update: %s. You could re-check changes manually.', 'ultimate-member' ), wp_date( get_option( 'date_format', 'Y-m-d' ) . ' ' . get_option( 'time_format', 'H:i:s' ), $um_check_version ) ) );
echo esc_html( sprintf( __( 'Last update: %s. You could re-check changes manually.', 'ultimate-member' ), wp_date( get_option( 'date_format', 'F j, Y' ) . ' ' . get_option( 'time_format', 'g:i a' ), $um_check_version ) ) );
} else {
esc_html_e( 'Templates haven\'t check yet. You could check changes manually.', 'ultimate-member' );
}
@@ -3130,7 +3080,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
*/
public function get_override_templates( $get_list = false ) {
$outdated_files = array();
$scan_files['um'] = $this->scan_template_files( UM_PATH . '/templates/' );
$scan_files['um'] = self::scan_template_files( UM_PATH . '/templates/' );
/**
* Filters an array of the template files for scanning versions.
*
@@ -3200,8 +3150,8 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
$core_path = UM_PATH . '/templates/' . $core_file;
$core_file_path = stristr( UM_PATH . 'templates/' . $core_file, 'wp-content' );
}
$core_version = $this->get_file_version( $core_path );
$theme_version = $this->get_file_version( $theme_file );
$core_version = self::get_file_version( $core_path );
$theme_version = self::get_file_version( $theme_file );
$status = esc_html__( 'Theme version up to date', 'ultimate-member' );
$status_code = 1;
@@ -3400,7 +3350,7 @@ $request['cmd'] = '_notify-validate';
$params = array(
'sslverify' => false,
'timeout' => 60,
'user-agent' => 'UltimateMember/' . ultimatemember_version,
'user-agent' => 'UltimateMember/' . UM_VERSION,
'body' => $request
);
@@ -3420,7 +3370,7 @@ Memory Limit: <?php echo ( um_let_to_num( WP_MEMORY_LIMIT )/( 1024 ) )."MB
--- UM Configurations ---
Version: <?php echo ultimatemember_version . "\n"; ?>
Version: <?php echo UM_VERSION . "\n"; ?>
Upgraded From: <?php echo get_option( 'um_last_version_upgrade', 'None' ) . "\n"; ?>
Current URL Method: <?php echo UM()->options()->get( 'current_url_method' ). "\n"; ?>
Cache User Profile: <?php if( UM()->options()->get( 'um_profile_object_cache_stop' ) == 1 ){ echo "No"; }else{ echo "Yes"; } echo "\n"; ?>
+132
View File
@@ -0,0 +1,132 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
function um_upgrade_usermeta_count280() {
UM()->admin()->check_ajax_nonce();
um_maybe_unset_time_limit();
global $wpdb;
$count = $wpdb->get_var(
"SELECT COUNT(*)
FROM {$wpdb->usermeta}
WHERE meta_key = 'use_gdpr_agreement' OR
meta_key = 'um_user_blocked__timestamp' OR
meta_key = '_um_last_login' OR
meta_key = 'submitted'"
);
wp_send_json_success( array( 'count' => $count ) );
}
function um_upgrade_metadata_per_user280() {
UM()->admin()->check_ajax_nonce();
um_maybe_unset_time_limit();
if ( empty( $_POST['page'] ) ) {
wp_send_json_error( __( 'Wrong data', 'ultimate-member' ) );
}
global $wpdb;
$per_page = 100;
$usermeta = $wpdb->get_results(
$wpdb->prepare(
"SELECT *
FROM {$wpdb->usermeta}
WHERE meta_key = 'use_gdpr_agreement' OR
meta_key = 'um_user_blocked__timestamp' OR
meta_key = '_um_last_login' OR
meta_key = 'submitted'
LIMIT %d, %d",
( absint( $_POST['page'] ) - 1 ) * $per_page,
$per_page
),
ARRAY_A
);
// Make non-GMT timestamp as GMT base on current wp_timezone().
$offset = (int) ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS );
foreach ( $usermeta as $usermeta_row ) {
$updated_meta = null;
if ( empty( $usermeta_row['meta_key'] ) ) {
continue;
}
$user_id = $usermeta_row['user_id'];
if ( 'use_gdpr_agreement' === $usermeta_row['meta_key'] ) {
if ( is_numeric( $usermeta_row['meta_value'] ) ) {
update_user_meta( $user_id, 'um_use_gdpr_agreement_backup', $usermeta_row['meta_value'] );
$updated_meta = gmdate( 'Y-m-d H:i:s', $usermeta_row['meta_value'] );
}
} elseif ( '_um_last_login' === $usermeta_row['meta_key'] ) {
if ( is_numeric( $usermeta_row['meta_value'] ) ) {
update_user_meta( $user_id, '_um_last_login_backup', $usermeta_row['meta_value'] );
if ( ! empty( $offset ) ) {
$updated_meta = (int) $usermeta_row['meta_value'] - $offset;
} else {
$updated_meta = (int) $usermeta_row['meta_value'];
}
$updated_meta = gmdate( 'Y-m-d H:i:s', $updated_meta );
}
} elseif ( 'submitted' === $usermeta_row['meta_key'] ) {
$unserialized_meta = maybe_unserialize( $usermeta_row['meta_value'] );
if ( isset( $unserialized_meta['use_gdpr_agreement'] ) && is_numeric( $unserialized_meta['use_gdpr_agreement'] ) ) {
update_user_meta( $user_id, 'submitted_backup', $unserialized_meta );
$unserialized_meta['use_gdpr_agreement'] = gmdate( 'Y-m-d H:i:s', $unserialized_meta['use_gdpr_agreement'] );
$updated_meta = maybe_serialize( $unserialized_meta );
}
} elseif ( 'um_user_blocked__timestamp' === $usermeta_row['meta_key'] ) {
if ( ! empty( $offset ) ) {
$last_scanned_time = $usermeta_row['meta_value'];
if ( ! empty( $last_scanned_time ) ) {
update_user_meta( $user_id, 'um_user_blocked__timestamp_backup', $last_scanned_time );
$last_scanned_time = strtotime( $last_scanned_time ) - $offset;
$updated_meta = gmdate( 'Y-m-d H:i:s', $last_scanned_time );
}
}
}
if ( isset( $updated_meta ) ) {
update_user_meta( $user_id, $usermeta_row['meta_key'], $updated_meta );
}
}
$from = ( absint( $_POST['page'] ) * $per_page ) - $per_page + 1;
$to = absint( $_POST['page'] ) * $per_page;
// translators: %1$s is a from; %2$s is a to.
wp_send_json_success( array( 'message' => sprintf( __( 'Metadata from %1$s to %2$s were upgraded successfully...', 'ultimate-member' ), $from, $to ) ) );
}
function um_upgrade_update_options280() {
UM()->admin()->check_ajax_nonce();
um_maybe_unset_time_limit();
$offset = (int) ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS );
if ( ! empty( $offset ) ) {
$last_scanned_time = get_option( 'um_secure_last_time_scanned' );
if ( ! empty( $last_scanned_time ) ) {
update_option( 'um_secure_last_time_scanned_backup', $last_scanned_time );
$last_scanned_time = strtotime( $last_scanned_time ) - $offset;
$last_scanned_time = gmdate( 'Y-m-d H:i:s', $last_scanned_time );
update_option( 'um_secure_last_time_scanned', $last_scanned_time );
}
}
// delete temporarily option for fields upgrade
update_option( 'um_last_version_upgrade', '2.8.0' );
wp_send_json_success( array( 'message' => __( 'Database has been updated successfully', 'ultimate-member' ) ) );
}
+10
View File
@@ -0,0 +1,10 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
return array(
'usermeta_count280' => 'usermeta_count280',
'metadata_per_user280' => 'metadata_per_user280',
'update_options280' => 'update_options280',
);
+102
View File
@@ -0,0 +1,102 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<script type="text/javascript">
jQuery( document ).ready( function() {
var users_pages;
var current_page = 1;
var users_per_page = 100;
um_add_upgrade_log( '<?php echo esc_js( __( 'Upgrade user metadata...', 'ultimate-member' ) ); ?>' );
jQuery.ajax({
url: wp.ajax.settings.url,
type: 'POST',
dataType: 'json',
data: {
action: 'um_usermeta_count280',
nonce: um_admin_scripts.nonce
},
success: function( response ) {
if ( typeof response.data.count != 'undefined' ) {
um_add_upgrade_log( '<?php echo esc_js( __( 'There are ', 'ultimate-member' ) ); ?>' + response.data.count + '<?php echo esc_js( __( ' metarows...', 'ultimate-member' ) ); ?>' );
um_add_upgrade_log( '<?php echo esc_js( __( 'Start metadata upgrading...', 'ultimate-member' ) ); ?>' );
users_pages = Math.ceil( response.data.count / users_per_page );
setTimeout( function () {
um_update_metadata_per_user280();
}, um_request_throttle );
} else {
um_wrong_ajax();
}
},
error: function() {
um_something_wrong();
}
});
function um_update_metadata_per_user280() {
if ( current_page <= users_pages ) {
jQuery.ajax({
url: wp.ajax.settings.url,
type: 'POST',
dataType: 'json',
data: {
action: 'um_metadata_per_user280',
page: current_page,
nonce: um_admin_scripts.nonce
},
success: function( response ) {
if ( typeof response.data != 'undefined' ) {
um_add_upgrade_log( response.data.message );
current_page++;
setTimeout( function () {
um_update_metadata_per_user280();
}, um_request_throttle );
} else {
um_wrong_ajax();
}
},
error: function() {
um_something_wrong();
}
});
} else {
setTimeout( function () {
um_option_update280();
}, um_request_throttle );
}
}
//clear users cache
function um_option_update280() {
um_add_upgrade_log( '<?php echo esc_js( __( 'Update options table...', 'ultimate-member' ) ); ?>' );
jQuery.ajax({
url: wp.ajax.settings.url,
type: 'POST',
dataType: 'json',
data: {
action: 'um_update_options280',
nonce: um_admin_scripts.nonce
},
success: function( response ) {
if ( typeof response.data != 'undefined' ) {
um_add_upgrade_log( response.data.message );
//switch to the next package
um_run_upgrade();
} else {
um_wrong_ajax();
}
},
error: function() {
um_something_wrong();
}
});
}
});
</script>
+1 -1
View File
@@ -90,4 +90,4 @@
</table>
</div>
<div class="um-admin-clear"></div>
<div class="clear"></div>
@@ -129,5 +129,5 @@ $fields = apply_filters( 'um_admin_extend_directory_options_general', $fields );
)->render_form();
?>
<div class="um-admin-clear"></div>
<div class="clear"></div>
</div>
@@ -70,5 +70,5 @@ global $post_id; ?>
)
)->render_form();
?>
<div class="um-admin-clear"></div>
<div class="clear"></div>
</div>
@@ -116,5 +116,5 @@ $fields = apply_filters( 'um_admin_extend_directory_options_profile', $fields );
)
)->render_form();
?>
<div class="um-admin-clear"></div>
<div class="clear"></div>
</div>
@@ -96,5 +96,5 @@ $_um_search_filters = get_post_meta( $post_id, '_um_search_filters', true ); ?>
)
)->render_form();
?>
<div class="um-admin-clear"></div>
<div class="clear"></div>
</div>
@@ -22,7 +22,7 @@
)
) )->render_form();*/ ?>
<!-- <div class="um-admin-clear"></div>-->
<!-- <div class="clear"></div>-->
<p><?php echo UM()->shortcodes()->get_shortcode( get_the_ID() ); ?></p>
<!-- <p>--><?php //echo UM()->shortcodes()->get_default_shortcode( get_the_ID() ); ?><!--</p>-->
@@ -82,5 +82,5 @@ $fields = array(
)
)->render_form();
?>
<div class="um-admin-clear"></div>
<div class="clear"></div>
</div>
+1 -1
View File
@@ -278,4 +278,4 @@ if ( ! isset( $_REQUEST['filter'] ) || 'premium' === sanitize_key( $_REQUEST['fi
</div>
</div>
</div>
<div class="um-admin-clear"></div>
<div class="clear"></div>
+2 -2
View File
@@ -17,7 +17,7 @@ if ( empty( UM()->builder()->form_id ) ) {
</div>
<div class="um-admin-clear"></div>
<div class="clear"></div>
<div class="um-admin-drag">
@@ -25,7 +25,7 @@ if ( empty( UM()->builder()->form_id ) ) {
<?php UM()->builder()->show_builder(); ?>
</div>
<div class="um-admin-drag-addrow um-admin-tipsy-n" title="<?php esc_attr_e( 'Add Master Row', 'ultimate-member' ); ?>"
<div class="um-admin-drag-addrow um-tip-n" title="<?php esc_attr_e( 'Add Master Row', 'ultimate-member' ); ?>"
data-row_action="add_row">
<i class="um-icon-plus"></i>
</div>
@@ -110,5 +110,5 @@ $login_show_rememberme = ! isset( $post_id ) ? UM()->options()->get( 'login_sho
)
)->render_form();
?>
<div class="um-admin-clear"></div>
<div class="clear"></div>
</div>
@@ -34,5 +34,5 @@
)
)->render_form();
?>
<div class="um-admin-clear"></div>
<div class="clear"></div>
</div>
+1 -1
View File
@@ -26,4 +26,4 @@ $is_core = get_post_meta( get_the_ID(), '_um_core', true ); ?>
<input type="hidden" name="form[_um_mode]" id="form__um_mode" value="<?php echo esc_attr( UM()->query()->get_meta_value( '_um_mode', null, 'register' ) ); ?>" />
</div>
<div class="um-admin-clear"></div>
<div class="clear"></div>
@@ -221,5 +221,5 @@ $profile_show_bio = ! isset( $post_id ) ? true : get_post_meta( $pos
)
)->render_form();
?>
<div class="um-admin-clear"></div>
<div class="clear"></div>
</div>
@@ -33,5 +33,5 @@ $_um_search_fields = empty( $_um_search_fields ) ? array() : $_um_search_fields;
)
)->render_form();
?>
<div class="um-admin-clear"></div>
<div class="clear"></div>
</div>
@@ -102,5 +102,5 @@ $register_secondary_btn = ! isset( $post_id ) ? UM()->options()->get( 'register_
)
)->render_form();
?>
<div class="um-admin-clear"></div>
<div class="clear"></div>
</div>
@@ -76,5 +76,5 @@ $register_use_gdpr = ! isset( $post_id ) ? false : get_post_meta( $post_id, '_um
)
)->render_form();
?>
<div class="um-admin-clear"></div>
<div class="clear"></div>
</div>
+2 -2
View File
@@ -20,8 +20,8 @@
)
) )->render_form();*/ ?>
<!-- <div class="um-admin-clear"></div>-->
<!-- <div class="clear"></div>-->
<p><?php echo UM()->shortcodes()->get_shortcode( get_the_ID() ); ?></p>
<!-- <p>--><?php //echo UM()->shortcodes()->get_default_shortcode( get_the_ID() ); ?><!--</p>-->
</div>
</div>
+4 -3
View File
@@ -39,7 +39,7 @@ class Secure {
if ( empty( $last_scanned_capability ) ) {
delete_option( 'um_secure_scanned_details' );
update_option( 'um_secure_scan_status', 'started' );
update_option( 'um_secure_last_time_scanned', current_time( 'mysql' ) );
update_option( 'um_secure_last_time_scanned', current_time( 'mysql', true ) );
}
$scan_details = get_option( 'um_secure_scanned_details', array() );
@@ -206,6 +206,7 @@ class Secure {
$sessions_manager = WP_Session_Tokens::get_instance( $user->ID );
// Remove all the session data for all users.
$sessions_manager->destroy_all();
}
}
@@ -219,8 +220,8 @@ class Secure {
'number' => -1,
'exclude' => $arr_suspected_accounts,
'date_query' => array(
'after' => gmdate( 'F d, Y', strtotime( '-1 day', $oldest_date ) ),
'before' => gmdate( 'F d, Y', strtotime( '+1 day', $newest_date ) ),
'after' => gmdate( get_option( 'date_format', 'F j, Y' ), strtotime( '-1 day', $oldest_date ) ),
'before' => gmdate( get_option( 'date_format', 'F j, Y' ), strtotime( '+1 day', $newest_date ) ),
),
)
);
+1 -1
View File
@@ -78,7 +78,7 @@ jQuery(window).on( 'load', function($) {
jQuery(this).find('.um-account-tab[data-tab="'+current_tab+'"]').show();
jQuery(this).find('.um-account-tab:not(:visible)').find( 'input, select, textarea' ).not( ':disabled' ).addClass('um_account_inactive').prop( 'disabled', true ).attr( 'disabled', true );
um_responsive();
um_modal_responsive();
// um_modal_responsive();
}
});
});
@@ -1 +1 @@
<?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-server-side-render'), 'version' => 'fdd5ad1f74de4e2e94db');
<?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-server-side-render'), 'version' => 'a7aefdd7c81b99d7d5e3');
@@ -1 +1 @@
!function(){"use strict";var e={n:function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,{a:r}),r},d:function(t,r){for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}},t=window.wp.element,r=window.wp.data,n=window.wp.components,i=window.wp.blockEditor,o=window.wp.serverSideRender,l=e.n(o);(0,window.wp.blocks.registerBlockType)("um-block/um-member-directories",{edit:function(e){let{member_id:o,setAttributes:u}=e.attributes;const c=(0,i.useBlockProps)(),a=(0,r.useSelect)((e=>e("core").getEntityRecords("postType","um_directory",{per_page:-1,_fields:["id","title"]})));if(!a)return(0,t.createElement)("p",null,(0,t.createElement)(n.Spinner,null),wp.i18n.__("Loading...","ultimate-member"));if(0===a.length)return"No posts found.";let d=[{id:"",title:""}].concat(a).map((e=>({label:e.title.rendered,value:e.id})));return(0,t.createElement)("div",{...c},(0,t.createElement)(l(),{block:"um-block/um-member-directories",attributes:e.attributes}),(0,t.createElement)(i.InspectorControls,null,(0,t.createElement)(n.PanelBody,{title:wp.i18n.__("Select Directories","ultimate-member")},(0,t.createElement)(n.SelectControl,{label:wp.i18n.__("Select Directories","ultimate-member"),className:"um_select_directory",value:o,options:d,style:{height:"35px",lineHeight:"20px",padding:"0 7px"},onChange:t=>{e.setAttributes({member_id:t})}}))))},save:function(e){return null}}),jQuery(window).on("load",(function(e){new MutationObserver((function(e){e.forEach((function(e){jQuery(e.addedNodes).find(".um.um-directory").each((function(){var e=jQuery(this);um_ajax_get_members(e),um_slider_filter_init(e)}))}))})).observe(document,{attributes:!1,childList:!0,characterData:!1,subtree:!0})}))}();
!function(){"use strict";var e={n:function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,{a:r}),r},d:function(t,r){for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}},t=window.wp.element,r=window.wp.data,n=window.wp.components,i=window.wp.blockEditor,o=window.wp.serverSideRender,l=e.n(o);(0,window.wp.blocks.registerBlockType)("um-block/um-member-directories",{edit:function(e){let{member_id:o,setAttributes:u}=e.attributes;const c=(0,i.useBlockProps)(),a=(0,r.useSelect)((e=>e("core").getEntityRecords("postType","um_directory",{per_page:-1,_fields:["id","title"]})));if(!a)return(0,t.createElement)("p",null,(0,t.createElement)(n.Spinner,null),wp.i18n.__("Loading...","ultimate-member"));if(0===a.length)return"No posts found.";let d=[{id:"",title:""}].concat(a).map((e=>({label:e.title.rendered,value:e.id})));return(0,t.createElement)("div",{...c},(0,t.createElement)(l(),{block:"um-block/um-member-directories",attributes:e.attributes}),(0,t.createElement)(i.InspectorControls,null,(0,t.createElement)(n.PanelBody,{title:wp.i18n.__("Select Directories","ultimate-member")},(0,t.createElement)(n.SelectControl,{label:wp.i18n.__("Select Directories","ultimate-member"),className:"um_select_directory",value:o,options:d,style:{height:"35px",lineHeight:"20px",padding:"0 7px"},onChange:t=>{e.setAttributes({member_id:t})}}))))},save:function(e){return null}}),jQuery(window).on("load",(function(e){new MutationObserver((function(e){e.forEach((function(e){jQuery(e.addedNodes).find(".um.um-directory").each((function(){var e=jQuery(this);um_ajax_get_members(e),um_slider_filter_init(e),um_datepicker_filter_init(e),um_timepicker_filter_init(e)}))}))})).observe(document,{attributes:!1,childList:!0,characterData:!1,subtree:!0})}))}();
@@ -98,6 +98,8 @@ jQuery(window).on( 'load', function($) {
var directory = jQuery(this);
um_ajax_get_members( directory );
um_slider_filter_init( directory );
um_datepicker_filter_init( directory );
um_timepicker_filter_init( directory );
});
});
});
+9 -25
View File
@@ -335,32 +335,13 @@ if ( ! class_exists( 'UM_Functions' ) ) {
/**
* @return mixed|void
* @deprecated 2.8.0
*
* @return array
*/
function cpt_list() {
/**
* UM hook
*
* @type filter
* @title um_cpt_list
* @description Extend UM Custom Post Types
* @input_vars
* [{"var":"$list","type":"array","desc":"Custom Post Types list"}]
* @change_log
* ["Since: 2.0"]
* @usage
* <?php add_filter( 'um_cpt_list', 'function_name', 10, 1 ); ?>
* @example
* <?php
* add_filter( 'um_cpt_list', 'my_cpt_list', 10, 1 );
* function my_admin_pending_queue( $list ) {
* // your code here
* return $list;
* }
* ?>
*/
$cpt = apply_filters( 'um_cpt_list', array( 'um_form', 'um_directory' ) );
return $cpt;
public function cpt_list() {
_deprecated_function( __METHOD__, '2.8.0', 'UM()->common()->cpt()->get_list()' );
return UM()->common()->cpt()->get_list();
}
@@ -437,6 +418,7 @@ if ( ! class_exists( 'UM_Functions' ) ) {
'usemap' => true,
'width' => true,
),
'ol' => array(),
'ul' => array(),
'li' => array(),
'h1' => array(
@@ -662,6 +644,7 @@ if ( ! class_exists( 'UM_Functions' ) ) {
'dir' => true,
'lang' => true,
),
'ol' => array(),
'ul' => array(),
'li' => array(),
'time' => array(
@@ -702,6 +685,7 @@ if ( ! class_exists( 'UM_Functions' ) ) {
),
'em' => array(),
'i' => array(),
'b' => array(),
'q' => array(
'cite' => true,
),
+3 -3
View File
@@ -602,7 +602,7 @@ if ( ! class_exists( 'UM' ) ) {
$this->user();
$this->profile();
$this->builtin();
$this->form();
$this->form()->hooks();
$this->permalinks();
$this->modal();
$this->cron();
@@ -921,7 +921,7 @@ if ( ! class_exists( 'UM' ) ) {
/**
* @since 2.0
* @depecated 2.7.0
* @deprecated 2.7.0
*
* @return um\admin\Enqueue
*/
@@ -1203,7 +1203,7 @@ if ( ! class_exists( 'UM' ) ) {
*
* @return um\core\Form
*/
function form() {
public function form() {
if ( empty( $this->classes['form'] ) ) {
$this->classes['form'] = new um\core\Form();
}
+77 -30
View File
@@ -27,17 +27,17 @@ if ( ! class_exists( 'um\common\CPT' ) ) {
register_post_type(
'um_form',
array(
'labels' => array(
'name' => __( 'Forms', 'ultimate-member' ),
'singular_name' => __( 'Form', 'ultimate-member' ),
'add_new' => __( 'Add New', 'ultimate-member' ),
'add_new_item' => __( 'Add New Form', 'ultimate-member' ),
'edit_item' => __( 'Edit Form', 'ultimate-member' ),
'not_found' => __( 'You did not create any forms yet', 'ultimate-member' ),
'not_found_in_trash' => __( 'Nothing found in Trash', 'ultimate-member' ),
'search_items' => __( 'Search Forms', 'ultimate-member' ),
'labels' => array(
'name' => __( 'Forms', 'ultimate-member' ),
'singular_name' => __( 'Form', 'ultimate-member' ),
'add_new' => __( 'Add New', 'ultimate-member' ),
'add_new_item' => __( 'Add New Form', 'ultimate-member' ),
'edit_item' => __( 'Edit Form', 'ultimate-member' ),
'not_found' => __( 'You did not create any forms yet', 'ultimate-member' ),
'not_found_in_trash' => __( 'Nothing found in Trash', 'ultimate-member' ),
'search_items' => __( 'Search Forms', 'ultimate-member' ),
),
'capabilities' => array(
'capabilities' => array(
'edit_post' => 'manage_options',
'read_post' => 'manage_options',
'delete_post' => 'manage_options',
@@ -47,11 +47,11 @@ if ( ! class_exists( 'um\common\CPT' ) ) {
'publish_posts' => 'manage_options',
'read_private_posts' => 'manage_options',
),
'show_ui' => true,
'show_in_menu' => false,
'public' => false,
'show_in_rest' => true,
'supports' => array( 'title' ),
'show_ui' => true,
'show_in_menu' => false,
'public' => false,
'show_in_rest' => true,
'supports' => array( 'title' ),
)
);
@@ -59,17 +59,17 @@ if ( ! class_exists( 'um\common\CPT' ) ) {
register_post_type(
'um_directory',
array(
'labels' => array(
'name' => __( 'Member Directories', 'ultimate-member' ),
'singular_name' => __( 'Member Directory', 'ultimate-member' ),
'add_new' => __( 'Add New', 'ultimate-member' ),
'add_new_item' => __( 'Add New Member Directory', 'ultimate-member' ),
'edit_item' => __( 'Edit Member Directory', 'ultimate-member' ),
'not_found' => __( 'You did not create any member directories yet', 'ultimate-member' ),
'not_found_in_trash' => __( 'Nothing found in Trash', 'ultimate-member' ),
'search_items' => __( 'Search Member Directories', 'ultimate-member' ),
'labels' => array(
'name' => __( 'Member Directories', 'ultimate-member' ),
'singular_name' => __( 'Member Directory', 'ultimate-member' ),
'add_new' => __( 'Add New', 'ultimate-member' ),
'add_new_item' => __( 'Add New Member Directory', 'ultimate-member' ),
'edit_item' => __( 'Edit Member Directory', 'ultimate-member' ),
'not_found' => __( 'You did not create any member directories yet', 'ultimate-member' ),
'not_found_in_trash' => __( 'Nothing found in Trash', 'ultimate-member' ),
'search_items' => __( 'Search Member Directories', 'ultimate-member' ),
),
'capabilities' => array(
'capabilities' => array(
'edit_post' => 'manage_options',
'read_post' => 'manage_options',
'delete_post' => 'manage_options',
@@ -79,14 +79,61 @@ if ( ! class_exists( 'um\common\CPT' ) ) {
'publish_posts' => 'manage_options',
'read_private_posts' => 'manage_options',
),
'show_ui' => true,
'show_in_menu' => false,
'public' => false,
'show_in_rest' => true,
'supports' => array( 'title' ),
'show_ui' => true,
'show_in_menu' => false,
'public' => false,
'show_in_rest' => true,
'supports' => array( 'title' ),
)
);
}
}
/**
* @since 2.8.0
* @return array
*/
public function get_list() {
$cpt_list = array(
'um_form',
);
if ( UM()->options()->get( 'members_page' ) ) {
$cpt_list[] = 'um_directory';
}
/**
* Filters registered CPT in Ultimate Member.
*
* @since 2.0
* @hook um_cpt_list
*
* @param {array} $cpt_list CPT keys.
*
* @return {array} CPT keys.
*
* @example <caption>Add `my_cpt` CPT to UM CPT list.</caption>
* function um_custom_cpt_list( $cpt_list ) {
* $cpt_list[] = '{my_cpt}';
* return $cpt_list;
* }
* add_filter( 'um_cpt_list', 'um_custom_cpt_list' );
*/
return apply_filters( 'um_cpt_list', $cpt_list );
}
/**
* @param null|string $post_type
*
* @since 2.8.0
*
* @return array
*/
public function get_taxonomies_list( $post_type = null ) {
$taxonomies = apply_filters( 'um_cpt_taxonomies_list', array() );
if ( isset( $post_type ) ) {
$taxonomies = array_key_exists( $post_type, $taxonomies ) ? $taxonomies[ $post_type ] : array();
}
return $taxonomies;
}
}
}
+187 -28
View File
@@ -47,6 +47,14 @@ class Enqueue {
add_action( 'enqueue_block_assets', array( &$this, 'common_libs' ), 9 );
}
/**
* Get assets URL.
* @since 2.7.0
*
* @param string $type Can be "js", "css" or "libs".
*
* @return string
*/
public static function get_url( $type ) {
if ( ! in_array( $type, array( 'js', 'css', 'libs' ), true ) ) {
return '';
@@ -55,6 +63,13 @@ class Enqueue {
return self::$urls[ $type ];
}
/**
* Get scripts minified suffix.
*
* @since 2.7.0
*
* @return string
*/
public static function get_suffix() {
if ( empty( self::$suffix ) ) {
self::$suffix = ( ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) || ( defined( 'UM_SCRIPT_DEBUG' ) && UM_SCRIPT_DEBUG ) ) ? '' : '.min';
@@ -68,7 +83,99 @@ class Enqueue {
* @since 2.7.0
*/
protected function register_jquery_ui() {
wp_register_style( 'um_ui', self::get_url( 'libs' ) . 'jquery-ui/jquery-ui' . self::get_suffix() . '.css', array(), '1.12.1' );
wp_register_style( 'um_ui', self::get_url( 'libs' ) . 'jquery-ui/jquery-ui' . self::get_suffix() . '.css', array(), '1.13.2' );
}
/**
* Get Pickadate.JS locale.
*
* @since 2.8.0
*
* @return string
*/
private function get_pickadate_locale() {
$suffix = self::get_suffix();
$locale = get_locale();
if ( file_exists( WP_LANG_DIR . '/plugins/ultimate-member/assets/js/pickadate/' . $locale . $suffix . '.js' ) || file_exists( UM_PATH . 'assets/libs/pickadate/translations/' . $locale . $suffix . '.js' ) ) {
return $locale;
}
if ( false !== strpos( $locale, 'es_' ) ) {
$locale = 'es_ES';
} elseif ( false !== strpos( $locale, 'de_' ) ) {
$locale = 'de_DE';
} else {
switch ( $locale ) {
case 'uk':
$locale = 'uk_UA';
break;
case 'ja':
$locale = 'ja_JP';
break;
case 'ka_GE':
$locale = 'ge_GEO';
break;
case 'ary':
$locale = 'ar';
break;
case 'ca':
$locale = 'ca_ES';
break;
case 'el':
$locale = 'el_GR';
break;
case 'et':
$locale = 'et_EE';
break;
case 'eu':
$locale = 'eu_ES';
break;
case 'fa_AF':
$locale = 'fa_IR';
break;
case 'fi':
$locale = 'fi_FI';
break;
case 'hr':
$locale = 'hr_HR';
break;
case 'km':
$locale = 'km_KH';
break;
case 'lv':
$locale = 'lv_LV';
break;
case 'th':
$locale = 'th_TH';
break;
case 'vi':
$locale = 'vi_VN';
break;
case 'sr_SR':
$locale = 'sr_RS_lt';
break;
}
}
/**
* Filters Ultimate Member Pickadate.JS locale.
*
* @since 2.8.0
* @hook um_get_pickadate_locale
*
* @param {string} $locale Pickadate.JS locale.
* @param {string} $suffix Ultimate Member scripts suffix.
*
* @return {string} Pickadate.JS locale.
*
* @example <caption>Change Ultimate Member Pickadate.JS locale.</caption>
* function custom_um_get_pickadate_locale( $locale, $suffix ) {
* $locale = 'th_TH';
* return $locale;
* }
* add_filter( 'um_get_pickadate_locale', 'custom_um_get_pickadate_locale', 10, 2 );
*/
return apply_filters( 'um_get_pickadate_locale', $locale, $suffix );
}
/**
@@ -79,23 +186,41 @@ class Enqueue {
public function common_libs() {
$this->register_jquery_ui();
$suffix = self::get_suffix();
$suffix = self::get_suffix();
$libs_url = self::get_url( 'libs' );
$js_url = self::get_url( 'js' );
$css_url = self::get_url( 'css' );
wp_register_script( 'um_tipsy', self::get_url( 'libs' ) . 'tipsy/tipsy' . $suffix . '.js', array( 'jquery' ), '1.0.0a', true );
wp_register_style( 'um_tipsy', self::get_url( 'libs' ) . 'tipsy/tipsy' . $suffix . '.css', array(), '1.0.0a' );
wp_register_script( 'um_tipsy', $libs_url . 'tipsy/tipsy' . $suffix . '.js', array( 'jquery' ), '1.0.0a', true );
wp_register_style( 'um_tipsy', $libs_url . 'tipsy/tipsy' . $suffix . '.css', array(), '1.0.0a' );
// Raty JS for rating field-type.
wp_register_script( 'um_raty', self::get_url( 'libs' ) . 'raty/um-raty' . $suffix . '.js', array( 'jquery', 'wp-i18n' ), '2.6.0', true );
wp_register_style( 'um_raty', self::get_url( 'libs' ) . 'raty/um-raty' . $suffix . '.css', array(), '2.6.0' );
wp_register_script( 'um_raty', $libs_url . 'raty/um-raty' . $suffix . '.js', array( 'jquery', 'wp-i18n' ), '2.6.0', true );
wp_set_script_translations( 'um_raty', 'ultimate-member' );
wp_register_style( 'um_raty', $libs_url . 'raty/um-raty' . $suffix . '.css', array(), '2.6.0' );
// Legacy FontIcons.
wp_register_style( 'um_fonticons_ii', self::get_url( 'libs' ) . 'legacy/fonticons/fonticons-ii' . $suffix . '.css', array(), UM_VERSION ); // Ionicons
wp_register_style( 'um_fonticons_fa', self::get_url( 'libs' ) . 'legacy/fonticons/fonticons-fa' . $suffix . '.css', array(), UM_VERSION ); // FontAwesome
// wp_register_script( 'um-helptip', $this->urls['libs'] . 'helptip/helptip' . $this->suffix . '.js', array( 'jquery', 'jquery-ui-tooltip' ), '1.0.0', true );
// wp_register_style( 'um-helptip', $this->urls['libs'] . 'helptip/helptip' . $this->suffix . '.css', array( 'dashicons', 'um_ui' ), '1.0.0' );
wp_register_style( 'um_fonticons_ii', $libs_url . 'legacy/fonticons/fonticons-ii' . $suffix . '.css', array(), UM_VERSION ); // Ionicons
wp_register_style( 'um_fonticons_fa', $libs_url . 'legacy/fonticons/fonticons-fa' . $suffix . '.css', array(), UM_VERSION ); // FontAwesome
// Select2 JS.
/**
* Filters marker for dequeue select2.JS library.
*
* @since 2.0.0
* @hook um_dequeue_select2_scripts
*
* @param {bool} $dequeue_select2 Dequeue select2 assets marker. Set to `true` for dequeue scripts.
*
* @return {bool} Dequeue select2 assets. By default `false`.
*
* @example <caption>Dequeue select2 assets.</caption>
* function custom_um_dequeue_select2_scripts( $dequeue_select2 ) {
* $dequeue_select2 = true;
* return $dequeue_select2;
* }
* add_filter( 'um_dequeue_select2_scripts', 'custom_um_dequeue_select2_scripts' );
*/
$dequeue_select2 = apply_filters( 'um_dequeue_select2_scripts', false );
if ( class_exists( 'WooCommerce' ) || $dequeue_select2 ) {
wp_dequeue_style( self::$select2_handle );
@@ -104,7 +229,7 @@ class Enqueue {
wp_dequeue_script( self::$select2_handle );
wp_deregister_script( self::$select2_handle );
}
wp_register_script( self::$select2_handle, self::get_url( 'libs' ) . 'select2/select2.full' . $suffix . '.js', array( 'jquery' ), '4.0.13', true );
wp_register_script( self::$select2_handle, $libs_url . 'select2/select2.full' . $suffix . '.js', array( 'jquery' ), '4.0.13', true );
// Load a localized version for Select2.
$locale = get_locale();
$base_locale = get_locale();
@@ -120,25 +245,59 @@ class Enqueue {
}
if ( file_exists( UM_PATH . 'assets/libs/select2/i18n/' . $locale . '.js' ) ) {
wp_register_script( 'um_select2_locale', self::get_url( 'libs' ) . 'select2/i18n/' . $locale . '.js', array( 'jquery', self::$select2_handle ), '4.0.13', true );
wp_register_script( 'um_select2_locale', $libs_url . 'select2/i18n/' . $locale . '.js', array( 'jquery', self::$select2_handle ), '4.0.13', true );
self::$select2_handle = 'um_select2_locale';
}
}
wp_register_style( 'select2', $libs_url . 'select2/select2' . $suffix . '.css', array(), '4.0.13' );
wp_register_style( 'select2', self::get_url( 'libs' ) . 'select2/select2' . $suffix . '.css', array(), '4.0.13' );
//
// // Modal
// wp_register_script( 'um-modal', $this->urls['libs'] . 'modal/um-modal' . $this->suffix . '.js', array( 'jquery', 'wp-i18n', 'wp-hooks' ), UM_VERSION, true );
// wp_register_style( 'um-modal', $this->urls['libs'] . 'modal/um-modal' . $this->suffix . '.css', array(), UM_VERSION );
//
// // Common JS scripts for wp-admin and frontend both
// wp_register_script( 'um-common', $this->urls['js'] . 'common' . $this->suffix . '.js', array( 'jquery' ), UM_VERSION, true );
//
// $um_common_variables = array(
// 'locale' => get_locale(),
// );
// $um_common_variables = apply_filters( 'um_common_js_variables', $um_common_variables );
// wp_localize_script( 'um-common', 'um_common_variables', $um_common_variables );
// wp_enqueue_script( 'um-common' );
// Date-time picker (Pickadate.JS)
wp_register_script( 'um_datetime', $libs_url . 'pickadate/picker' . $suffix . '.js', array( 'jquery' ), '3.6.2', true );
wp_register_script( 'um_datetime_date', $libs_url . 'pickadate/picker.date' . $suffix . '.js', array( 'um_datetime' ), '3.6.2', true );
wp_register_script( 'um_datetime_time', $libs_url . 'pickadate/picker.time' . $suffix . '.js', array( 'um_datetime' ), '3.6.2', true );
$common_js_deps = array( 'jquery', 'wp-util', 'wp-hooks', 'wp-i18n', 'um_tipsy', 'um_datetime_date', 'um_datetime_time' );
// Load a localized version for date/time.
$locale = $this->get_pickadate_locale();
if ( $locale ) {
if ( file_exists( WP_LANG_DIR . '/plugins/ultimate-member/assets/js/pickadate/' . $locale . $suffix . '.js' ) ) {
wp_register_script( 'um_datetime_locale', content_url() . '/languages/plugins/ultimate-member/assets/js/pickadate/' . $locale . $suffix . '.js', array( 'jquery', 'um_datetime' ), '3.6.2', true );
$common_js_deps[] = 'um_datetime_locale';
} elseif ( file_exists( UM_PATH . 'assets/libs/pickadate/translations/' . $locale . $suffix . '.js' ) ) {
wp_register_script( 'um_datetime_locale', $libs_url . 'pickadate/translations/' . $locale . $suffix . '.js', array( 'jquery', 'um_datetime' ), '3.6.2', true );
$common_js_deps[] = 'um_datetime_locale';
}
}
wp_register_style( 'um_datetime', $libs_url . 'pickadate/default' . $suffix . '.css', array(), '3.6.2' );
wp_register_style( 'um_datetime_date', $libs_url . 'pickadate/default.date' . $suffix . '.css', array( 'um_datetime' ), '3.6.2' );
wp_register_style( 'um_datetime_time', $libs_url . 'pickadate/default.time' . $suffix . '.css', array( 'um_datetime' ), '3.6.2' );
wp_register_script( 'um_common', $js_url . 'common' . $suffix . '.js', $common_js_deps, UM_VERSION, true );
$um_common_variables = array(
'locale' => get_locale(),
);
/**
* Filters data array for localize frontend common scripts.
*
* @since 2.8.0
* @hook um_common_js_variables
*
* @param {array} $variables Data to localize.
*
* @return {array} Data to localize.
*
* @example <caption>Add `my_custom_variable` to common scripts to be callable via `um_common_variables.my_custom_variable` in JS.</caption>
* function um_custom_common_js_variables( $variables ) {
* $variables['{my_custom_variable}'] = '{my_custom_variable_value}';
* return $variables;
* }
* add_filter( 'um_common_js_variables', 'um_custom_common_js_variables' );
*/
$um_common_variables = apply_filters( 'um_common_js_variables', $um_common_variables );
wp_localize_script( 'um_common', 'um_common_variables', $um_common_variables );
wp_register_style( 'um_common', $css_url . 'common' . $suffix . '.css', array( 'um_tipsy', 'um_datetime_date', 'um_datetime_time', 'um_fonticons_ii', 'um_fonticons_fa' ), UM_VERSION );
}
}
+2 -2
View File
@@ -91,7 +91,7 @@ if ( ! class_exists( 'um\common\Secure' ) ) {
),
array(
'key' => 'um_user_blocked__timestamp',
'value' => gmdate( 'Y-m-d H:i:s', strtotime( 'now' ) ),
'value' => gmdate( 'Y-m-d H:i:s' ),
'compare' => '<=',
'type' => 'DATE',
),
@@ -235,7 +235,7 @@ if ( ! class_exists( 'um\common\Secure' ) ) {
}
um_reset_user();
update_user_meta( $user->ID, 'um_user_blocked', 'suspicious_activity' );
update_user_meta( $user->ID, 'um_user_blocked__timestamp', current_time( 'mysql' ) );
update_user_meta( $user->ID, 'um_user_blocked__timestamp', current_time( 'mysql', true ) );
UM()->user()->remove_cache( $user->ID );
}
+4 -4
View File
@@ -48,13 +48,13 @@ if ( ! class_exists( 'um\core\AJAX_Common' ) ) {
add_action( 'wp_ajax_um_remove_file', array( UM()->files(), 'ajax_remove_file' ) );
add_action( 'wp_ajax_nopriv_um_remove_file', array( UM()->files(), 'ajax_remove_file' ) );
add_action( 'wp_ajax_nopriv_um_fileupload', array( UM()->files(), 'ajax_file_upload' ) );
add_action( 'wp_ajax_um_fileupload', array( UM()->files(), 'ajax_file_upload' ) );
add_action( 'wp_ajax_nopriv_um_imageupload', array( UM()->files(), 'ajax_image_upload' ) );
add_action( 'wp_ajax_um_imageupload', array( UM()->files(), 'ajax_image_upload' ) );
add_action( 'wp_ajax_nopriv_um_resize_image', array( UM()->files(), 'ajax_resize_image' ) );
add_action( 'wp_ajax_um_resize_image', array( UM()->files(), 'ajax_resize_image' ) );
@@ -62,4 +62,4 @@ if ( ! class_exists( 'um\core\AJAX_Common' ) ) {
add_action( 'wp_ajax_um_get_members', array( UM()->member_directory(), 'ajax_get_members' ) );
}
}
}
}
+17 -17
View File
@@ -860,13 +860,13 @@ if ( ! class_exists( 'um\core\Builtin' ) ) {
),
'_um_last_login' => array(
'title' => __('Last Login','ultimate-member'),
'metakey' => '_um_last_login',
'type' => 'text',
'label' => __('Last Login','ultimate-member'),
'required' => 0,
'public' => 1,
'editable' => true,
'title' => __( 'Last Login', 'ultimate-member' ),
'metakey' => '_um_last_login',
'type' => 'text',
'label' => __( 'Last Login', 'ultimate-member' ),
'required' => 0,
'public' => 1,
'editable' => true,
'edit_forbidden' => 1,
),
@@ -907,17 +907,17 @@ if ( ! class_exists( 'um\core\Builtin' ) ) {
),
'birth_date' => array(
'title' => __('Birth Date','ultimate-member'),
'metakey' => 'birth_date',
'type' => 'date',
'label' => __('Birth Date','ultimate-member'),
'required' => 0,
'public' => 1,
'editable' => true,
'title' => __( 'Birth Date', 'ultimate-member' ),
'metakey' => 'birth_date',
'type' => 'date',
'label' => __( 'Birth Date', 'ultimate-member' ),
'required' => 0,
'public' => 1,
'editable' => true,
'pretty_format' => 1,
'years' => 115,
'years_x' => 'past',
'icon' => 'um-faicon-calendar'
'years' => 115,
'years_x' => 'past',
'icon' => 'um-faicon-calendar',
),
'gender' => array(
+26 -38
View File
@@ -1,26 +1,18 @@
<?php
namespace um\core;
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) exit;
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'um\core\Date_Time' ) ) {
/**
* Class Date_Time
* @package um\core
*/
class Date_Time {
/**
* Date_Time constructor.
*/
function __construct() {
}
/**
* Display time in specific format
*
@@ -28,20 +20,21 @@ if ( ! class_exists( 'um\core\Date_Time' ) ) {
*
* @return int|string
*/
function get_time( $format ) {
public function get_time( $format ) {
return current_time( $format );
}
/**
* Show a cool time difference between 2 timestamps
*
* @todo compare this function with WordPress native `human_time_diff()` and matbe refactored it.
*
* @param int $from
* @param int $to
*
* @return string
*/
function time_diff( $from, $to = '' ) {
public function time_diff( $from, $to = '' ) {
$since = '';
if ( empty( $to ) ) {
@@ -80,14 +73,13 @@ if ( ! class_exists( 'um\core\Date_Time' ) ) {
$days = 1;
}
if ( $days == 1 ) {
if ( 1 === $days ) {
// translators: %s: time.
$since = sprintf( __( 'Yesterday at %s', 'ultimate-member' ), date_i18n( get_option( 'time_format' ), $from ) );
} else {
// translators: %1$s is a date; %2$s is a time.
$since = sprintf( __( '%1$s at %2$s', 'ultimate-member' ), date_i18n( 'F d', $from ), date_i18n( get_option( 'time_format' ), $from ) );
}
} elseif ( $diff < 30 * DAY_IN_SECONDS && $diff >= WEEK_IN_SECONDS ) {
// translators: %1$s is a date; %2$s is a time.
@@ -131,40 +123,35 @@ if ( ! class_exists( 'um\core\Date_Time' ) ) {
return apply_filters( 'um_human_time_diff', $since, $diff, $from, $to );
}
/**
* Get age
* Get age.
*
* @param $then
* @todo working with timestamps in this function.
*
* @param string $then
*
* @return string
*/
function get_age( $then ) {
public function get_age( $then ) {
if ( ! $then ) {
return '';
}
$then_ts = strtotime( $then );
$then_ts = strtotime( $then );
$then_year = date( 'Y', $then_ts );
$age = date( 'Y' ) - $then_year;
$age = date( 'Y' ) - $then_year;
if ( strtotime( '+' . $age . ' years', $then_ts ) > current_time( 'timestamp' ) ) {
$age--;
}
if ( $age == 1 ) {
// translators: %s: age.
return sprintf( __( '%s year old', 'ultimate-member' ), $age );
}
if ( $age > 1 ) {
// translators: %s: age.
return sprintf( __( '%s years old', 'ultimate-member' ), $age );
}
if ( $age == 0 ) {
if ( 0 === $age ) {
return __( 'Less than 1 year old', 'ultimate-member' );
}
return '';
// translators: %s: age.
return sprintf( _n( '%s year old', '%s years old', $age, 'ultimate-member' ), $age );
}
/**
* Reformat dates
*
@@ -173,22 +160,24 @@ if ( ! class_exists( 'um\core\Date_Time' ) ) {
*
* @return string
*/
function format( $old, $new ) {
public function format( $old, $new ) {
$datetime = new \DateTime( $old );
$output = $datetime->format( $new );
$output = $datetime->format( $new );
return $output;
}
/**
* Get last 30 days as array
*
* @deprecated 2.8.0
*
* @param int $num
* @param bool $reverse
*
* @return array
*/
function get_last_days( $num = 30, $reverse = true ) {
public function get_last_days( $num = 30, $reverse = true ) {
_deprecated_function( __METHOD__, '2.8.0' );
$d = array();
for ( $i = 0; $i < $num; $i++ ) {
$d[ date('Y-m-d', strtotime( '-' . $i . ' days' ) ) ] = date( 'm/d', strtotime( '-' . $i . ' days' ) );
@@ -196,6 +185,5 @@ if ( ! class_exists( 'um\core\Date_Time' ) ) {
return ( $reverse ) ? array_reverse( $d ) : $d;
}
}
}
+109 -108
View File
@@ -74,7 +74,7 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
* Fields constructor.
*/
public function __construct() {
$this->timestamp = current_time( 'timestamp' );
$this->timestamp = time();
}
/**
@@ -596,150 +596,150 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
/**
* Checks if field has a server-side error
*
* @param string $key
* @param string $key
*
* @return boolean
* @return bool
*/
function is_error( $key ) {
public function is_error( $key ) {
return UM()->form()->has_error( $key );
}
/**
* Checks if field has a notice
*
* @param string $key
* @param string $key
*
* @return boolean
* @return bool
*/
function is_notice( $key ) {
public function is_notice( $key ) {
return UM()->form()->has_notice( $key );
}
/**
* Returns field error
*
* @param string $key
* @param string $key
*
* @return string
*/
function show_error( $key ) {
public function show_error( $key ) {
return UM()->form()->errors[ $key ];
}
/**
* Returns field notices
*
* @param string $key
* @param string $key
*
* @return string
*/
function show_notice( $key ) {
public function show_notice( $key ) {
return UM()->form()->notices[ $key ];
}
/**
* Display field label
* Display field label.
*
* @param string $label
* @param string $key
* @param array $data
* @param string $label Field label.
* @param string $key Field key.
* @param array $data Field data.
*
* @return string
* @return string
*/
function field_label( $label, $key, $data ) {
$output = null;
public function field_label( $label, $key, $data ) {
$output = null;
$output .= '<div class="um-field-label">';
if ( isset( $data['icon'] ) && $data['icon'] != '' && isset( $this->field_icons ) && $this->field_icons != 'off' && ( $this->field_icons == 'label' || true === $this->viewing ) ) {
if ( ! empty( $data['icon'] ) && isset( $this->field_icons ) && 'off' !== $this->field_icons && ( 'label' === $this->field_icons || true === $this->viewing ) ) {
$output .= '<div class="um-field-label-icon"><i class="' . esc_attr( $data['icon'] ) . '" aria-label="' . esc_attr( $label ) . '"></i></div>';
}
if ( true === $this->viewing ) {
/**
* UM hook
* Filters Ultimate Member field label on the Profile form: View mode.
* Note: $key it's field metakey.
*
* @type filter
* @title um_view_label_{$key}
* @description Change field label on view by field $key
* @input_vars
* [{"var":"$label","type":"string","desc":"Field Label"}]
* @change_log
* ["Since: 2.0"]
* @usage add_filter( 'um_view_label_{$key}', 'function_name', 10, 1 );
* @example
* <?php
* add_filter( 'um_view_label_{$key}', 'my_view_label', 10, 1 );
* function my_view_label( $label ) {
* // your code here
* @since 2.0.0
* @since 2.8.0 Added $data attribute.
*
* @hook um_view_label_{$key}
*
* @param {string} $label Field label.
* @param {string} $data Field data.
*
* @return {string} Field label.
*
* @example <caption>Change first name field label on the Profile form: view mode.</caption>
* function my_change_first_name_label( $label, $data ) {
* $label = 'My label';
* return $label;
* }
* ?>
* add_filter( 'um_view_label_first_name', 'my_change_first_name_label', 10, 2 );
*/
$label = apply_filters( "um_view_label_{$key}", $label );
$label = apply_filters( "um_view_label_{$key}", $label, $data );
} else {
/**
* UM hook
* Filters Ultimate Member field label on the Profile form: Edit mode.
* Note: $key it's field metakey.
*
* @type filter
* @title um_edit_label_{$key}
* @description Change field label on edit by field $key
* @input_vars
* [{"var":"$label","type":"string","desc":"Field Label"}]
* @change_log
* ["Since: 2.0"]
* @usage add_filter( 'um_edit_label_{$key}', 'function_name', 10, 1 );
* @example
* <?php
* add_filter( 'um_edit_label_{$key}', 'my_edit_label', 10, 1 );
* function my_edit_label( $label ) {
* // your code here
* @since 2.0.0
* @since 2.8.0 Added $data attribute.
*
* @hook um_edit_label_{$key}
*
* @param {string} $label Field label.
* @param {string} $data Field data.
*
* @return {string} Field label.
*
* @example <caption>Change first name field label on the Profile form: edit mode.</caption>
* function my_change_first_name_label( $label, $data ) {
* $label = 'My label';
* return $label;
* }
* ?>
* add_filter( 'um_edit_label_first_name', 'my_change_first_name_label', 10, 2 );
*/
$label = apply_filters( "um_edit_label_{$key}", $label );
$label = apply_filters( "um_edit_label_{$key}", $label, $data );
/**
* UM hook
* Filters Ultimate Member field label on the Profile form: Edit mode.
*
* @type filter
* @title um_edit_label_all_fields
* @description Change field label on view by field $key
* @input_vars
* [{"var":"$label","type":"string","desc":"Field Label"},
* {"var":"$data","type":"array","desc":"Field Data"}]
* @change_log
* ["Since: 2.0"]
* @usage add_filter( 'um_edit_label_all_fields', 'function_name', 10, 2 );
* @example
* <?php
* add_filter( 'um_edit_label_all_fields', 'my_edit_label_all_fields', 10, 2 );
* function my_edit_label_all_fields( $label, $data ) {
* // your code here
* @since 2.0.0
*
* @hook um_edit_label_all_fields
*
* @param {string} $label Field label.
* @param {string} $data Field data.
*
* @return {string} Field label.
*
* @example <caption>Change first name field label on the Profile form: edit mode.</caption>
* function my_change_first_name_label( $label, $data ) {
* if ( 'first_name' === $data['metakey'] ) {
* $label = 'My label';
* }
* return $label;
* }
* ?>
* add_filter( 'um_edit_label_all_fields', 'my_change_first_name_label', 10, 2 );
*/
$label = apply_filters( 'um_edit_label_all_fields', $label, $data );
}
$fields_without_metakey = UM()->builtin()->get_fields_without_metakey();
$for_attr = '';
if ( ! in_array( $data['type'], $fields_without_metakey ) ) {
$for_attr = '';
if ( ! in_array( $data['type'], $fields_without_metakey, true ) ) {
$for_attr = ' for="' . esc_attr( $key . UM()->form()->form_suffix ) . '"';
}
$output .= '<label' . $for_attr . '>' . __( $label, 'ultimate-member' ) . '</label>';
if ( ! empty( $data['help'] ) && false === $this->viewing && ! strstr( $key, 'confirm_user_pass' ) ) {
if ( ! empty( $data['help'] ) && false === $this->viewing && false === strpos( $key, 'confirm_user_pass' ) ) {
if ( ! UM()->mobile()->isMobile() ) {
if ( false === $this->disable_tooltips ) {
$output .= '<span class="um-tip um-tip-' . ( is_rtl() ? 'e' : 'w' ) . '" title="' . esc_attr__( $data['help'], 'ultimate-member' ) . '"><i class="um-icon-help-circled"></i></span>';
}
}
if ( UM()->mobile()->isMobile() || false !== $this->disable_tooltips ) {
if ( false !== $this->disable_tooltips || UM()->mobile()->isMobile() ) {
$output .= '<span class="um-tip-text">' . __( $data['help'], 'ultimate-member' ) . '</span>';
}
}
@@ -749,9 +749,8 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
return $output;
}
/**
* Output field classes
* Output field classes.
*
* @param string $key
* @param array $data
@@ -759,7 +758,7 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
*
* @return string
*/
function get_class( $key, $data, $add = null ) {
public function get_class( $key, $data, $add = null ) {
$classes = null;
$classes .= 'um-form-field ';
@@ -850,8 +849,8 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
// normal state
if ( isset( UM()->form()->post_form[ $key ] ) ) {
//show empty value for password fields
if ( strstr( $key, 'user_pass' ) && $this->set_mode != 'password' ) {
// Show empty value for password fields.
if ( 'password' !== $this->set_mode && false !== strpos( $key, 'user_pass' ) ) {
return '';
}
@@ -863,10 +862,10 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
return stripslashes_deep( UM()->form()->post_form[ $key ] );
} elseif ( um_user( $key ) && true === $this->editing ) {
} elseif ( true === $this->editing && um_user( $key ) ) {
//show empty value for password fields
if ( strstr( $key, 'user_pass' ) || $type == 'password' ) {
// Show empty value for password fields.
if ( 'password' === $type || false !== strpos( $key, 'user_pass' ) ) {
return '';
}
@@ -916,7 +915,7 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
*/
$value = apply_filters( "um_edit_{$type}_field_value", $value, $key );
} elseif ( ( um_user( $key ) || isset( $data['show_anyway'] ) ) && true === $this->viewing ) {
} elseif ( true === $this->viewing && ( um_user( $key ) || isset( $data['show_anyway'] ) ) ) {
return um_filtered_value( $key, $data );
@@ -1465,11 +1464,10 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
*
* @return array $arr_options
*/
function get_options_from_callback( $data, $type ) {
public function get_options_from_callback( $data, $type ) {
$arr_options = array();
if ( in_array( $type, array( 'select', 'multiselect' ) ) && ! empty( $data['custom_dropdown_options_source'] ) ) {
if ( ! empty( $data['custom_dropdown_options_source'] ) && in_array( $type, array( 'select', 'multiselect' ), true ) ) {
if ( $this->is_source_blacklisted( $data['custom_dropdown_options_source'] ) ) {
return $arr_options;
}
@@ -1481,7 +1479,6 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
$arr_options = call_user_func( $data['custom_dropdown_options_source'] );
}
}
}
return $arr_options;
@@ -1525,27 +1522,29 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
}
/**
* UM hook
* Filters Ultimate Member field label.
*
* @type filter
* @title um_change_field_label
* @description Change Field Label
* @input_vars
* [{"var":"$label","type":"string","desc":"Field Label"},
* {"var":"$key","type":"string","desc":"Field Key"}]
* @change_log
* ["Since: 2.0.30"]
* @usage add_filter( 'um_change_field_label', 'function_name', 10, 2 );
* @example
* <?php
* add_filter( 'um_change_field_label', 'my_change_field_label', 10, 2 );
* function my_form_fields( $label, $key ) {
* // your code here
* @since 2.0.30
* @since 2.8.0 Added $data attribute.
*
* @hook um_change_field_label
*
* @param {string} $label Field label.
* @param {string} $key Field key.
* @param {array} $data Field data.
*
* @return {string} Field label.
*
* @example <caption>Change first name field label.</caption>
* function my_change_field_label( $label, $key, $data ) {
* if ( 'first_name' === $key ) {
* $label = 'My label';
* }
* return $label;
* }
* ?>
* add_filter( 'um_change_field_label', 'my_change_field_label', 10, 3 );
*/
$label = apply_filters( 'um_change_field_label', $label, $key );
$label = apply_filters( 'um_change_field_label', $label, $key, $fields[ $key ] );
$label = sprintf( __( '%s', 'ultimate-member' ), $label );
return $label;
@@ -1629,6 +1628,10 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
$array = ( isset( UM()->builtin()->predefined_fields[ $key ] ) ) ? UM()->builtin()->predefined_fields[ $key ] : UM()->builtin()->all_user_fields[ $key ];
}
if ( empty( $array['type'] ) ) {
return '';
}
$array['classes'] = null;
if ( ! isset( $array['placeholder'] ) ) {
@@ -4122,7 +4125,7 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
// find rows
foreach ( $this->get_fields as $key => $array ) {
if ( $array['type'] == 'row' ) {
if ( isset( $array['type'] ) && 'row' === $array['type'] ) {
$this->rows[ $key ] = $array;
unset( $this->get_fields[ $key ] ); // not needed anymore
}
@@ -4165,7 +4168,6 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
}
// sub row fields
$subrow_fields = null;
$subrow_fields = $this->get_fields_in_subrow( $row_fields, $c );
if ( is_array( $subrow_fields ) ) {
@@ -4433,7 +4435,7 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
$id_attr = ' id="' . esc_attr( $key . UM()->form()->form_suffix ) . '"';
}
if ( empty( $res ) ) {
if ( empty( $res ) && ! ( 'number' === $type && '' !== $res ) ) {
$output = '';
} else {
$output .= '<div class="um-field-area">';
@@ -4663,7 +4665,7 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
// find rows
foreach ( $this->get_fields as $key => $array ) {
if ( $array['type'] == 'row' ) {
if ( isset( $array['type'] ) && 'row' === $array['type'] ) {
$this->rows[ $key ] = $array;
unset( $this->get_fields[ $key ] ); // not needed anymore
}
@@ -4707,7 +4709,6 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
}
// sub row fields
$subrow_fields = null;
$subrow_fields = $this->get_fields_in_subrow( $row_fields, $c );
if ( is_array( $subrow_fields ) ) {
+1 -6
View File
@@ -259,11 +259,10 @@ if ( ! class_exists( 'um\core\Files' ) ) {
exit;
}
/**
* Remove file by AJAX
*/
function ajax_remove_file() {
public function ajax_remove_file() {
UM()->check_ajax_nonce();
if ( empty( $_POST['src'] ) ) {
@@ -283,14 +282,11 @@ if ( ! class_exists( 'um\core\Files' ) ) {
$mode = sanitize_key( $_POST['mode'] );
if ( $mode == 'register' || empty( $_POST['user_id'] ) ) {
$is_temp = um_is_temp_upload( $src );
if ( ! $is_temp ) {
wp_send_json_success();
}
} else {
$user_id = absint( $_POST['user_id'] );
if ( ! UM()->roles()->um_current_user_can( 'edit', $user_id ) ) {
@@ -303,7 +299,6 @@ if ( ! class_exists( 'um\core\Files' ) ) {
wp_send_json_success();
}
}
}
if ( $this->delete_file( $src ) ) {
+16 -10
View File
@@ -65,11 +65,12 @@ if ( ! class_exists( 'um\core\Form' ) ) {
public $usermeta_whitelist = array();
/**
* Form constructor.
* Hook for singleton
* @since 2.8.0
*/
public function __construct() {
public function hooks() {
add_action( 'template_redirect', array( &$this, 'form_init' ), 2 );
add_action( 'init', array( &$this, 'field_declare' ), 10 );
add_action( 'init', array( &$this, 'field_declare' ) );
}
/**
@@ -115,6 +116,8 @@ if ( ! class_exists( 'um\core\Form' ) ) {
public function ajax_select_options() {
UM()->check_ajax_nonce();
// phpcs:disable WordPress.Security.NonceVerification
$arr_options = array();
$arr_options['status'] = 'success';
$arr_options['post'] = $_POST;
@@ -163,9 +166,9 @@ if ( ! class_exists( 'um\core\Form' ) ) {
if ( isset( $_POST['form_id'] ) ) {
UM()->fields()->set_id = absint( $_POST['form_id'] );
}
UM()->fields()->set_mode = 'profile';
$form_fields = UM()->fields()->get_fields();
$arr_options['fields'] = $form_fields;
UM()->fields()->set_mode = 'profile';
$form_fields = UM()->fields()->get_fields();
$arr_options['fields'] = $form_fields;
if ( isset( $arr_options['post']['members_directory'] ) && 'yes' === $arr_options['post']['members_directory'] ) {
global $wpdb;
@@ -181,7 +184,7 @@ if ( ! class_exists( 'um\core\Form' ) ) {
);
if ( ! empty( $values_array ) ) {
$parent_dropdown = isset( $arr_options['field']['parent_dropdown_relationship'] ) ? $arr_options['field']['parent_dropdown_relationship'] : '';
$parent_dropdown = isset( $arr_options['post']['parent_option_name'] ) ? $arr_options['post']['parent_option_name'] : '';
$arr_options['items'] = call_user_func( $ajax_source_func, $parent_dropdown );
if ( array_keys( $arr_options['items'] ) !== range( 0, count( $arr_options['items'] ) - 1 ) ) {
@@ -241,6 +244,7 @@ if ( ! class_exists( 'um\core\Form' ) ) {
}
}
// phpcs:enable WordPress.Security.NonceVerification
wp_send_json( $arr_options );
}
}
@@ -505,7 +509,6 @@ if ( ! class_exists( 'um\core\Form' ) ) {
// Add required usermeta for register.
if ( 'register' === $this->form_data['mode'] ) {
$cf_metakeys[] = 'form_id';
$cf_metakeys[] = 'timestamp';
}
/**
@@ -607,6 +610,9 @@ if ( ! class_exists( 'um\core\Form' ) ) {
$this->post_form['role'] = $role;
$maybe_set_default_role = false;
// Force adding `role` metakey if there is a role-type field on the form. It's required to User Profile.
$this->usermeta_whitelist[] = 'role';
}
}
}
@@ -748,7 +754,7 @@ if ( ! class_exists( 'um\core\Form' ) ) {
$form[ $k ] = apply_filters( 'um_sanitize_form_field', $form[ $k ], $field );
break;
case 'number':
$form[ $k ] = (int) $form[ $k ];
$form[ $k ] = '' !== $form[ $k ] ? (int) $form[ $k ] : '';
break;
case 'textarea':
if ( ! empty( $field['html'] ) || ( UM()->profile()->get_show_bio_key( $form ) === $k && UM()->options()->get( 'profile_show_html_bio' ) ) ) {
@@ -780,7 +786,7 @@ if ( ! class_exists( 'um\core\Form' ) ) {
$f = UM()->builtin()->get_a_field( $k );
if ( is_array( $f ) && array_key_exists( 'match', $f ) && array_key_exists( 'advanced', $f ) && 'social' === $f['advanced'] ) {
$v = sanitize_text_field( $form[ $k ] );
$v = esc_url_raw( $form[ $k ] );
// Make a proper social link
if ( ! empty( $v ) ) {
+3 -2
View File
@@ -74,7 +74,7 @@ if ( ! class_exists( 'um\core\GDPR' ) ) {
*/
public function add_agreement_date( $submitted ) {
if ( isset( $submitted['use_gdpr_agreement'] ) ) {
$submitted['use_gdpr_agreement'] = time();
$submitted['use_gdpr_agreement'] = current_time( 'mysql', true );
}
return $submitted;
@@ -87,7 +87,8 @@ if ( ! class_exists( 'um\core\GDPR' ) ) {
*/
public function email_registration_data( $submitted ) {
if ( ! empty( $submitted['use_gdpr_agreement'] ) ) {
$submitted['GDPR Applied'] = wp_date( get_option( 'date_format', 'Y-m-d' ) . ' ' . get_option( 'time_format', 'H:i:s' ), $submitted['use_gdpr_agreement'] );
$title = __( 'GDPR Applied', 'ultimate-member' );
$submitted[ $title ] = wp_date( get_option( 'date_format', 'F j, Y' ) . ' ' . get_option( 'time_format', 'g:i a' ), strtotime( $submitted['use_gdpr_agreement'] ) );
unset( $submitted['use_gdpr_agreement'] );
}
@@ -405,8 +405,8 @@ if ( ! class_exists( 'um\core\Member_Directory_Meta' ) ) {
}
}
$from_date = date( 'Y-m-d H:s:i', strtotime( min( $value ) ) + $offset * HOUR_IN_SECONDS ); // client time zone offset
$to_date = date( 'Y-m-d H:s:i', strtotime( max( $value ) ) + $offset * HOUR_IN_SECONDS + DAY_IN_SECONDS - 1 ); // time 23:59
$from_date = date( 'Y-m-d H:i:s', strtotime( min( $value ) ) + $offset * HOUR_IN_SECONDS ); // client time zone offset
$to_date = date( 'Y-m-d H:i:s', strtotime( max( $value ) ) + $offset * HOUR_IN_SECONDS + DAY_IN_SECONDS - 1 ); // time 23:59
$this->where_clauses[] = $wpdb->prepare( "u.user_registered BETWEEN %s AND %s", $from_date, $to_date );
@@ -416,7 +416,6 @@ if ( ! class_exists( 'um\core\Member_Directory_Meta' ) ) {
break;
case 'last_login':
$offset = 0;
if ( ! $is_default ) {
if ( isset( $_POST['gmt_offset'] ) && is_numeric( $_POST['gmt_offset'] ) ) {
@@ -429,8 +428,8 @@ if ( ! class_exists( 'um\core\Member_Directory_Meta' ) ) {
}
}
$from_date = (int) min( $value ) + ( $offset * HOUR_IN_SECONDS ); // client time zone offset
$to_date = (int) max( $value ) + ( $offset * HOUR_IN_SECONDS ) + DAY_IN_SECONDS - 1; // time 23:59
$from_date = gmdate( 'Y-m-d H:i:s', (int) min( $value ) + ( $offset * HOUR_IN_SECONDS ) ); // client time zone offset
$to_date = gmdate( 'Y-m-d H:i:s', (int) max( $value ) + ( $offset * HOUR_IN_SECONDS ) + DAY_IN_SECONDS - 1 ); // time 23:59
$this->joins[] = "LEFT JOIN {$wpdb->prefix}um_metadata {$join_slug}{$i} ON {$join_slug}{$i}.user_id = u.ID";
@@ -764,11 +763,10 @@ if ( ! class_exists( 'um\core\Member_Directory_Meta' ) ) {
$this->sql_order = " ORDER BY CAST( umm_sort.um_value AS CHAR ) {$order} ";
} elseif ( $sortby == 'last_login' ) {
} elseif ( 'last_login' === $sortby ) {
$this->joins[] = "LEFT JOIN {$wpdb->prefix}um_metadata umm_sort ON ( umm_sort.user_id = u.ID AND umm_sort.um_key = '_um_last_login' )";
$this->sql_order = " ORDER BY CAST( umm_sort.um_value AS SIGNED ) DESC ";
$this->joins[] = "LEFT JOIN {$wpdb->prefix}um_metadata umm_sort ON ( umm_sort.user_id = u.ID AND umm_sort.um_key = '_um_last_login' )";
$this->sql_order = ' ORDER BY CAST( umm_sort.um_value AS DATETIME ) DESC ';
} elseif ( $sortby == 'last_first_name' ) {
+57 -67
View File
@@ -364,7 +364,7 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) {
if ( ! empty( UM()->builtin()->saved_fields ) ) {
foreach ( UM()->builtin()->saved_fields as $key => $data ) {
if ( $key == '_um_last_login' ) {
if ( '_um_last_login' === $key ) {
continue;
}
@@ -419,7 +419,7 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) {
if ( ! empty( UM()->builtin()->saved_fields ) ) {
foreach ( UM()->builtin()->saved_fields as $key => $data ) {
if ( $key == '_um_last_login' ) {
if ( '_um_last_login' === $key ) {
continue;
}
@@ -527,10 +527,9 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) {
}
$field_key = $filter;
if ( $filter == 'last_login' ) {
if ( 'last_login' === $filter ) {
$field_key = '_um_last_login';
}
if ( $filter == 'role' ) {
} elseif ( 'role' === $filter ) {
$field_key = 'role_select';
}
@@ -641,9 +640,9 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) {
$values_array = ( ! empty( $users_roles['avail_roles'] ) && is_array( $users_roles['avail_roles'] ) ) ? array_keys( array_filter( $users_roles['avail_roles'] ) ) : array();
}
if ( ! empty( $values_array ) && in_array( $attrs['type'], array( 'select', 'multiselect', 'checkbox', 'radio' ) ) ) {
if ( ! empty( $values_array ) && in_array( $attrs['type'], array( 'select', 'multiselect', 'checkbox', 'radio' ), true ) ) {
$values_array = array_map( 'maybe_unserialize', $values_array );
$temp_values = array();
$temp_values = array();
foreach ( $values_array as $values ) {
if ( is_array( $values ) ) {
$temp_values = array_merge( $temp_values, $values );
@@ -654,7 +653,7 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) {
$values_array = array_unique( $temp_values );
}
if ( $attrs['metakey'] != 'online_status' && empty( $values_array ) ) {
if ( 'online_status' !== $attrs['metakey'] && empty( $values_array ) ) {
ob_get_clean();
return '';
}
@@ -721,7 +720,7 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) {
$attrs['options'] = apply_filters( 'um_member_directory_filter_select_options', $attrs['options'], $values_array, $attrs );
if ( empty( $attrs['options'] ) || ! is_array( $attrs['options'] ) ) {
if ( ( empty( $attrs['options'] ) || ! is_array( $attrs['options'] ) ) && ! ( ! empty( $attrs['custom_dropdown_options_source'] ) && ! empty( $attrs['parent_dropdown_relationship'] ) ) ) {
ob_get_clean();
return '';
}
@@ -812,29 +811,28 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) {
break;
}
case 'datepicker': {
case 'datepicker':
$range = $this->datepicker_filters_range( $filter );
$label = ! empty( $attrs['label'] ) ? $attrs['label'] : $attrs['title'];
if ( $range ) { ?>
if ( $range ) {
$min = strtotime( $range[0] );
$max = strtotime( $range[1] );
?>
<input type="text" id="<?php echo $filter; ?>_from" name="<?php echo $filter; ?>_from" class="um-datepicker-filter"
placeholder="<?php esc_attr_e( sprintf( '%s From', stripslashes( $label ) ), 'ultimate-member' ); ?>"
data-filter-label="<?php echo esc_attr( stripslashes( $label ) ); ?>"
data-date_min="<?php echo $range[0] ?>" data-date_max="<?php echo $range[1] ?>"
data-date_min="<?php echo esc_attr( $min ); ?>" data-date_max="<?php echo esc_attr( $max ); ?>"
data-filter_name="<?php echo $filter; ?>" data-range="from" data-value="<?php echo ! empty( $default_value ) ? esc_attr( strtotime( min( $default_value ) ) ) : '' ?>" />
<input type="text" id="<?php echo $filter; ?>_to" name="<?php echo $filter; ?>_to" class="um-datepicker-filter"
placeholder="<?php esc_attr_e( sprintf( '%s To', stripslashes( $label ) ), 'ultimate-member' ); ?>"
data-filter-label="<?php echo esc_attr( stripslashes( $label ) ); ?>"
data-date_min="<?php echo $range[0] ?>" data-date_max="<?php echo $range[1] ?>"
data-date_min="<?php echo esc_attr( $min ); ?>" data-date_max="<?php echo esc_attr( $max ); ?>"
data-filter_name="<?php echo $filter; ?>" data-range="to" data-value="<?php echo ! empty( $default_value ) ? esc_attr( strtotime( max( $default_value ) ) ) : '' ?>" />
<?php }
<?php
}
break;
}
case 'timepicker': {
$range = $this->timepicker_filters_range( $filter );
@@ -996,19 +994,16 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) {
return $placeholders;
}
/**
* @param $filter
*
* @return mixed
*/
function datepicker_filters_range( $filter ) {
public function datepicker_filters_range( $filter ) {
global $wpdb;
switch ( $filter ) {
default: {
default:
global $wpdb;
$meta = $wpdb->get_col( $wpdb->prepare( "SELECT DISTINCT meta_value
FROM {$wpdb->usermeta}
@@ -1024,22 +1019,22 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) {
$range = apply_filters( "um_member_directory_filter_{$filter}_datepicker", $range );
break;
}
case 'last_login': {
$meta = $wpdb->get_col( "SELECT DISTINCT meta_value
case 'last_login':
$meta = $wpdb->get_row(
"SELECT DISTINCT COUNT(*) AS total,
MIN(meta_value) AS min,
MAX(meta_value) AS max
FROM {$wpdb->usermeta}
WHERE meta_key='_um_last_login'
ORDER BY meta_value DESC" );
if ( empty( $meta ) || count( $meta ) === 1 ) {
WHERE meta_key = '_um_last_login'",
ARRAY_A
);
if ( empty( $meta['total'] ) || 1 === absint( $meta['total'] ) ) {
$range = false;
} elseif ( ! empty( $meta ) ) {
$range = array( min( $meta ), max( $meta ) );
} elseif ( array_key_exists( 'min', $meta ) && array_key_exists( 'max', $meta ) ) {
$range = array( $meta['min'], $meta['max'] );
}
break;
}
case 'user_registered': {
case 'user_registered':
$meta = $wpdb->get_col(
"SELECT DISTINCT user_registered
FROM {$wpdb->users}
@@ -1053,14 +1048,11 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) {
}
break;
}
}
return $range;
}
/**
* @param $filter
*
@@ -1349,7 +1341,7 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) {
if ( ! empty( UM()->builtin()->saved_fields ) ) {
foreach ( UM()->builtin()->saved_fields as $key => $data ) {
if ( $key == '_um_last_login' ) {
if ( '_um_last_login' === $key ) {
continue;
}
@@ -1402,22 +1394,22 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) {
$this->query_args['orderby'] = array( $sortby . '_c' => 'ASC' );
unset( $this->query_args['order'] );
} elseif ( $sortby == 'last_login' ) {
$this->query_args['orderby'] = array( 'um_last_login' => 'DESC' );
} elseif ( 'last_login' === $sortby ) {
$this->query_args['orderby'] = array( 'um_last_login' => 'DESC' );
$this->query_args['meta_query'][] = array(
'relation' => 'OR',
'relation' => 'OR',
array(
'key' => '_um_last_login',
'compare' => 'EXISTS',
'key' => '_um_last_login',
'compare' => 'EXISTS',
'type' => 'DATETIME',
),
'um_last_login' => array(
'key' => '_um_last_login',
'compare' => 'NOT EXISTS',
'key' => '_um_last_login',
'compare' => 'NOT EXISTS',
'type' => 'DATETIME',
),
);
unset( $this->query_args['order'] );
} elseif ( $sortby == 'last_first_name' ) {
$this->query_args['meta_query'][] = array(
@@ -1534,12 +1526,12 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) {
if ( strstr( $sortby, '_desc' ) ) {
$sortby = str_replace( '_desc', '', $sortby );
$order = 'DESC';
$order = 'DESC';
}
if ( strstr( $sortby, '_asc' ) ) {
$sortby = str_replace( '_asc', '', $sortby );
$order = 'ASC';
$order = 'ASC';
}
$this->query_args['orderby'] = $sortby;
@@ -1550,7 +1542,6 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) {
add_filter( 'pre_user_query', array( &$this, 'sortby_randomly' ), 10, 1 );
}
/**
* UM hook
*
@@ -1984,9 +1975,8 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) {
break;
case 'birth_date':
$from_date = date( 'Y/m/d', mktime( 0,0,0, date( 'm', time() ), date( 'd', time() ), date( 'Y', time() - min( $value ) * YEAR_IN_SECONDS ) ) );
$to_date = date( 'Y/m/d', mktime( 0,0,0, date( 'm', time() ), date( 'd', time() ) + 1, date( 'Y', time() - ( max( $value ) + 1 ) * YEAR_IN_SECONDS ) ) );
$to_date = date( 'Y/m/d', mktime( 0,0,0, date( 'm', time() ), date( 'd', time() ) + 1, date( 'Y', time() - ( max( $value ) + 1 ) * YEAR_IN_SECONDS ) ) );
$meta_query = array(
array(
@@ -1995,7 +1985,7 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) {
'compare' => 'BETWEEN',
'type' => 'DATE',
'inclusive' => true,
)
),
);
$this->query_args['meta_query'] = array_merge( $this->query_args['meta_query'], array( $meta_query ) );
@@ -2010,8 +2000,8 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) {
$offset = (int) $_POST['gmt_offset'];
}
$from_date = date( 'Y-m-d H:s:i', strtotime( date( 'Y-m-d H:s:i', min( $value ) ) . "+$offset hours" ) );
$to_date = date( 'Y-m-d H:s:i', strtotime( date( 'Y-m-d H:s:i', max( $value ) ) . "+$offset hours" ) );
$from_date = date( 'Y-m-d H:i:s', strtotime( date( 'Y-m-d H:i:s', min( $value ) ) . "+$offset hours" ) );
$to_date = date( 'Y-m-d H:i:s', strtotime( date( 'Y-m-d H:i:s', max( $value ) ) . "+$offset hours" ) );
$date_query = array(
array(
@@ -2032,7 +2022,6 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) {
break;
case 'last_login':
$offset = 0;
if ( isset( $_POST['gmt_offset'] ) && is_numeric( $_POST['gmt_offset'] ) ) {
$offset = (int) $_POST['gmt_offset'];
@@ -2043,10 +2032,11 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) {
$meta_query = array(
array(
'key' => '_um_last_login',
'value' => array( $from_date, $to_date ),
'value' => array( gmdate( 'Y-m-d H:i:s', $from_date ), gmdate( 'Y-m-d H:i:s', $to_date ) ),
'compare' => 'BETWEEN',
'inclusive' => true,
)
'type' => 'DATETIME',
),
);
$this->custom_filters_in_query[ $field ] = $value;
@@ -2054,7 +2044,6 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) {
$this->query_args['meta_query'] = array_merge( $this->query_args['meta_query'], array( $meta_query ) );
break;
}
}
}
@@ -2262,8 +2251,8 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) {
$offset = $gmt_offset;
}
$from_date = date( 'Y-m-d H:s:i', strtotime( date( 'Y-m-d H:s:i', min( $value ) ) . "+$offset hours" ) );
$to_date = date( 'Y-m-d H:s:i', strtotime( date( 'Y-m-d H:s:i', max( $value ) ) . "+$offset hours" ) );
$from_date = date( 'Y-m-d H:i:s', strtotime( date( 'Y-m-d H:i:s', min( $value ) ) . "+$offset hours" ) );
$to_date = date( 'Y-m-d H:i:s', strtotime( date( 'Y-m-d H:i:s', max( $value ) ) . "+$offset hours" ) );
$date_query = array(
array(
@@ -2287,15 +2276,16 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) {
$offset = $gmt_offset;
}
$from_date = (int) min( $value ) + ( $offset * HOUR_IN_SECONDS ); // client time zone offset
$to_date = (int) max( $value ) + ( $offset * HOUR_IN_SECONDS ) + DAY_IN_SECONDS - 1; // time 23:59
$from_date = (int) min( $value ) + ( $offset * HOUR_IN_SECONDS ); // client time zone offset
$to_date = (int) max( $value ) + ( $offset * HOUR_IN_SECONDS ) + DAY_IN_SECONDS - 1; // time 23:59
$meta_query = array(
array(
'key' => '_um_last_login',
'value' => array( $from_date, $to_date ),
'value' => array( $from_date, $to_date ),
'compare' => 'BETWEEN',
'inclusive' => true,
)
'type' => 'DATETIME',
),
);
$this->query_args['meta_query'] = array_merge( $this->query_args['meta_query'], array( $meta_query ) );
-80
View File
@@ -489,85 +489,5 @@ if ( ! class_exists( 'um\core\Permalinks' ) ) {
return $user_in_url;
}
/**
* Get action url for admin use
*
* @param $action
* @param $subaction
*
* @deprecated 2.6.9
*
* @return mixed|string|void
*/
public function admin_act_url( $action, $subaction ) {
_deprecated_function( __METHOD__, '2.6.9' );
$url = add_query_arg(
array(
'um_adm_action' => $action,
'sub' => $subaction,
'user_id' => um_user( 'ID' ),
'_wpnonce' => wp_create_nonce( $action ),
)
);
return $url;
}
/**
* SEO canonical href bugfix
*
* @deprecated since version 2.1.7
*
* @todo remove since 2.7.0
* @see function um_profile_remove_wpseo()
*/
public function um_rel_canonical_() {
_deprecated_function( __METHOD__, '2.1.7', 'um_profile_remove_wpseo()' );
global $wp_the_query;
if ( ! is_singular() )
return;
/**
* UM hook
*
* @type filter
* @title um_allow_canonical__filter
* @description Allow canonical
* @input_vars
* [{"var":"$allow_canonical","type":"bool","desc":"Allow?"}]
* @change_log
* ["Since: 2.0"]
* @usage
* <?php add_filter( 'um_allow_canonical__filter', 'function_name', 10, 1 ); ?>
* @example
* <?php
* add_filter( 'um_allow_canonical__filter', 'my_allow_canonical', 10, 1 );
* function my_allow_canonical( $allow_canonical ) {
* // your code here
* return $allow_canonical;
* }
* ?>
*/
$enable_canonical = apply_filters( "um_allow_canonical__filter", true );
if( ! $enable_canonical )
return;
if ( !$id = $wp_the_query->get_queried_object_id() )
return;
if ( UM()->config()->permalinks['user'] == $id ) {
$link = esc_url( $this->get_current_url() );
echo "<link rel='canonical' href='$link' />\n";
return;
}
$link = get_permalink( $id );
if ( $page = get_query_var( 'cpage' ) ) {
$link = get_comments_pagenum_link( $page );
echo "<link rel='canonical' href='$link' />\n";
}
}
}
}
+19 -22
View File
@@ -412,43 +412,40 @@ if ( ! class_exists( 'um\core\Query' ) ) {
return false;
}
/**
* Get post data
*
* @param $post_id
* @param int $post_id
*
* @return mixed
* @return array
*/
function post_data( $post_id ) {
public function post_data( $post_id ) {
$array['form_id'] = $post_id;
$mode = $this->get_attr('mode', $post_id);
$meta = get_post_custom( $post_id );
foreach ($meta as $k => $v){
if ( strstr($k, '_um_'.$mode.'_' ) ) {
$k = str_replace('_um_'.$mode.'_', '', $k);
$array[$k] = $v[0];
} elseif ($k == '_um_mode'){
$k = str_replace('_um_', '', $k);
$array[$k] = $v[0];
} elseif ( strstr($k, '_um_') ) {
$k = str_replace('_um_', '', $k);
$array[$k] = $v[0];
$mode = $this->get_attr( 'mode', $post_id );
$meta = get_post_custom( $post_id );
foreach ( $meta as $k => $v ) {
if ( strstr( $k, '_um_' . $mode . '_' ) ) {
$k = str_replace( '_um_' . $mode . '_', '', $k );
$array[ $k ] = $v[0];
} elseif ( '_um_mode' === $k ) {
$k = str_replace( '_um_', '', $k );
$array[ $k ] = $v[0];
} elseif ( strstr( $k, '_um_' ) ) {
$k = str_replace( '_um_', '', $k );
$array[ $k ] = $v[0];
}
}
foreach( $array as $k => $v ) {
if ( strstr( $k, 'login_') || strstr( $k, 'register_' ) || strstr( $k, 'profile_' ) ){
if ( $mode != 'directory' ) {
unset($array[$k]);
foreach ( $array as $k => $v ) {
if ( strstr( $k, 'login_' ) || strstr( $k, 'register_' ) || strstr( $k, 'profile_' ) ) {
if ( 'directory' !== $mode ) {
unset( $array[ $k ] );
}
}
}
return $array;
}
/**
* Capture selected value
*
+34 -28
View File
@@ -655,7 +655,7 @@ if ( ! class_exists( 'um\core\Roles_Capabilities' ) ) {
*
* @return array
*/
function get_roles( $add_default = false, $exclude = null ) {
public function get_roles( $add_default = false, $exclude = null ) {
global $wp_roles;
if ( empty( $wp_roles ) ) {
@@ -670,11 +670,19 @@ if ( ! class_exists( 'um\core\Roles_Capabilities' ) ) {
if ( $exclude ) {
foreach ( $exclude as $role ) {
unset ( $roles[ $role ] );
unset( $roles[ $role ] );
}
}
$roles = array_map( 'stripslashes', $roles );
$roles = array_map(
function( $role ) {
if ( is_string( $role ) ) {
return stripslashes( $role );
}
return $role;
},
$roles
);
return $roles;
}
@@ -741,54 +749,52 @@ if ( ! class_exists( 'um\core\Roles_Capabilities' ) ) {
return $return;
}
/**
* User can ( role settings )
* User can (role settings)
*
* @param $permission
* @return bool|mixed
*/
function um_user_can( $permission ) {
if ( ! is_user_logged_in() )
public function um_user_can( $permission ) {
if ( ! is_user_logged_in() ) {
return false;
}
$user_id = get_current_user_id();
$role = UM()->roles()->get_priority_user_role( $user_id );
$role = UM()->roles()->get_priority_user_role( $user_id );
$permissions = $this->role_data( $role );
/**
* UM hook
* Filters User Permissions.
*
* @type filter
* @title um_user_permissions_filter
* @description Change User Permissions
* @input_vars
* [{"var":"$permissions","type":"array","desc":"User Permissions"},
* {"var":"$user_id","type":"int","desc":"User ID"}]
* @change_log
* ["Since: 2.0"]
* @usage
* <?php add_filter( 'um_user_permissions_filter', 'function_name', 10, 2 ); ?>
* @example
* <?php
* add_filter( 'um_user_permissions_filter', 'my_user_permissions', 10, 2 );
* @param {array} $permissions User Permissions.
* @param {int} $user_id User ID.
*
* @return {array} User Permissions.
*
* @since 2.0
* @hook um_user_permissions_filter
*
* @example <caption>Add custom user permissions.</caption>
* function my_user_permissions( $permissions, $user_id ) {
* // your code here
* return $permissions;
* }
* ?>
* add_filter( 'um_user_permissions_filter', 'my_user_permissions', 10, 2 );
*/
$permissions = apply_filters( 'um_user_permissions_filter', $permissions, $user_id );
if ( isset( $permissions[ $permission ] ) && is_serialized( $permissions[ $permission ] ) )
return unserialize( $permissions[ $permission ] );
if ( isset( $permissions[ $permission ] ) && is_serialized( $permissions[ $permission ] ) ) {
return maybe_unserialize( $permissions[ $permission ] );
}
if ( isset( $permissions[ $permission ] ) && is_array( $permissions[ $permission ] ) )
if ( isset( $permissions[ $permission ] ) && is_array( $permissions[ $permission ] ) ) {
return $permissions[ $permission ];
}
if ( isset( $permissions[ $permission ] ) && $permissions[ $permission ] == 1 )
if ( isset( $permissions[ $permission ] ) && $permissions[ $permission ] == 1 ) {
return true;
}
return false;
}
+7 -11
View File
@@ -242,15 +242,14 @@ if ( ! class_exists( 'um\core\Shortcodes' ) ) {
}
}
/**
* Extend body classes
* Extend body classes.
*
* @param $classes
* @param array $classes
*
* @return array
*/
function body_class( $classes ) {
public function body_class( $classes ) {
$array = UM()->config()->permalinks;
if ( ! $array ) {
return $classes;
@@ -258,7 +257,7 @@ if ( ! class_exists( 'um\core\Shortcodes' ) ) {
foreach ( $array as $slug => $info ) {
if ( um_is_core_page( $slug ) ) {
$classes[] = 'um';
$classes[] = 'um-page-' . $slug;
if ( is_user_logged_in() ) {
@@ -266,7 +265,6 @@ if ( ! class_exists( 'um\core\Shortcodes' ) ) {
} else {
$classes[] = 'um-page-loggedout';
}
}
}
@@ -673,6 +671,8 @@ if ( ! class_exists( 'um\core\Shortcodes' ) ) {
return '';
}
UM()->fields()->set_id = absint( $this->form_id );
// get data into one global array
$post_data = UM()->query()->post_data( $this->form_id );
$args = array_merge( $args, $post_data );
@@ -716,11 +716,7 @@ if ( ! class_exists( 'um\core\Shortcodes' ) ) {
if ( 'directory' === $args['mode'] ) {
wp_enqueue_script( 'um_members' );
if ( is_rtl() ) {
wp_enqueue_style( 'um_members_rtl' );
} else {
wp_enqueue_style( 'um_members' );
}
wp_enqueue_style( 'um_members' );
}
if ( 'directory' !== $args['mode'] ) {
+1 -1
View File
@@ -1280,7 +1280,7 @@ if ( ! class_exists( 'um\core\Uploader' ) ) {
//move temporary file from temp directory to the correct user directory
$temp_file_path = UM()->uploader()->get_core_temp_dir() . DIRECTORY_SEPARATOR . $filename;
if ( file_exists( $temp_file_path ) ) {
$extra_hash = hash( 'crc32b', current_time( 'timestamp' ) );
$extra_hash = hash( 'crc32b', time() );
if ( strpos( $filename , 'stream_photo_' ) !== false ) {
$new_filename = str_replace("stream_photo_","stream_photo_{$extra_hash}_", $filename );
+6 -58
View File
@@ -1164,14 +1164,12 @@ if ( ! class_exists( 'um\core\User' ) ) {
return $new;
}
/**
* @param $user_id
*
* @return mixed|string
*/
function get_cached_data( $user_id ) {
public function get_cached_data( $user_id ) {
$disallow_cache = UM()->options()->get( 'um_profile_object_cache_stop' );
if ( $disallow_cache ) {
return '';
@@ -1180,30 +1178,8 @@ if ( ! class_exists( 'um\core\User' ) ) {
if ( is_numeric( $user_id ) && $user_id > 0 ) {
$find_user = get_option( "um_cache_userdata_{$user_id}" );
if ( $find_user ) {
/**
* UM hook
*
* @type filter
* @title um_user_permissions_filter
* @description Change User Permissions
* @input_vars
* [{"var":"$permissions","type":"array","desc":"User Permissions"},
* {"var":"$user_id","type":"int","desc":"User ID"}]
* @change_log
* ["Since: 2.0"]
* @usage
* <?php add_filter( 'um_user_permissions_filter', 'function_name', 10, 2 ); ?>
* @example
* <?php
* add_filter( 'um_user_permissions_filter', 'my_user_permissions', 10, 2 );
* function my_user_permissions( $permissions, $user_id ) {
* // your code here
* return $permissions;
* }
* ?>
*/
$find_user = apply_filters( 'um_user_permissions_filter', $find_user, $user_id );
return $find_user;
/** This filter is documented in includes/core/class-roles-capabilities.php */
return apply_filters( 'um_user_permissions_filter', $find_user, $user_id );
}
}
return '';
@@ -1354,37 +1330,9 @@ if ( ! class_exists( 'um\core\User' ) ) {
$this->profile['roles'] = UM()->roles()->get_all_user_roles( $this->id );
$role_meta = UM()->roles()->role_data( $user_role );
/**
* UM hook
*
* @type filter
* @title um_user_permissions_filter
* @description Change User Permissions
* @input_vars
* [{"var":"$permissions","type":"array","desc":"User Permissions"},
* {"var":"$user_id","type":"int","desc":"User ID"}]
* @change_log
* ["Since: 2.0"]
* @usage
* <?php add_filter( 'um_user_permissions_filter', 'function_name', 10, 2 ); ?>
* @example
* <?php
* add_filter( 'um_user_permissions_filter', 'my_user_permissions', 10, 2 );
* function my_user_permissions( $permissions, $user_id ) {
* // your code here
* return $permissions;
* }
* ?>
*/
/** This filter is documented in includes/core/class-roles-capabilities.php */
$role_meta = apply_filters( 'um_user_permissions_filter', $role_meta, $this->id );
/*$role_meta = array_map( function( $key, $item ) {
if ( strpos( $key, '_um_' ) === 0 )
$key = str_replace( '_um_', '', $key );
return array( $key => $item );
}, array_keys( $role_meta ), $role_meta );*/
$this->profile = array_merge( $this->profile, (array) $role_meta );
$this->profile['super_admin'] = ( is_super_admin( $this->id ) ) ? 1 : 0;
@@ -1549,8 +1497,8 @@ if ( ! class_exists( 'um\core\User' ) ) {
/**
* Set last login for new registered users
*/
function set_last_login() {
update_user_meta( $this->id, '_um_last_login', current_time( 'timestamp' ) );
public function set_last_login() {
update_user_meta( $this->id, '_um_last_login', current_time( 'mysql', true ) );
}
/**
+7 -1
View File
@@ -513,6 +513,12 @@ function um_submit_form_errors_hook_( $submitted_data, $form_data ) {
}
}
// Validate the Required condition for the Number field. Set the Minimum Number option to allow 0 value.
if ( isset( $array['type'] ) && 'number' === $array['type'] && ! empty( $array['required'] ) && '' === $submitted_data[ $key ] ) {
// translators: %s: title.
UM()->form()->add_error( $key, sprintf( __( '%s is required.', 'ultimate-member' ), $array['title'] ) );
}
if ( isset( $array['type'] ) && $array['type'] == 'checkbox' && isset( $array['required'] ) && $array['required'] == 1 && ! isset( $submitted_data[ $key ] ) ) {
// translators: %s: title.
UM()->form()->add_error( $key, sprintf( __( '%s is required.', 'ultimate-member' ), $array['title'] ) );
@@ -792,7 +798,7 @@ function um_submit_form_errors_hook_( $submitted_data, $form_data ) {
break;
case 'youtube_video':
if ( ! UM()->validation()->is_url( $submitted_data[ $key ], 'youtube.com/watch?v=' ) && ! UM()->validation()->is_url( $submitted_data[ $key ], 'youtu.be' ) && ! UM()->validation()->is_url( $submitted_data[ $key ], 'youtube.com/shorts/' ) ) {
if ( ! UM()->validation()->is_url( $submitted_data[ $key ] ) || false === um_youtube_id_from_url( $submitted_data[ $key ] ) ) {
// translators: %s: label.
UM()->form()->add_error( $key, sprintf( __( 'Please enter a valid %s URL', 'ultimate-member' ), $array['label'] ) );
}
+6 -6
View File
@@ -11,15 +11,15 @@ if ( ! defined( 'ABSPATH' ) ) {
function um_submit_form_errors_hook_login( $submitted_data ) {
$user_password = $submitted_data['user_password'];
if ( isset( $submitted_data['username'] ) && $submitted_data['username'] == '' ) {
if ( isset( $submitted_data['username'] ) && '' === $submitted_data['username'] ) {
UM()->form()->add_error( 'username', __( 'Please enter your username or email', 'ultimate-member' ) );
}
if ( isset( $submitted_data['user_login'] ) && $submitted_data['user_login'] == '' ) {
if ( isset( $submitted_data['user_login'] ) && '' === $submitted_data['user_login'] ) {
UM()->form()->add_error( 'user_login', __( 'Please enter your username', 'ultimate-member' ) );
}
if ( isset( $submitted_data['user_email'] ) && $submitted_data['user_email'] == '' ) {
if ( isset( $submitted_data['user_email'] ) && ( '' === $submitted_data['user_email'] || ! is_email( $submitted_data['user_email'] ) ) ) {
UM()->form()->add_error( 'user_email', __( 'Please enter your email', 'ultimate-member' ) );
}
@@ -28,7 +28,7 @@ function um_submit_form_errors_hook_login( $submitted_data ) {
$field = 'username';
if ( is_email( $submitted_data['username'] ) ) {
$data = get_user_by('email', $submitted_data['username'] );
$user_name = isset( $data->user_login ) ? $data->user_login : null;
$user_name = isset( $data->user_login ) ? $data->user_login : '';
} else {
$user_name = $submitted_data['username'];
}
@@ -36,7 +36,7 @@ function um_submit_form_errors_hook_login( $submitted_data ) {
$authenticate = $submitted_data['user_email'];
$field = 'user_email';
$data = get_user_by('email', $submitted_data['user_email'] );
$user_name = isset( $data->user_login ) ? $data->user_login : null;
$user_name = isset( $data->user_login ) ? $data->user_login : '';
} else {
$field = 'user_login';
$user_name = $submitted_data['user_login'];
@@ -160,7 +160,7 @@ add_action( 'um_submit_form_errors_hook_logincheck', 'um_submit_form_errors_hook
* @param $user_id
*/
function um_store_lastlogin_timestamp( $user_id ) {
update_user_meta( $user_id, '_um_last_login', current_time( 'timestamp' ) );
update_user_meta( $user_id, '_um_last_login', current_time( 'mysql', true ) );
// Flush user cache after updating last_login timestamp.
UM()->user()->remove_cache( $user_id );
}

Some files were not shown because too many files have changed in this diff Show More