!!! IMPORTANT 2.0 version before upgrade please run full backup of your site !!!
- new code structure, optimized for next development; - created spl_autoloader for remove includes; - UM classes with namespaces; - deprecated global $ultimatemember; variable (use UM() instead); - new UM/WP roles logic; - new settings class and logic (deprecated Redux framework, deprecated some old options, added some new options); - new dependencies class for extensions; - WP native styles for backend fields; - new upgrades and license activations for extensions; - new logic form backend forms and fields; - created uninstall.php file for delete permanently all UM settings; - optimized registration/upgrade profile process; Deprecated Hooks: um_new_user_registration_plain um_user_registration_extra_hook um_add_user_frontend um_post_registration_global_hook um_admin_extend_directory_options_general (was action...will be filter)
@@ -0,0 +1,304 @@
|
||||
/*
|
||||
- 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;
|
||||
}
|
||||
.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;
|
||||
}
|
||||
|
||||
/*
|
||||
- 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%;
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
.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-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_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;
|
||||
}
|
||||
@@ -0,0 +1,212 @@
|
||||
#um-extensions-wrap a.plugin-image,
|
||||
#um-extensions-wrap a.plugin-image img {
|
||||
max-width: 100%;
|
||||
display: block;
|
||||
}
|
||||
|
||||
#um-extensions-wrap .plugin-card {
|
||||
width: calc( 33% - 8px );
|
||||
clear: none !important;
|
||||
margin-right: 8px !important;
|
||||
margin-left: 0 !important;
|
||||
}
|
||||
|
||||
|
||||
#um-extensions-wrap .plugin-image img {
|
||||
display: inline-block;
|
||||
width: 70px;
|
||||
margin: auto;
|
||||
/* padding-top: 40px; */
|
||||
border-radius: 500px;
|
||||
height: 70px;
|
||||
padding: 5px;
|
||||
background: #fff;
|
||||
box-shadow: 0 4px 6px rgba(50,50,93,.11), 0 1px 3px rgba(0,0,0,.08);
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
#um-extensions-wrap .plugin-card-top h3 {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#um-extensions-wrap .plugin-card-top .desc {
|
||||
text-align: center;
|
||||
margin: 0 !important;
|
||||
padding: 10px 0 0 0 !important;
|
||||
}
|
||||
|
||||
#um-extensions-wrap .action-links {
|
||||
margin: 0 !important;
|
||||
padding: 20px 0 0 0 !important;
|
||||
position: static;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#um-extensions-wrap .action-links ul {
|
||||
margin: 0 0 10px 0 !important;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#um-extensions-wrap .action-links ul li {
|
||||
display: inline;
|
||||
float: left;
|
||||
clear: none;
|
||||
line-height: 28px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
|
||||
@media (max-width: 992px) {
|
||||
#um-extensions-wrap .plugin-card {
|
||||
width: calc( 50% - 8px );
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 782px) {
|
||||
#um-extensions-wrap .plugin-card {
|
||||
width: calc( 100% - 8px );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
#um-extensions-wrap .action-links ul li:last-child {
|
||||
float: right;
|
||||
}
|
||||
|
||||
|
||||
#um-extensions-wrap .plugin-card-top {
|
||||
min-height: 140px;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 782px) {
|
||||
#um-extensions-wrap .plugin-card {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#um-extensions-wrap .plugin-card-top {
|
||||
min-height: 120px;
|
||||
}
|
||||
}
|
||||
|
||||
#um-extensions-wrap .plugin-card .name,
|
||||
#um-extensions-wrap .plugin-card .desc {
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
#um-metaboxes-general h2 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}
|
||||
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
- 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;
|
||||
}
|
||||
@@ -0,0 +1,174 @@
|
||||
.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;
|
||||
}
|
||||
|
||||
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 {
|
||||
float: left;
|
||||
width:100%;
|
||||
margin: 0 0 10px 0;
|
||||
}
|
||||
|
||||
.um-hidden-multi-text,
|
||||
.um-hidden-multi-selects {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.um-multi-text-option-line,
|
||||
.um-multi-selects-option-line {
|
||||
float:left;
|
||||
width:100%;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
clear:both;
|
||||
}
|
||||
|
||||
.um-multi-text-option-line .um-field-wrapper,
|
||||
.um-multi-selects-option-line .um-field-wrapper {
|
||||
float:left;
|
||||
width: calc( 100% - 60px );
|
||||
line-height: 30px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.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 {
|
||||
float:left;
|
||||
width: 60px;
|
||||
line-height: 30px;
|
||||
padding: 0 10px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.um-form-table .description {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
|
||||
.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 );
|
||||
}
|
||||
|
||||
|
||||
@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 {
|
||||
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;
|
||||
}
|
||||
@@ -0,0 +1,181 @@
|
||||
.um-admin-notice {
|
||||
border-color: #0085ba !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 {
|
||||
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 {
|
||||
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_edit_role #title {
|
||||
width: calc( 100% - 40px );
|
||||
float:left;
|
||||
}
|
||||
|
||||
#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;
|
||||
background-color: #333;
|
||||
position: absolute;
|
||||
z-index: 1000000;
|
||||
max-width: 300px;
|
||||
font-size: 12px;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.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;
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
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}
|
||||
@@ -0,0 +1,260 @@
|
||||
/*
|
||||
- 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;
|
||||
}
|
||||
@@ -0,0 +1,298 @@
|
||||
/*
|
||||
- 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 {
|
||||
border-top: 1px solid #e5e5e5;
|
||||
padding-top: 15px;
|
||||
}
|
||||
|
||||
.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: 10px 0 0 0;
|
||||
}
|
||||
|
||||
.um-admin-btn-content p {
|
||||
float: left;
|
||||
margin-right: 10px !important;
|
||||
padding: 0 !important;
|
||||
}
|
||||
|
||||
.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;}
|
||||
@@ -0,0 +1,59 @@
|
||||
.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;
|
||||
}
|
||||
@@ -0,0 +1,193 @@
|
||||
/*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: 2px 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: 2px 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;
|
||||
}
|
||||
@@ -0,0 +1,216 @@
|
||||
.um-settings-section .description {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
.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;
|
||||
}
|
||||
|
||||
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: 220px;
|
||||
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%;
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 3.7 KiB |
|
After Width: | Height: | Size: 2.6 KiB |
|
After Width: | Height: | Size: 6.6 KiB |
|
After Width: | Height: | Size: 9.3 KiB |
@@ -0,0 +1,56 @@
|
||||
jQuery(document).ready(function() {
|
||||
|
||||
jQuery(document).ajaxStart(function(){
|
||||
jQuery('.tipsy').hide();
|
||||
});
|
||||
|
||||
jQuery(document).on('click', 'a[data-silent_action^="um_"]',function(){
|
||||
|
||||
if ( typeof jQuery(this).attr('disabled') !== 'undefined' )
|
||||
return false;
|
||||
|
||||
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');
|
||||
}
|
||||
|
||||
act_id = jQuery(this).data('silent_action');
|
||||
arg1 = jQuery(this).data('arg1');
|
||||
arg2 = jQuery(this).data('arg2');
|
||||
|
||||
jQuery('.tipsy').hide();
|
||||
|
||||
um_admin_remove_modal();
|
||||
|
||||
jQuery.ajax({
|
||||
url: um_admin_ajax_data.ajax_url,
|
||||
type: 'POST',
|
||||
data: { 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 },
|
||||
success: function(data){
|
||||
|
||||
jQuery('.um-col-demon-settings').data('in_row', '');
|
||||
jQuery('.um-col-demon-settings').data('in_sub_row', '');
|
||||
jQuery('.um-col-demon-settings').data('in_column', '');
|
||||
jQuery('.um-col-demon-settings').data('in_group', '');
|
||||
|
||||
um_admin_modal_responsive();
|
||||
um_admin_update_builder();
|
||||
|
||||
},
|
||||
error: function(data){
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
@@ -0,0 +1,44 @@
|
||||
/**
|
||||
This function updates the
|
||||
builder area with fields
|
||||
**/
|
||||
|
||||
function um_admin_update_builder() {
|
||||
|
||||
form_id = jQuery('.um-admin-builder').data('form_id');
|
||||
|
||||
jQuery('.tipsy').hide();
|
||||
|
||||
jQuery.ajax({
|
||||
url: um_admin_builder_data.ajax_url,
|
||||
type: 'POST',
|
||||
data: {
|
||||
form_id: form_id
|
||||
},
|
||||
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() {
|
||||
|
||||
});
|
||||
@@ -0,0 +1,3 @@
|
||||
jQuery(document).ready(function() {
|
||||
|
||||
});
|
||||
@@ -0,0 +1,410 @@
|
||||
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').removeAttr('disabled');
|
||||
|
||||
} 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: um_admin_dragdrop_data.ajax_url,
|
||||
type: 'POST',
|
||||
data: jQuery( '.um_update_order' ).serialize(),
|
||||
success: function(){
|
||||
jQuery('#publish').removeAttr('disabled');
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
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).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).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).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 */
|
||||
jQuery(document).on('click', 'a[data-remove_element^="um-"]',function(){
|
||||
element = jQuery(this).data('remove_element');
|
||||
|
||||
jQuery(this).parents('.' +element).find('.um-admin-drag-fld').each(function(){
|
||||
jQuery(this).find('a[data-silent_action="um_admin_remove_field"]').trigger('click');
|
||||
});
|
||||
|
||||
jQuery(this).parents('.' +element).remove();
|
||||
jQuery('.tipsy').remove();
|
||||
UM_Rows_Refresh();
|
||||
});
|
||||
|
||||
/* dynamically change columns */
|
||||
jQuery(document).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();
|
||||
|
||||
});
|
||||
@@ -0,0 +1,89 @@
|
||||
jQuery(document).ready(function() {
|
||||
|
||||
/* Remove field permanently */
|
||||
jQuery(document).on('click', '.um-admin-btns a span.remove', function(e){
|
||||
e.preventDefault();
|
||||
|
||||
if (confirm('This will permanently delete this custom field from database')) {
|
||||
|
||||
jQuery(this).parents('a').remove();
|
||||
|
||||
arg1 = jQuery(this).parents('a').data('arg1');
|
||||
|
||||
jQuery.ajax({
|
||||
url: um_admin_field_data.do_ajax_url,
|
||||
type: 'POST',
|
||||
data: {act_id : 'um_admin_remove_field_global', arg1 : arg1 },
|
||||
success: function(data){
|
||||
|
||||
},
|
||||
error: function(data){
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
/* Add a Field */
|
||||
jQuery(document).on('submit', 'form.um_add_field', function(e){
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
var form = jQuery(this);
|
||||
|
||||
jQuery.ajax({
|
||||
url: um_admin_field_data.ajax_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(data){
|
||||
|
||||
if (data.error){
|
||||
|
||||
c = 0;
|
||||
jQuery.each(data.error, function(i, v){
|
||||
c++;
|
||||
if ( c == 1 ) {
|
||||
form.find('#'+i).addClass('um-admin-error').focus();
|
||||
form.find('.um-admin-error-block').show().html(v);
|
||||
}
|
||||
});
|
||||
|
||||
um_admin_modal_responsive();
|
||||
|
||||
} else {
|
||||
|
||||
jQuery('.um-col-demon-settings').data('in_row', '');
|
||||
jQuery('.um-col-demon-settings').data('in_sub_row', '');
|
||||
jQuery('.um-col-demon-settings').data('in_column', '');
|
||||
jQuery('.um-col-demon-settings').data('in_group', '');
|
||||
|
||||
um_admin_remove_modal();
|
||||
um_admin_update_builder();
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
error: function(data){
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
@@ -0,0 +1,38 @@
|
||||
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#_um_mode').val()+'"]');
|
||||
|
||||
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();
|
||||
jQuery('.empty-container').css({'border' : 'none'});
|
||||
jQuery('.um-admin-builder').removeClass().addClass( 'um-admin-builder ' + jQuery('input#_um_mode').val() );
|
||||
|
||||
}
|
||||
|
||||
/* Creating new form button */
|
||||
jQuery('.um-admin-boxed-links:not(.is-core-form) a').click(function(){
|
||||
|
||||
var tab = jQuery(this);
|
||||
|
||||
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();
|
||||
jQuery('input#_um_mode').val( tab.data('role') );
|
||||
jQuery('.empty-container').css({'border' : 'none'});
|
||||
jQuery('.um-admin-builder').removeClass().addClass( 'um-admin-builder ' + jQuery('input#_um_mode').val() );
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
@@ -0,0 +1,241 @@
|
||||
jQuery(document).ready( function() {
|
||||
|
||||
/**
|
||||
* Multi-selects field
|
||||
*/
|
||||
jQuery( 'body' ).on( 'click', '.um-select-delete', function() {
|
||||
jQuery( this ).parents( 'li.um-multi-selects-option-line' ).remove();
|
||||
});
|
||||
|
||||
|
||||
jQuery( '.um-multi-selects-add-option' ).click( function() {
|
||||
var list = jQuery(this).siblings('ul.um-multi-selects-list');
|
||||
|
||||
var field_id = list.data('field_id');
|
||||
var k = 0;
|
||||
if ( list.find( 'li:last select.um-forms-field' ).length > 0 ) {
|
||||
k = list.find( 'li:last select.um-forms-field' ).attr('id').split("-");
|
||||
k = k[1]*1 + 1;
|
||||
}
|
||||
|
||||
var selector_html = jQuery( '<div>' ).append( list.siblings('.um-hidden-multi-selects').clone() ).html();
|
||||
|
||||
var classes = list.find('li:last').attr('class');
|
||||
|
||||
list.append(
|
||||
'<li class="' + classes + '"><span class="um-field-wrapper">' + selector_html +
|
||||
'</span><span class="um-field-control"><a href="javascript:void(0);" class="um-select-delete">' + php_data.texts.remove + '</a></span></li>'
|
||||
);
|
||||
|
||||
list.find('li:last .um-hidden-multi-selects').attr('name', jQuery(this).data('name') ).
|
||||
addClass('um-forms-field um-long-field').removeClass('um-hidden-multi-selects').attr('id', list.data('id_attr') + '-' + k);
|
||||
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Multi-text field
|
||||
*/
|
||||
jQuery( 'body' ).on( 'click', '.um-text-delete', function() {
|
||||
jQuery(this).parents('li.um-multi-text-option-line').remove();
|
||||
});
|
||||
|
||||
|
||||
jQuery( '.um-multi-text-add-option' ).click( function() {
|
||||
var list = jQuery(this).siblings( 'ul.um-multi-text-list' );
|
||||
|
||||
var field_id = list.data( 'field_id' );
|
||||
var k = 0;
|
||||
if ( list.find( 'li:last input.um-forms-field' ).length > 0 ) {
|
||||
k = list.find( 'li:last input.um-forms-field' ).attr('id').split("-");
|
||||
k = k[1]*1 + 1;
|
||||
}
|
||||
|
||||
var text_html = jQuery( '<div>' ).append( list.siblings('.um-hidden-multi-text').clone() ).html();
|
||||
|
||||
var classes = list.find('li:last').attr('class');
|
||||
|
||||
list.append(
|
||||
'<li class="' + classes + '"><span class="um-field-wrapper">' + text_html +
|
||||
'</span><span class="um-field-control"><a href="javascript:void(0);" class="um-text-delete">' + php_data.texts.remove + '</a></span></li>'
|
||||
);
|
||||
|
||||
list.find('li:last .um-hidden-multi-text').attr('name', jQuery(this).data('name') ).
|
||||
addClass('um-forms-field um-long-field').removeClass('um-hidden-multi-text').attr('id', list.data('id_attr') + '-' + k);
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Media uploader
|
||||
*/
|
||||
jQuery( '.um-media-upload' ).each( function() {
|
||||
var field = jQuery(this).find( '.um-forms-field' );
|
||||
var default_value = field.data('default');
|
||||
|
||||
if ( field.val() != '' && field.val() != default_value ) {
|
||||
field.siblings('.um-set-image').hide();
|
||||
field.siblings('.um-clear-image').show();
|
||||
field.siblings('.icon_preview').show();
|
||||
} else {
|
||||
if ( field.val() == default_value ) {
|
||||
field.siblings('.icon_preview').show();
|
||||
}
|
||||
field.siblings('.um-set-image').show();
|
||||
field.siblings('.um-clear-image').hide();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
if ( typeof wp !== 'undefined' && wp.media && wp.media.editor ) {
|
||||
var frame;
|
||||
|
||||
jQuery( '.um-set-image' ).click( function(e) {
|
||||
var button = jQuery(this);
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
// If the media frame already exists, reopen it.
|
||||
if ( frame ) {
|
||||
frame.remove();
|
||||
/*frame.open();
|
||||
return;*/
|
||||
}
|
||||
|
||||
// Create a new media frame
|
||||
frame = wp.media({
|
||||
title: button.data('upload_frame'),
|
||||
button: {
|
||||
text: php_data.texts.select
|
||||
},
|
||||
multiple: false // Set to true to allow multiple files to be selected
|
||||
});
|
||||
|
||||
// When an image is selected in the media frame...
|
||||
frame.on( 'select', function() {
|
||||
// Get media attachment details from the frame state
|
||||
var attachment = frame.state().get('selection').first().toJSON();
|
||||
|
||||
// Send the attachment URL to our custom image input field.
|
||||
button.siblings('.icon_preview').attr( 'src', attachment.url ).show();
|
||||
|
||||
button.siblings('.um-forms-field').val( attachment.url );
|
||||
button.siblings('.um-media-upload-data-id').val(attachment.id);
|
||||
button.siblings('.um-media-upload-data-width').val(attachment.width);
|
||||
button.siblings('.um-media-upload-data-height').val(attachment.height);
|
||||
button.siblings('.um-media-upload-data-thumbnail').val(attachment.thumbnail);
|
||||
button.siblings('.um-media-upload-url').val(attachment.url);
|
||||
|
||||
button.siblings('.um-clear-image').show();
|
||||
button.hide();
|
||||
});
|
||||
|
||||
frame.open();
|
||||
});
|
||||
|
||||
jQuery('.icon_preview').click( function(e) {
|
||||
jQuery(this).siblings('.um-set-image').trigger('click');
|
||||
});
|
||||
|
||||
jQuery('.um-clear-image').click( function(e) {
|
||||
var default_image_url = jQuery(this).siblings('.um-forms-field').data('default');
|
||||
jQuery(this).siblings('.um-set-image').show();
|
||||
jQuery(this).hide();
|
||||
jQuery(this).siblings('.icon_preview').attr( 'src', default_image_url );
|
||||
jQuery(this).siblings('.um-media-upload-data-id').val('');
|
||||
jQuery(this).siblings('.um-media-upload-data-width').val('');
|
||||
jQuery(this).siblings('.um-media-upload-data-height').val('');
|
||||
jQuery(this).siblings('.um-media-upload-data-thumbnail').val('');
|
||||
jQuery(this).siblings('.um-forms-field').val( default_image_url );
|
||||
jQuery(this).siblings('.um-media-upload-url').val( default_image_url );
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* On option fields change
|
||||
*/
|
||||
jQuery('body').on('change', '.um-forms-field', function() {
|
||||
if ( jQuery('.um-forms-line[data-conditional*=\'"' + jQuery(this).data('field_id') + '",\']').length > 0 ) {
|
||||
run_check_conditions();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//first load hide unconditional fields
|
||||
run_check_conditions();
|
||||
|
||||
|
||||
/**
|
||||
* Run conditional logic
|
||||
*/
|
||||
function run_check_conditions() {
|
||||
jQuery( '.um-forms-line' ).removeClass('um-forms-line-conditioned').each( function() {
|
||||
if ( typeof jQuery(this).data('conditional') === 'undefined' || jQuery(this).hasClass('um-forms-line-conditioned') )
|
||||
return;
|
||||
|
||||
if ( check_condition( jQuery(this) ) )
|
||||
jQuery(this).show();
|
||||
else
|
||||
jQuery(this).hide();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Conditional logic
|
||||
*
|
||||
* true - show field
|
||||
* false - hide field
|
||||
*
|
||||
* @returns {boolean}
|
||||
*/
|
||||
function check_condition( form_line ) {
|
||||
|
||||
form_line.addClass( 'um-forms-line-conditioned' );
|
||||
|
||||
var conditional = form_line.data('conditional');
|
||||
var condition = conditional[1];
|
||||
var value = conditional[2];
|
||||
|
||||
var prefix = form_line.data( 'prefix' );
|
||||
//var prefix = form_line.parents( '.um-form-table' ).data( 'prefix' );
|
||||
|
||||
var condition_field = jQuery( '#' + prefix + '_' + conditional[0] );
|
||||
var parent_condition = true;
|
||||
if ( typeof condition_field.parents('.um-forms-line').data('conditional') !== 'undefined' ) {
|
||||
parent_condition = check_condition( condition_field.parents('.um-forms-line') );
|
||||
}
|
||||
|
||||
var own_condition = false;
|
||||
if ( condition == '=' ) {
|
||||
var tagName = condition_field.prop("tagName").toLowerCase();
|
||||
|
||||
if ( tagName == 'input' ) {
|
||||
var input_type = condition_field.attr('type');
|
||||
if ( input_type == 'checkbox' ) {
|
||||
own_condition = ( value == '1' ) ? condition_field.is(':checked') : ! condition_field.is(':checked');
|
||||
} else {
|
||||
own_condition = ( condition_field.val() == value );
|
||||
}
|
||||
} else if ( tagName == 'select' ) {
|
||||
own_condition = ( condition_field.val() == value );
|
||||
}
|
||||
} else if ( condition == '!=' ) {
|
||||
var tagName = condition_field.prop("tagName").toLowerCase();
|
||||
|
||||
if ( tagName == 'input' ) {
|
||||
var input_type = condition_field.attr('type');
|
||||
if ( input_type == 'checkbox' ) {
|
||||
own_condition = ( value == '1' ) ? ! condition_field.is(':checked') : condition_field.is(':checked');
|
||||
} else {
|
||||
own_condition = ( condition_field.val() != value );
|
||||
}
|
||||
} else if ( tagName == 'select' ) {
|
||||
own_condition = ( condition_field.val() != value );
|
||||
}
|
||||
}
|
||||
|
||||
return ( own_condition && parent_condition );
|
||||
}
|
||||
|
||||
});
|
||||
@@ -0,0 +1,373 @@
|
||||
function um_admin_live_update_scripts() {
|
||||
|
||||
/*jQuery('.um-admin-modal-body:visible select').select2({
|
||||
allowClear: false,
|
||||
minimumResultsForSearch: 10
|
||||
});*/
|
||||
|
||||
jQuery('.um-adm-conditional').each(function(){jQuery(this).trigger('change');});
|
||||
|
||||
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 class="um-admin-modal" />');
|
||||
jQuery('#' + id).prependTo('.um-admin-modal');
|
||||
jQuery('#' + id).show();
|
||||
jQuery('.um-admin-modal').show();
|
||||
|
||||
jQuery('.um-admin-modal-head').append('<a href="#" 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_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');
|
||||
}
|
||||
|
||||
jQuery.ajax({
|
||||
url: um_admin_modal_data.ajax_url,
|
||||
type: 'POST',
|
||||
data: {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 },
|
||||
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' ) {
|
||||
|
||||
tinyMCE.execCommand('mceRemoveEditor', true, 'um_editor_edit');
|
||||
jQuery('.um-admin-editor:visible').html( jQuery('.um-hidden-editor-edit').contents() );
|
||||
tinyMCE.execCommand('mceAddEditor', true, 'um_editor_edit');
|
||||
|
||||
jQuery('.switch-html').trigger('click');
|
||||
jQuery('.switch-html').trigger('click');
|
||||
jQuery('.switch-tmce').trigger('click');
|
||||
|
||||
jQuery('#um_editor_edit_ifr').height(200);
|
||||
|
||||
var editor = tinyMCE.get('um_editor_edit');
|
||||
var content = editor.getContent();
|
||||
editor.setContent( jQuery('.um-admin-modal:visible .dynamic-mce-content').html() );
|
||||
|
||||
} else {
|
||||
|
||||
tinyMCE.execCommand('mceRemoveEditor', true, 'um_editor_new');
|
||||
jQuery('.um-admin-editor:visible').html( jQuery('.um-hidden-editor-new').contents() );
|
||||
tinyMCE.execCommand('mceAddEditor', true, 'um_editor_new');
|
||||
|
||||
jQuery('.switch-html').trigger('click');
|
||||
jQuery('.switch-html').trigger('click');
|
||||
jQuery('.switch-tmce').trigger('click');
|
||||
|
||||
jQuery('#um_editor_new_ifr').height(200);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
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 });
|
||||
}
|
||||
|
||||
function um_admin_remove_modal(){
|
||||
|
||||
if ( jQuery('.um-admin-editor:visible').length > 0 ) {
|
||||
|
||||
if ( jQuery('.um-admin-modal:visible').find('form').parent().attr('id') == 'UM_edit_field' ) {
|
||||
|
||||
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 {
|
||||
|
||||
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('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).on('click', '.um-admin-builder a, .um-admin-modal a', function(e){
|
||||
e.preventDefault();
|
||||
return false;
|
||||
});
|
||||
|
||||
/**
|
||||
toggle area
|
||||
**/
|
||||
jQuery(document).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).on('click', '.um-admin-new-condition', function(){
|
||||
if ( jQuery(this).hasClass('disabled') )
|
||||
return false;
|
||||
|
||||
var content = jQuery(this).parents('.um-admin-btn-content');
|
||||
var length = content.find('.um-admin-cur-condition').length;
|
||||
if ( length < 5 ) {
|
||||
//content.find('select').select2('destroy');
|
||||
|
||||
var cloned = jQuery(this).parents('.um-admin-cur-condition').clone();
|
||||
cloned.find('input[type=text],select').each(function(){
|
||||
jQuery(this).attr('id', jQuery(this).attr('id') + length );
|
||||
jQuery(this).attr('name', jQuery(this).attr('name') + length );
|
||||
});
|
||||
cloned.find('input[type=text]').val('');
|
||||
cloned.find('.um-admin-new-condition').replaceWith('<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>');
|
||||
|
||||
cloned.appendTo( content );
|
||||
cloned.find('select').val('');
|
||||
um_admin_live_update_scripts();
|
||||
um_admin_modal_responsive();
|
||||
} else {
|
||||
jQuery(this).addClass('disabled');
|
||||
alert( 'You already have 5 rules' );
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
reset conditions
|
||||
**/
|
||||
jQuery(document).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).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();
|
||||
um_admin_live_update_scripts();
|
||||
um_admin_modal_responsive();
|
||||
});
|
||||
|
||||
/**
|
||||
remove modal via action
|
||||
**/
|
||||
jQuery(document).on('click', '.um-admin-overlay, a[data-action="UM_remove_modal"]', function(){
|
||||
um_admin_remove_modal();
|
||||
});
|
||||
|
||||
/**
|
||||
fire new modal
|
||||
**/
|
||||
jQuery(document).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).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).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').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' ) {
|
||||
um_admin_remove_modal();
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
restore font icon
|
||||
**/
|
||||
jQuery(document).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('No Icon');
|
||||
jQuery(this).hide();
|
||||
});
|
||||
|
||||
/**
|
||||
search font icons
|
||||
**/
|
||||
jQuery(document).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).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: um_admin_modal_data.dropdown_ajax_url,
|
||||
type: 'POST',
|
||||
data: { um_option_callback: um_option_callback },
|
||||
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
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
jQuery( document ).ready( function() {
|
||||
|
||||
jQuery( '#role' ).change( function() {
|
||||
if ( jQuery.inArray( jQuery(this).val().substr(3), um_roles ) !== -1 ) {
|
||||
jQuery( '#um_role_selector_wrapper' ).hide();
|
||||
jQuery( '#um-role' ).val('');
|
||||
} else {
|
||||
jQuery( '#um_role_selector_wrapper' ).show();
|
||||
}
|
||||
}).trigger('change');
|
||||
|
||||
});
|
||||
@@ -0,0 +1,210 @@
|
||||
jQuery(document).ready(function() {
|
||||
|
||||
/**
|
||||
clone a field dropdown
|
||||
**/
|
||||
jQuery(document).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).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').click(function(e){
|
||||
e.preventDefault();
|
||||
return false;
|
||||
});
|
||||
|
||||
/**
|
||||
On/Off Buttons
|
||||
**/
|
||||
|
||||
jQuery(document).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
|
||||
**/
|
||||
|
||||
jQuery('.um-admin-colorpicker').wpColorPicker();
|
||||
|
||||
/* /!**
|
||||
Select Dropdowns
|
||||
**!/
|
||||
|
||||
jQuery(".umaf-selectjs").select2({
|
||||
allowClear: false,
|
||||
minimumResultsForSearch: 10
|
||||
});
|
||||
|
||||
jQuery('.um-admin-field select').select2({
|
||||
allowClear: true,
|
||||
minimumResultsForSearch: 10
|
||||
});*/
|
||||
|
||||
/**
|
||||
Tooltips
|
||||
**/
|
||||
if ( jQuery( '.um_tooltip' ).length > 0 ) {
|
||||
jQuery( '.um_tooltip' ).tooltip({
|
||||
tooltipClass: "um_tooltip",
|
||||
content: function () {
|
||||
return jQuery( this ).attr( 'title' );
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
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).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]').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('input[type=radio]:checked').val() ) {
|
||||
if ( jQuery(this).find('input[type=radio]:checked').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).on('click', '.um-nav-mode input[type=radio]', 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();
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
@@ -0,0 +1,12 @@
|
||||
jQuery( document ).ready( function() {
|
||||
|
||||
/**
|
||||
* Licenses
|
||||
*/
|
||||
jQuery( 'body' ).on( 'click', '.um_license_deactivate', function() {
|
||||
jQuery(this).siblings('.um-option-field').val('');
|
||||
jQuery(this).parents('form.um-settings-form').submit();
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
namespace um\admin;
|
||||
|
||||
// Exit if accessed directly.
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
if ( ! class_exists( 'Admin' ) ) {
|
||||
|
||||
class Admin {
|
||||
var $templates_path;
|
||||
|
||||
function __construct() {
|
||||
$this->templates_path = um_path . 'includes/admin/templates/';
|
||||
|
||||
add_action( 'admin_init', array( &$this, 'admin_init' ), 0 );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Init admin action/filters + request handlers
|
||||
*/
|
||||
function admin_init() {
|
||||
require_once 'core/um-admin-actions-user.php';
|
||||
require_once 'core/um-admin-actions-modal.php';
|
||||
require_once 'core/um-admin-actions.php';
|
||||
|
||||
require_once 'core/um-admin-filters-fields.php';
|
||||
|
||||
if ( is_admin() && current_user_can('manage_options') &&
|
||||
! empty( $_REQUEST['um_adm_action'] ) ) {
|
||||
do_action( "um_admin_do_action__", $_REQUEST['um_adm_action'] );
|
||||
do_action( "um_admin_do_action__{$_REQUEST['um_adm_action']}", $_REQUEST['um_adm_action'] );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,681 @@
|
||||
<?php
|
||||
namespace um\admin\core;
|
||||
|
||||
// Exit if accessed directly.
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
if ( ! class_exists( 'Admin_Builder' ) ) {
|
||||
class Admin_Builder {
|
||||
|
||||
var $form_id;
|
||||
|
||||
function __construct() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
*** @update the builder area
|
||||
***/
|
||||
function update_builder() {
|
||||
|
||||
if ( !is_user_logged_in() || !current_user_can('manage_options') ) die('Please login as administrator');
|
||||
|
||||
extract($_POST);
|
||||
|
||||
ob_start();
|
||||
|
||||
$this->form_id = $_POST['form_id'];
|
||||
|
||||
$this->show_builder();
|
||||
|
||||
$output = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
if(is_array($output)){ print_r($output); }else{ echo $output; } die;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
*** @sort array function
|
||||
***/
|
||||
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];
|
||||
}
|
||||
|
||||
if ( ! empty( $sort_col ) )
|
||||
array_multisort( $sort_col, $dir, $arr );
|
||||
|
||||
return $arr;
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
*** @get fields in row
|
||||
***/
|
||||
function get_fields_by_row( $row_id ) {
|
||||
|
||||
if( empty( $this->global_fields) || ! is_array( $this->global_fields ) ){
|
||||
$this->global_fields = array();
|
||||
}
|
||||
|
||||
foreach( $this->global_fields as $key => $array ) {
|
||||
if ( !isset( $array['in_row'] ) || ( isset( $array['in_row'] ) && $array['in_row'] == $row_id ) ) {
|
||||
$results[$key] = $array;
|
||||
unset( $this->global_fields[$key] );
|
||||
}
|
||||
}
|
||||
return ( isset ( $results ) ) ? $results : '';
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
*** @get fields by sub row
|
||||
***/
|
||||
function get_fields_in_subrow( $row_fields, $subrow_id ) {
|
||||
if ( !is_array( $row_fields ) ) return '';
|
||||
foreach( $row_fields as $key => $array ) {
|
||||
if ( !isset( $array['in_sub_row'] ) || ( isset( $array['in_sub_row'] ) && $array['in_sub_row'] == $subrow_id ) ) {
|
||||
$results[$key] = $array;
|
||||
unset( $this->global_fields[$key] );
|
||||
}
|
||||
}
|
||||
return ( isset ( $results ) ) ? $results : '';
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
*** @Display the builder
|
||||
***/
|
||||
function show_builder() {
|
||||
|
||||
$fields = UM()->query()->get_attr( 'custom_fields', $this->form_id );
|
||||
|
||||
if ( !isset( $fields ) || empty( $fields ) ) { ?>
|
||||
|
||||
<div class="um-admin-drag-row">
|
||||
|
||||
<!-- Master Row Actions -->
|
||||
<div class="um-admin-drag-row-icons">
|
||||
<a href="#" class="um-admin-drag-rowsub-add um-admin-tipsy-n" title="<?php _e('Add Row','ultimate-member'); ?>" data-row_action="add_subrow"><i class="um-icon-plus"></i></a>
|
||||
<a href="#" class="um-admin-drag-row-edit um-admin-tipsy-n" title="<?php _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 $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="um-admin-drag-rowsubs">
|
||||
<div class="um-admin-drag-rowsub">
|
||||
|
||||
<!-- Column Layout -->
|
||||
<div class="um-admin-drag-ctrls columns">
|
||||
<a href="#" class="active" data-cols="1"></a>
|
||||
<a href="#" data-cols="2"></a>
|
||||
<a href="#" data-cols="3"></a>
|
||||
</div>
|
||||
|
||||
<!-- 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>
|
||||
|
||||
<!-- Columns -->
|
||||
<div class="um-admin-drag-col">
|
||||
|
||||
</div>
|
||||
|
||||
<div class="um-admin-drag-col-dynamic"></div>
|
||||
|
||||
<div class="um-admin-clear"></div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<?php
|
||||
|
||||
} else {
|
||||
|
||||
if( empty( $fields) || ! is_array( $fields ) ){
|
||||
$this->global_fields = array();
|
||||
}else{
|
||||
$this->global_fields = $fields;
|
||||
}
|
||||
|
||||
foreach( $this->global_fields as $key => $array ) {
|
||||
if ( $array['type'] == 'row' ) {
|
||||
$rows[$key] = $array;
|
||||
unset( $this->global_fields[ $key ] ); // not needed now
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ( !isset( $rows ) ){
|
||||
$rows = array( '_um_row_1' => array(
|
||||
'type' => 'row',
|
||||
'id' => '_um_row_1',
|
||||
'sub_rows' => 1,
|
||||
'cols' => 1
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
foreach ( $rows as $row_id => $array ) {
|
||||
|
||||
?>
|
||||
|
||||
<div class="um-admin-drag-row" data-original="<?php echo $row_id; ?>">
|
||||
|
||||
<!-- Master Row Actions -->
|
||||
<div class="um-admin-drag-row-icons">
|
||||
<a href="#" class="um-admin-drag-rowsub-add um-admin-tipsy-n" title="<?php _e('Add Row','ultimate-member'); ?>" data-row_action="add_subrow"><i class="um-icon-plus"></i></a>
|
||||
<a href="#" class="um-admin-drag-row-edit um-admin-tipsy-n" title="<?php _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 $this->form_id; ?>" data-arg3="<?php echo $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 ( $row_id != '_um_row_1' ) {?>
|
||||
<a href="#" class="um-admin-tipsy-n" title="<?php _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="um-admin-drag-rowsubs">
|
||||
|
||||
<?php
|
||||
|
||||
$row_fields = $this->get_fields_by_row( $row_id );
|
||||
|
||||
$sub_rows = ( isset( $array['sub_rows'] ) ) ? $array['sub_rows'] : 1;
|
||||
for( $c = 0; $c < $sub_rows; $c++ ) {
|
||||
|
||||
$subrow_fields = $this->get_fields_in_subrow( $row_fields, $c );
|
||||
|
||||
?>
|
||||
|
||||
<div class="um-admin-drag-rowsub">
|
||||
|
||||
<!-- Column Layout -->
|
||||
<div class="um-admin-drag-ctrls columns">
|
||||
|
||||
<?php
|
||||
|
||||
if ( !isset( $array['cols'] ) ){
|
||||
$col_num = 1;
|
||||
} else {
|
||||
|
||||
$col_split = explode(':', $array['cols'] );
|
||||
$col_num = $col_split[$c];
|
||||
|
||||
}
|
||||
|
||||
for ( $i = 1; $i <= 3; $i++ ) {
|
||||
echo '<a href="#" data-cols="'.$i.'" ';
|
||||
if ( $col_num == $i ) echo 'class="active"';
|
||||
echo '></a>';
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- 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>
|
||||
<?php if ( $c > 0 ) { ?><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><?php } ?>
|
||||
</div><div class="um-admin-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');
|
||||
|
||||
foreach( $subrow_fields as $key => $keyarray ) {
|
||||
extract( $keyarray );
|
||||
|
||||
?>
|
||||
|
||||
<div class="um-admin-drag-fld um-admin-delete-area um-field-type-<?php echo $type; ?> <?php echo $key; ?>" data-group="<?php echo (isset($keyarray['in_group'])) ? $keyarray['in_group'] : ''; ?>" data-key="<?php echo $key; ?>" data-column="<?php echo ( isset($keyarray['in_column']) ) ? $keyarray['in_column'] : 1; ?>">
|
||||
|
||||
<div class="um-admin-drag-fld-title um-field-type-<?php echo $type; ?>">
|
||||
<?php if ( $type == 'group' ) { ?>
|
||||
<i class="um-icon-plus"></i>
|
||||
<?php } else if ( isset($keyarray['icon']) && !empty( $keyarray['icon'] ) ) { ?>
|
||||
<i class="<?php echo $keyarray['icon']; ?>"></i>
|
||||
<?php } ?><?php echo $title; ?></div>
|
||||
<?php $field_name = isset( UM()->builtin()->core_fields[$type]['name'] ) ? UM()->builtin()->core_fields[$type]['name'] : ''; ?>
|
||||
<div class="um-admin-drag-fld-type um-field-type-<?php echo $type; ?>"><?php echo $field_name; ?></div>
|
||||
<div class="um-admin-drag-fld-icons um-field-type-<?php echo $type; ?>">
|
||||
|
||||
<a href="#" class="um-admin-tipsy-n" title="Edit" data-modal="UM_edit_field" data-modal-size="normal" data-dynamic-content="um_admin_edit_field_popup" data-arg1="<?php echo $type; ?>" data-arg2="<?php echo $this->form_id; ?>" data-arg3="<?php echo $key; ?>"><i class="um-faicon-pencil"></i></a>
|
||||
|
||||
<a href="#" class="um-admin-tipsy-n um_admin_duplicate_field" title="Duplicate" data-silent_action="um_admin_duplicate_field" data-arg1="<?php echo $key; ?>" data-arg2="<?php echo $this->form_id; ?>"><i class="um-faicon-files-o"></i></a>
|
||||
|
||||
<?php if ( $type == 'group' ) { ?>
|
||||
|
||||
<a href="#" class="um-admin-tipsy-n" title="Delete Group" data-remove_element="um-admin-drag-fld.um-field-type-group" data-silent_action="um_admin_remove_field" data-arg1="<?php echo $key; ?>" data-arg2="<?php echo $this->form_id; ?>"><i class="um-faicon-trash-o"></i></a>
|
||||
<?php } else { ?>
|
||||
|
||||
<a href="#" class="um-admin-tipsy-n" title="Delete" data-silent_action="um_admin_remove_field" data-arg1="<?php echo $key; ?>" data-arg2="<?php echo $this->form_id; ?>"><i class="um-faicon-trash-o"></i></a>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</div><div class="um-admin-clear"></div>
|
||||
|
||||
<?php if ( $type == 'group' ) { ?>
|
||||
<div class="um-admin-drag-group">
|
||||
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
|
||||
<?php
|
||||
|
||||
} // end foreach
|
||||
|
||||
} // end if
|
||||
|
||||
?>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="um-admin-drag-col-dynamic"></div>
|
||||
|
||||
<div class="um-admin-clear"></div>
|
||||
|
||||
</div>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<?php
|
||||
|
||||
} // rows loop
|
||||
|
||||
} // if fields exist
|
||||
|
||||
}
|
||||
|
||||
|
||||
function update_field() {
|
||||
if ( ! is_user_logged_in() || ! current_user_can( 'manage_options' ) )
|
||||
die( __('Please login as administrator','ultimate-member') );
|
||||
|
||||
$output['error'] = null;
|
||||
|
||||
$array = array(
|
||||
'field_type' => $_POST['_type'],
|
||||
'form_id' => $_POST['post_id'],
|
||||
'args' => UM()->builtin()->get_core_field_attrs( $_POST['_type'] ),
|
||||
'post' => $_POST
|
||||
);
|
||||
|
||||
$array = apply_filters("um_admin_pre_save_fields_hook", $array );
|
||||
$output['error'] = apply_filters( 'um_admin_field_update_error_handling', $output['error'], $array );
|
||||
|
||||
extract( $array['post'] );
|
||||
if ( empty( $output['error'] ) ){
|
||||
|
||||
$save = array();
|
||||
$save[ $_metakey ] = null;
|
||||
foreach( $array['post'] as $key => $val){
|
||||
|
||||
if ( substr( $key, 0, 1) === '_' && $val != '' ) { // field attribute
|
||||
$new_key = ltrim ($key,'_');
|
||||
|
||||
if ( $new_key == 'options' ) {
|
||||
//$save[ $_metakey ][$new_key] = explode(PHP_EOL, $val);
|
||||
$save[ $_metakey ][$new_key] = preg_split('/[\r\n]+/', $val, -1, PREG_SPLIT_NO_EMPTY);
|
||||
} else {
|
||||
$save[ $_metakey ][$new_key] = $val;
|
||||
}
|
||||
|
||||
} else if ( strstr( $key, 'um_editor' ) ) {
|
||||
$save[ $_metakey ]['content'] = $val;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$field_ID = $_metakey;
|
||||
$field_args = $save[ $_metakey ];
|
||||
|
||||
$field_args = apply_filters("um_admin_pre_save_field_to_form", $field_args );
|
||||
|
||||
UM()->fields()->update_field( $field_ID, $field_args, $post_id );
|
||||
|
||||
$field_args = apply_filters("um_admin_pre_save_field_to_db", $field_args );
|
||||
|
||||
if ( ! isset( $array['args']['form_only'] ) ) {
|
||||
if ( ! isset( UM()->builtin()->predefined_fields[ $field_ID ] ) ) {
|
||||
UM()->fields()->globally_update_field( $field_ID, $field_args );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$output = json_encode( $output );
|
||||
if ( is_array( $output ) ) {
|
||||
print_r( $output );
|
||||
} else {
|
||||
echo $output;
|
||||
}
|
||||
die;
|
||||
}
|
||||
|
||||
|
||||
function dynamic_modal_content() {
|
||||
$metabox = UM()->metabox();
|
||||
|
||||
if ( !is_user_logged_in() || !current_user_can('manage_options') ) die( __('Please login as administrator','ultimate-member') );
|
||||
|
||||
extract($_POST);
|
||||
|
||||
switch ( $act_id ) {
|
||||
|
||||
default:
|
||||
|
||||
ob_start();
|
||||
|
||||
do_action('um_admin_ajax_modal_content__hook', $act_id );
|
||||
do_action("um_admin_ajax_modal_content__hook_{$act_id}");
|
||||
|
||||
$output = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
break;
|
||||
|
||||
case 'um_admin_fonticon_selector':
|
||||
|
||||
ob_start();
|
||||
|
||||
?>
|
||||
|
||||
<div class="um-admin-metabox">
|
||||
<p class="_icon_search"><input type="text" name="_icon_search" id="_icon_search" value="" placeholder="<?php _e('Search Icons...','ultimate-member'); ?>" /></p>
|
||||
</div>
|
||||
|
||||
<div class="um-admin-icons">
|
||||
<?php foreach( UM()->fonticons()->all as $icon ) { ?>
|
||||
<span data-code="<?php echo $icon; ?>" title="<?php echo $icon; ?>" class="um-admin-tipsy-n"><i class="<?php echo $icon; ?>"></i></span>
|
||||
<?php } ?>
|
||||
</div><div class="um-admin-clear"></div>
|
||||
|
||||
<?php
|
||||
|
||||
$output = ob_get_contents();
|
||||
ob_end_clean();
|
||||
break;
|
||||
|
||||
case 'um_admin_show_fields':
|
||||
|
||||
ob_start();
|
||||
$form_fields = UM()->query()->get_attr( 'custom_fields', $arg2 );
|
||||
$form_fields = array_values( array_filter( array_keys( $form_fields ) ) );
|
||||
//$form_fields = array_keys( $form_fields );
|
||||
?>
|
||||
|
||||
<h4><?php _e('Setup New Field','ultimate-member'); ?></h4>
|
||||
<div class="um-admin-btns">
|
||||
|
||||
<?php
|
||||
if ( UM()->builtin()->core_fields ) {
|
||||
foreach ( UM()->builtin()->core_fields as $field_type => $array ) {
|
||||
|
||||
if ( isset( $array['in_fields'] ) && $array['in_fields'] == false ) { } else {
|
||||
?>
|
||||
|
||||
<a href="#" class="button" data-modal="UM_add_field" data-modal-size="normal" data-dynamic-content="um_admin_new_field_popup" data-arg1="<?php echo $field_type; ?>" data-arg2="<?php echo $arg2 ?>"><?php echo $array['name']; ?></a>
|
||||
|
||||
<?php } } } ?>
|
||||
|
||||
</div>
|
||||
|
||||
<h4><?php _e('Predefined Fields','ultimate-member'); ?></h4>
|
||||
<div class="um-admin-btns">
|
||||
|
||||
<?php
|
||||
if ( UM()->builtin()->predefined_fields ) {
|
||||
foreach ( UM()->builtin()->predefined_fields as $field_key => $array ) {
|
||||
|
||||
if ( !isset( $array['account_only'] ) && !isset( $array['private_use'] ) ) {?>
|
||||
|
||||
<a href="#" class="button" <?php disabled( in_array( $field_key, $form_fields, true ) ) ?> data-silent_action="um_admin_add_field_from_predefined" data-arg1="<?php echo $field_key; ?>" data-arg2="<?php echo $arg2; ?>"><?php echo um_trim_string( stripslashes( $array['title'] ), 20 ); ?></a>
|
||||
|
||||
<?php } } } else { echo '<p>' . __('None','ultimate-member') . '</p>'; } ?>
|
||||
|
||||
</div>
|
||||
|
||||
<h4><?php _e('Custom Fields','ultimate-member'); ?></h4>
|
||||
<div class="um-admin-btns">
|
||||
|
||||
<?php
|
||||
if ( UM()->builtin()->custom_fields ) {
|
||||
foreach ( UM()->builtin()->custom_fields as $field_key => $array ) {
|
||||
|
||||
?>
|
||||
|
||||
<a href="#" 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 $field_key; ?>" data-arg2="<?php echo $arg2; ?>"><?php echo um_trim_string( stripslashes( $array['title'] ), 20 ); ?> <small>(<?php echo ucfirst( $array['type']); ?>)</small><span class="remove"></span></a>
|
||||
|
||||
<?php } } else { echo '<p>' . __('You did not create any custom fields', 'ultimate-member') . '</p>'; } ?>
|
||||
|
||||
</div>
|
||||
|
||||
<?php
|
||||
|
||||
$output = ob_get_contents();
|
||||
ob_end_clean();
|
||||
break;
|
||||
|
||||
case 'um_admin_edit_field_popup':
|
||||
|
||||
ob_start();
|
||||
|
||||
$args = UM()->builtin()->get_core_field_attrs( $arg1 );
|
||||
|
||||
$form_fields = UM()->query()->get_attr( 'custom_fields', $arg2 );
|
||||
|
||||
$metabox->set_field_type = $arg1;
|
||||
$metabox->in_edit = true;
|
||||
$metabox->edit_array = $form_fields[ $arg3 ];
|
||||
|
||||
if ( !isset( $metabox->edit_array['metakey'] ) ){
|
||||
$metabox->edit_array['metakey'] = $metabox->edit_array['id'];
|
||||
}
|
||||
|
||||
if ( !isset( $metabox->edit_array['position'] ) ){
|
||||
$metabox->edit_array['position'] = $metabox->edit_array['id'];
|
||||
}
|
||||
|
||||
extract( $args );
|
||||
|
||||
if ( !isset( $col1 ) ) {
|
||||
|
||||
echo '<p>'. __('This field type is not setup correcty.', 'ultimate-member') . '</p>';
|
||||
|
||||
} else {
|
||||
|
||||
?>
|
||||
|
||||
<?php if ( isset( $metabox->edit_array['in_group'] ) ) { ?>
|
||||
<input type="hidden" name="_in_row" id="_in_row" value="<?php echo $metabox->edit_array['in_row']; ?>" />
|
||||
<input type="hidden" name="_in_sub_row" id="_in_sub_row" value="<?php echo $metabox->edit_array['in_sub_row']; ?>" />
|
||||
<input type="hidden" name="_in_column" id="_in_column" value="<?php echo $metabox->edit_array['in_column']; ?>" />
|
||||
<input type="hidden" name="_in_group" id="_in_group" value="<?php echo $metabox->edit_array['in_group']; ?>" />
|
||||
<?php } ?>
|
||||
|
||||
<input type="hidden" name="_type" id="_type" value="<?php echo $arg1; ?>" />
|
||||
|
||||
<input type="hidden" name="post_id" id="post_id" value="<?php echo $arg2; ?>" />
|
||||
|
||||
<input type="hidden" name="edit_mode" id="edit_mode" value="true" />
|
||||
|
||||
<input type="hidden" name="_metakey" id="_metakey" value="<?php echo $metabox->edit_array['metakey']; ?>" />
|
||||
|
||||
<input type="hidden" name="_position" id="_position" value="<?php echo $metabox->edit_array['position']; ?>" />
|
||||
|
||||
<?php if ( isset( $args['mce_content'] ) ) { ?><div class="dynamic-mce-content"><?php echo $metabox->edit_array['content']; ?></div><?php } ?>
|
||||
|
||||
<?php do_action('um_admin_field_modal_header'); ?>
|
||||
|
||||
<div class="um-admin-half">
|
||||
|
||||
<?php if ( isset( $col1 ) ) { foreach( $col1 as $opt ) $metabox->field_input ( $opt, null, $metabox->edit_array ); } ?>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="um-admin-half um-admin-right">
|
||||
|
||||
<?php if ( isset( $col2 ) ) { foreach( $col2 as $opt ) $metabox->field_input ( $opt, null, $metabox->edit_array ); } ?>
|
||||
|
||||
</div><div class="um-admin-clear"></div>
|
||||
|
||||
<?php if ( isset( $col3 ) ) { foreach( $col3 as $opt ) $metabox->field_input ( $opt, null, $metabox->edit_array ); } ?>
|
||||
|
||||
<div class="um-admin-clear"></div>
|
||||
|
||||
<?php if ( isset( $col_full ) ) {foreach( $col_full as $opt ) $metabox->field_input ( $opt, null, $metabox->edit_array ); } ?>
|
||||
|
||||
<?php do_action('um_admin_field_modal_footer', $arg2, $args, $metabox->in_edit, (isset( $metabox->edit_array ) ) ? $metabox->edit_array : '' ); ?>
|
||||
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
$output = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
break;
|
||||
|
||||
case 'um_admin_new_field_popup':
|
||||
|
||||
ob_start();
|
||||
|
||||
$args = UM()->builtin()->get_core_field_attrs( $arg1 );
|
||||
|
||||
$metabox->set_field_type = $arg1;
|
||||
|
||||
extract( $args );
|
||||
|
||||
if ( !isset( $col1 ) ) {
|
||||
|
||||
echo '<p>'. __('This field type is not setup correcty.', 'ultimate-member') . '</p>';
|
||||
|
||||
} else {
|
||||
|
||||
?>
|
||||
|
||||
<?php if ( $in_column ) { ?>
|
||||
<input type="hidden" name="_in_row" id="_in_row" value="_um_row_<?php echo $in_row + 1; ?>" />
|
||||
<input type="hidden" name="_in_sub_row" id="_in_sub_row" value="<?php echo $in_sub_row; ?>" />
|
||||
<input type="hidden" name="_in_column" id="_in_column" value="<?php echo $in_column; ?>" />
|
||||
<input type="hidden" name="_in_group" id="_in_group" value="<?php echo $in_group; ?>" />
|
||||
<?php } ?>
|
||||
|
||||
<input type="hidden" name="_type" id="_type" value="<?php echo $arg1; ?>" />
|
||||
|
||||
<input type="hidden" name="post_id" id="post_id" value="<?php echo $arg2; ?>" />
|
||||
|
||||
<?php do_action('um_admin_field_modal_header'); ?>
|
||||
|
||||
<div class="um-admin-half">
|
||||
|
||||
<?php if ( isset( $col1 ) ) { foreach( $col1 as $opt ) $metabox->field_input ( $opt ); } ?>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="um-admin-half um-admin-right">
|
||||
|
||||
<?php if ( isset( $col2 ) ) { foreach( $col2 as $opt ) $metabox->field_input ( $opt ); } ?>
|
||||
|
||||
</div><div class="um-admin-clear"></div>
|
||||
|
||||
<?php if ( isset( $col3 ) ) { foreach( $col3 as $opt ) $metabox->field_input ( $opt ); } ?>
|
||||
|
||||
<div class="um-admin-clear"></div>
|
||||
|
||||
<?php if ( isset( $col_full ) ) {foreach( $col_full as $opt ) $metabox->field_input ( $opt ); } ?>
|
||||
|
||||
<?php do_action('um_admin_field_modal_footer', $arg2, $args, $metabox->in_edit, (isset( $metabox->edit_array ) ) ? $metabox->edit_array : '' ); ?>
|
||||
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
$output = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
break;
|
||||
|
||||
case 'um_admin_preview_form':
|
||||
|
||||
$mode = UM()->query()->get_attr('mode', $arg1 );
|
||||
|
||||
if ( $mode == 'profile' ) {
|
||||
UM()->fields()->editing = true;
|
||||
}
|
||||
|
||||
$output = do_shortcode('[ultimatemember form_id='.$arg1.']');
|
||||
|
||||
break;
|
||||
|
||||
case 'um_admin_review_registration':
|
||||
//$user_id = $arg1;
|
||||
um_fetch_user( $arg1 );
|
||||
|
||||
UM()->user()->preview = true;
|
||||
|
||||
$output = um_user_submitted_registration( true );
|
||||
|
||||
um_reset_user();
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
if ( is_array( $output ) ) {
|
||||
print_r( $output );
|
||||
} else {
|
||||
echo $output;
|
||||
}
|
||||
die;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retrieves dropdown/multi-select options from a callback function
|
||||
*/
|
||||
function populate_dropdown_options(){
|
||||
|
||||
$arr_options = array();
|
||||
|
||||
if( ! current_user_can('manage_options') ){
|
||||
wp_die( __( 'This is not possible for security reasons.','ultimate-member') );
|
||||
}
|
||||
|
||||
$um_callback_func = $_POST['um_option_callback'];
|
||||
if( empty( $um_callback_func ) ){
|
||||
$arr_options['status'] = 'empty';
|
||||
$arr_options['function_name'] = $um_callback_func;
|
||||
$arr_options['function_exists'] = function_exists( $um_callback_func );
|
||||
}
|
||||
|
||||
$arr_options['data'] = array();
|
||||
|
||||
if( function_exists( $um_callback_func ) ){
|
||||
$arr_options['data'] = call_user_func( $um_callback_func );
|
||||
}
|
||||
|
||||
wp_send_json( $arr_options );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
<?php
|
||||
namespace um\admin\core;
|
||||
|
||||
// Exit if accessed directly.
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
if ( ! class_exists( 'Admin_Columns' ) ) {
|
||||
class Admin_Columns {
|
||||
|
||||
function __construct() {
|
||||
|
||||
$this->slug = 'ultimatemember';
|
||||
|
||||
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);
|
||||
|
||||
add_filter('manage_edit-um_directory_columns', array(&$this, 'manage_edit_um_directory_columns') );
|
||||
add_action('manage_um_directory_posts_custom_column', array(&$this, 'manage_um_directory_posts_custom_column'), 10, 3);
|
||||
|
||||
add_filter('post_row_actions', array(&$this, 'post_row_actions'), 99, 2);
|
||||
|
||||
}
|
||||
|
||||
/***
|
||||
*** @custom row actions
|
||||
***/
|
||||
function post_row_actions( $actions, $post ) {
|
||||
//check for your post type
|
||||
if ( $post->post_type == "um_form" ) {
|
||||
$actions['um_duplicate'] = '<a href="' . $this->duplicate_uri( $post->ID ) . '">' . __('Duplicate','ultimate-member') . '</a>';
|
||||
}
|
||||
return $actions;
|
||||
}
|
||||
|
||||
/***
|
||||
*** @duplicate a form
|
||||
***/
|
||||
function duplicate_uri( $id ) {
|
||||
$url = add_query_arg('um_adm_action', 'duplicate_form', admin_url('edit.php?post_type=um_form') );
|
||||
$url = add_query_arg('post_id', $id, $url);
|
||||
return $url;
|
||||
}
|
||||
|
||||
/***
|
||||
*** @Custom columns for Form
|
||||
***/
|
||||
function manage_edit_um_form_columns( $columns ) {
|
||||
|
||||
$new_columns['cb'] = '<input type="checkbox" />';
|
||||
$new_columns['title'] = __( 'Title', 'ulitmatemember' );
|
||||
$new_columns['id'] = __('ID', 'ulitmatemember' );
|
||||
$new_columns['mode'] = __( 'Type', 'ulitmatemember' );
|
||||
$new_columns['shortcode'] = __( 'Shortcode', 'ulitmatemember' );
|
||||
$new_columns['date'] = __( 'Date', 'ulitmatemember' );
|
||||
|
||||
return $new_columns;
|
||||
|
||||
}
|
||||
|
||||
/***
|
||||
*** @Custom columns for Directory
|
||||
***/
|
||||
function manage_edit_um_directory_columns( $columns ) {
|
||||
|
||||
$new_columns['cb'] = '<input type="checkbox" />';
|
||||
|
||||
$new_columns['title'] = __( 'Title', 'ultimate-member' );
|
||||
$new_columns['id'] = __( 'ID', 'ultimate-member' );
|
||||
$new_columns['shortcode'] = __( 'Shortcode', 'ultimate-member' );
|
||||
$new_columns['date'] = __( 'Date', 'ultimate-member' );
|
||||
|
||||
return $new_columns;
|
||||
|
||||
}
|
||||
|
||||
/***
|
||||
*** @Display cusom columns for Form
|
||||
***/
|
||||
function manage_um_form_posts_custom_column( $column_name, $id ) {
|
||||
|
||||
switch ( $column_name ) {
|
||||
|
||||
case 'id':
|
||||
echo '<span class="um-admin-number">'.$id.'</span>';
|
||||
break;
|
||||
|
||||
case 'shortcode':
|
||||
echo UM()->shortcodes()->get_shortcode( $id );
|
||||
break;
|
||||
|
||||
case 'mode':
|
||||
$mode = UM()->query()->get_attr( 'mode', $id );
|
||||
echo UM()->form()->display_form_type( $mode, $id );
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/***
|
||||
*** @Display cusom columns for Directory
|
||||
***/
|
||||
function manage_um_directory_posts_custom_column($column_name, $id) {
|
||||
global $wpdb;
|
||||
|
||||
switch ($column_name) {
|
||||
|
||||
case 'id':
|
||||
echo '<span class="um-admin-number">'.$id.'</span>';
|
||||
break;
|
||||
|
||||
case 'shortcode':
|
||||
echo UM()->shortcodes()->get_shortcode( $id );
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,216 @@
|
||||
<?php
|
||||
namespace um\admin\core;
|
||||
|
||||
// Exit if accessed directly.
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
if ( ! class_exists( 'Admin_DragDrop' ) ) {
|
||||
class Admin_DragDrop {
|
||||
|
||||
function __construct() {
|
||||
add_action( 'admin_footer', array( &$this, 'load_field_order' ), 9 );
|
||||
}
|
||||
|
||||
/***
|
||||
*** @update order of fields
|
||||
***/
|
||||
function update_order() {
|
||||
|
||||
if ( ! is_user_logged_in() || ! current_user_can( 'manage_options' ) )
|
||||
die( 'Please login as administrator' );
|
||||
|
||||
extract( $_POST );
|
||||
|
||||
$fields = UM()->query()->get_attr( 'custom_fields', $form_id );
|
||||
|
||||
$this->row_data = get_option( 'um_form_rowdata_' . $form_id, array() );
|
||||
$this->exist_rows = array();
|
||||
|
||||
if ( ! empty( $fields ) ) {
|
||||
foreach ( $fields as $key => $array ) {
|
||||
if ( $array['type'] == 'row' ) {
|
||||
$this->row_data[$key] = $array;
|
||||
unset( $fields[$key] );
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$fields = array();
|
||||
}
|
||||
|
||||
foreach ( $_POST as $key => $value ) {
|
||||
|
||||
// adding rows
|
||||
if ( 0 === strpos( $key, '_um_row_' ) ) {
|
||||
|
||||
$update_args = null;
|
||||
|
||||
$row_id = str_replace( '_um_row_', '', $key );
|
||||
|
||||
$row_array = array(
|
||||
'type' => 'row',
|
||||
'id' => $value,
|
||||
'sub_rows' => $_POST[ '_um_rowsub_'.$row_id .'_rows' ],
|
||||
'cols' => $_POST[ '_um_rowcols_'.$row_id .'_cols' ],
|
||||
'origin' => $_POST[ '_um_roworigin_'.$row_id . '_val' ],
|
||||
);
|
||||
|
||||
$row_args = $row_array;
|
||||
|
||||
if ( isset( $this->row_data[ $row_array['origin'] ] ) ) {
|
||||
foreach( $this->row_data[ $row_array['origin'] ] as $k => $v ){
|
||||
if ( $k != 'position' && $k != 'metakey' ) {
|
||||
$update_args[$k] = $v;
|
||||
}
|
||||
}
|
||||
if ( isset( $update_args ) ) {
|
||||
$row_args = array_merge( $update_args, $row_array );
|
||||
}
|
||||
$this->exist_rows[] = $key;
|
||||
}
|
||||
|
||||
$fields[$key] = $row_args;
|
||||
|
||||
}
|
||||
|
||||
// change field position
|
||||
if ( 0 === strpos( $key, 'um_position_' ) ) {
|
||||
$field_key = str_replace('um_position_','',$key);
|
||||
if ( isset( $fields[$field_key] ) ) {
|
||||
$fields[$field_key]['position'] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
// change field master row
|
||||
if ( 0 === strpos( $key, 'um_row_' ) ) {
|
||||
$field_key = str_replace('um_row_','',$key);
|
||||
if ( isset( $fields[$field_key] ) ) {
|
||||
$fields[$field_key]['in_row'] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
// change field sub row
|
||||
if ( 0 === strpos( $key, 'um_subrow_' ) ) {
|
||||
$field_key = str_replace('um_subrow_','',$key);
|
||||
if ( isset( $fields[$field_key] ) ) {
|
||||
$fields[$field_key]['in_sub_row'] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
// change field column
|
||||
if ( 0 === strpos( $key, 'um_col_' ) ) {
|
||||
$field_key = str_replace('um_col_','',$key);
|
||||
if ( isset( $fields[$field_key] ) ) {
|
||||
$fields[$field_key]['in_column'] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
// add field to group
|
||||
if ( 0 === strpos( $key, 'um_group_' ) ) {
|
||||
$field_key = str_replace('um_group_','',$key);
|
||||
if ( isset( $fields[$field_key] ) ) {
|
||||
$fields[$field_key]['in_group'] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
foreach ( $this->row_data as $k => $v ) {
|
||||
if ( ! in_array( $k, $this->exist_rows ) )
|
||||
unset( $this->row_data[$k] );
|
||||
}
|
||||
|
||||
update_option( 'um_existing_rows_' . $form_id, $this->exist_rows );
|
||||
|
||||
update_option( 'um_form_rowdata_' . $form_id , $this->row_data );
|
||||
|
||||
UM()->query()->update_attr( 'custom_fields', $form_id, $fields );
|
||||
|
||||
}
|
||||
|
||||
/***
|
||||
*** @load form to maintain form order
|
||||
***/
|
||||
function load_field_order() {
|
||||
|
||||
$screen = get_current_screen();
|
||||
|
||||
if ( ! isset( $screen->id ) || $screen->id != 'um_form' ) return;
|
||||
|
||||
?>
|
||||
|
||||
<div class="um-col-demon-settings" data-in_row="" data-in_sub_row="" data-in_column="" data-in_group=""></div>
|
||||
|
||||
<div class="um-col-demon-row" style="display:none;">
|
||||
|
||||
<div class="um-admin-drag-row-icons">
|
||||
<a href="#" class="um-admin-drag-rowsub-add um-admin-tipsy-n" title="<?php _e('Add Row','ultimate-member'); ?>" data-row_action="add_subrow"><i class="um-icon-plus"></i></a>
|
||||
<a href="#" class="um-admin-drag-row-edit um-admin-tipsy-n" title="<?php _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 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="#" class="um-admin-tipsy-n" title="<?php _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="um-admin-drag-rowsubs">
|
||||
<div class="um-admin-drag-rowsub">
|
||||
|
||||
<div class="um-admin-drag-ctrls columns">
|
||||
<a href="#" class="active" data-cols="1"></a>
|
||||
<a href="#" data-cols="2"></a>
|
||||
<a href="#" data-cols="3"></a>
|
||||
</div>
|
||||
|
||||
<div class="um-admin-drag-rowsub-icons">
|
||||
<span class="um-admin-drag-rowsub-start"><i class="um-icon-arrow-move"></i></span>
|
||||
<a href="#" class="um-admin-tipsy-n" title="<?php _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>
|
||||
|
||||
<div class="um-admin-drag-col">
|
||||
</div>
|
||||
|
||||
<div class="um-admin-drag-col-dynamic"></div>
|
||||
|
||||
<div class="um-admin-clear"></div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="um-col-demon-subrow" style="display:none;">
|
||||
|
||||
<div class="um-admin-drag-ctrls columns">
|
||||
<a href="#" class="active" data-cols="1"></a>
|
||||
<a href="#" data-cols="2"></a>
|
||||
<a href="#" data-cols="3"></a>
|
||||
</div>
|
||||
|
||||
<div class="um-admin-drag-rowsub-icons">
|
||||
<span class="um-admin-drag-rowsub-start"><i class="um-icon-arrow-move"></i></span>
|
||||
<a href="#" class="um-admin-tipsy-n" title="<?php _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>
|
||||
|
||||
<div class="um-admin-drag-col">
|
||||
</div>
|
||||
|
||||
<div class="um-admin-drag-col-dynamic"></div>
|
||||
|
||||
<div class="um-admin-clear"></div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<form action="" method="post" class="um_update_order">
|
||||
|
||||
<input type="hidden" name="form_id" id="form_id" value="<?php echo get_the_ID(); ?>" />
|
||||
|
||||
<div class="um_update_order_fields">
|
||||
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,390 @@
|
||||
<?php
|
||||
namespace um\admin\core;
|
||||
|
||||
// Exit if accessed directly.
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
if ( ! class_exists( 'Admin_Enqueue' ) ) {
|
||||
class Admin_Enqueue {
|
||||
var $js_url;
|
||||
var $css_url;
|
||||
|
||||
function __construct() {
|
||||
$this->slug = 'ultimatemember';
|
||||
|
||||
$this->js_url = um_url . 'includes/admin/assets/js/';
|
||||
$this->css_url = um_url . 'includes/admin/assets/css/';
|
||||
|
||||
add_action('admin_head', array(&$this, 'admin_head'), 9);
|
||||
|
||||
add_action('admin_enqueue_scripts', array(&$this, 'admin_enqueue_scripts') );
|
||||
|
||||
add_filter( 'admin_body_class', array( &$this, 'admin_body_class' ), 999 );
|
||||
|
||||
add_filter('enter_title_here', array(&$this, 'enter_title_here') );
|
||||
|
||||
add_action( 'load-user-new.php', array( &$this, 'enqueue_role_wrapper' ) );
|
||||
add_action( 'load-user-edit.php', array( &$this, 'enqueue_role_wrapper' ) );
|
||||
}
|
||||
|
||||
|
||||
function enqueue_role_wrapper() {
|
||||
add_action( 'admin_enqueue_scripts', array( &$this, 'load_role_wrapper' ) );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load js for Add/Edit User form
|
||||
*/
|
||||
function load_role_wrapper() {
|
||||
|
||||
wp_register_script( 'um_admin_role_wrapper', $this->js_url . 'um-admin-role-wrapper.js', '', '', true );
|
||||
wp_enqueue_script( 'um_admin_role_wrapper' );
|
||||
|
||||
$localize_data = get_option( 'um_roles' );
|
||||
|
||||
wp_localize_script( 'um_admin_settings', 'um_roles', $localize_data );
|
||||
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
*** @enter title placeholder
|
||||
***/
|
||||
function enter_title_here( $title ){
|
||||
$screen = get_current_screen();
|
||||
if ( 'um_directory' == $screen->post_type ){
|
||||
$title = 'e.g. Member Directory';
|
||||
}
|
||||
if ( 'um_role' == $screen->post_type ){
|
||||
$title = 'e.g. Community Member';
|
||||
}
|
||||
if ( 'um_form' == $screen->post_type ){
|
||||
$title = 'e.g. New Registration Form';
|
||||
}
|
||||
return $title;
|
||||
}
|
||||
|
||||
/***
|
||||
*** @Runs on admin head
|
||||
***/
|
||||
function admin_head(){
|
||||
|
||||
if ( $this->is_plugin_post_type() ){
|
||||
|
||||
?>
|
||||
|
||||
<style type="text/css">
|
||||
.um-admin.post-type-<?php echo get_post_type(); ?> div#slugdiv,
|
||||
.um-admin.post-type-<?php echo get_post_type(); ?> div#minor-publishing,
|
||||
.um-admin.post-type-<?php echo get_post_type(); ?> div#screen-meta-links
|
||||
{display:none}
|
||||
</style>
|
||||
|
||||
<?php
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
*** @check that we're on a custom post type supported by UM
|
||||
***/
|
||||
function is_plugin_post_type(){
|
||||
if (isset($_REQUEST['post_type'])){
|
||||
$post_type = $_REQUEST['post_type'];
|
||||
if ( in_array($post_type, array('um_form','um_role','um_directory'))){
|
||||
return true;
|
||||
}
|
||||
} else if ( isset($_REQUEST['action'] ) && $_REQUEST['action'] == 'edit') {
|
||||
$post_type = get_post_type();
|
||||
if ( in_array($post_type, array('um_form','um_role','um_directory'))){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
*** @Load Form
|
||||
***/
|
||||
function load_form() {
|
||||
|
||||
wp_register_style( 'um_admin_form', $this->css_url . 'um-admin-form.css' );
|
||||
wp_enqueue_style( 'um_admin_form' );
|
||||
|
||||
wp_register_script( 'um_admin_form', $this->js_url . 'um-admin-form.js', '', '', true );
|
||||
wp_enqueue_script( 'um_admin_form' );
|
||||
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
*** @Load Form
|
||||
***/
|
||||
function load_forms() {
|
||||
|
||||
wp_register_style( 'um_admin_forms', $this->css_url . 'um-admin-forms.css' );
|
||||
wp_enqueue_style( 'um_admin_forms' );
|
||||
|
||||
wp_register_script( 'um_admin_forms', $this->js_url . 'um-admin-forms.js', '', '', true );
|
||||
wp_enqueue_script( 'um_admin_forms' );
|
||||
|
||||
$localize_data = array(
|
||||
'texts' => array(
|
||||
'remove' => __( 'Remove', 'ultimate-member' ),
|
||||
'select' => __( 'Select', 'ultimate-member' )
|
||||
)
|
||||
);
|
||||
|
||||
wp_localize_script( 'um_admin_forms', 'php_data', $localize_data );
|
||||
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
*** @Load dashboard
|
||||
***/
|
||||
function load_dashboard() {
|
||||
|
||||
wp_register_style( 'um_admin_dashboard', $this->css_url . 'um-admin-dashboard.css' );
|
||||
wp_enqueue_style( 'um_admin_dashboard' );
|
||||
|
||||
wp_register_script( 'um_admin_dashboard', $this->js_url . 'um-admin-dashboard.js', '', '', true );
|
||||
wp_enqueue_script( 'um_admin_dashboard' );
|
||||
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
*** @Load settings
|
||||
***/
|
||||
function load_settings() {
|
||||
|
||||
wp_register_style( 'um_admin_settings', $this->css_url . 'um-admin-settings.css' );
|
||||
wp_enqueue_style( 'um_admin_settings' );
|
||||
|
||||
wp_register_script( 'um_admin_settings', $this->js_url . 'um-admin-settings.js', '', '', true );
|
||||
wp_enqueue_script( 'um_admin_settings' );
|
||||
|
||||
$localize_data = array(
|
||||
'texts' => array(
|
||||
'remove' => __( 'Remove', 'ultimate-member' ),
|
||||
'select' => __( 'Select', 'ultimate-member' )
|
||||
)
|
||||
);
|
||||
|
||||
wp_localize_script( 'um_admin_settings', 'php_data', $localize_data );
|
||||
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
*** @Load modal
|
||||
***/
|
||||
function load_modal() {
|
||||
|
||||
wp_register_style( 'um_admin_modal', $this->css_url . 'um-admin-modal.css' );
|
||||
wp_enqueue_style( 'um_admin_modal' );
|
||||
|
||||
wp_register_script( 'um_admin_modal', $this->js_url . 'um-admin-modal.js', '', '', true );
|
||||
wp_enqueue_script( 'um_admin_modal' );
|
||||
|
||||
$localize_data = array(
|
||||
'ajax_url' => UM()->get_ajax_route( 'um\admin\core\Admin_Builder', 'dynamic_modal_content' ),
|
||||
'dropdown_ajax_url' => UM()->get_ajax_route( 'um\admin\core\Admin_Builder', 'populate_dropdown_options' ),
|
||||
);
|
||||
wp_localize_script( 'um_admin_modal', 'um_admin_modal_data', $localize_data );
|
||||
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
*** @Field Processing
|
||||
***/
|
||||
function load_field() {
|
||||
|
||||
wp_register_script( 'um_admin_field', $this->js_url . 'um-admin-field.js', '', '', true );
|
||||
wp_enqueue_script( 'um_admin_field' );
|
||||
|
||||
$localize_data = array(
|
||||
'ajax_url' => UM()->get_ajax_route( 'um\admin\core\Admin_Builder', 'update_field' ),
|
||||
'do_ajax_url' => UM()->get_ajax_route( 'um\core\Fields', 'do_ajax_action' ),
|
||||
);
|
||||
wp_localize_script( 'um_admin_field', 'um_admin_field_data', $localize_data );
|
||||
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
*** @Load Builder
|
||||
***/
|
||||
function load_builder() {
|
||||
|
||||
wp_register_script( 'um_admin_builder', $this->js_url . 'um-admin-builder.js', '', '', true );
|
||||
wp_enqueue_script( 'um_admin_builder' );
|
||||
|
||||
$localize_data = array(
|
||||
'ajax_url' => UM()->get_ajax_route( 'um\admin\core\Admin_Builder', 'update_builder' ),
|
||||
);
|
||||
wp_localize_script( 'um_admin_builder', 'um_admin_builder_data', $localize_data );
|
||||
|
||||
wp_register_script( 'um_admin_dragdrop', $this->js_url . 'um-admin-dragdrop.js', '', '', true );
|
||||
wp_enqueue_script( 'um_admin_dragdrop' );
|
||||
|
||||
|
||||
$localize_data = array(
|
||||
'ajax_url' => UM()->get_ajax_route( 'um\admin\core\Admin_DragDrop', 'update_order' ),
|
||||
);
|
||||
wp_localize_script( 'um_admin_dragdrop', 'um_admin_dragdrop_data', $localize_data );
|
||||
|
||||
|
||||
wp_register_style( 'um_admin_builder', $this->css_url . 'um-admin-builder.css' );
|
||||
wp_enqueue_style( 'um_admin_builder' );
|
||||
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
*** @Load core WP styles/scripts
|
||||
***/
|
||||
function load_core_wp() {
|
||||
|
||||
wp_enqueue_style( 'wp-color-picker' );
|
||||
wp_enqueue_script( 'wp-color-picker' );
|
||||
|
||||
wp_enqueue_script( 'jquery-ui-draggable' );
|
||||
wp_enqueue_script( 'jquery-ui-sortable' );
|
||||
|
||||
wp_enqueue_script( 'jquery-ui-tooltip' );
|
||||
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
*** @Load Admin Styles
|
||||
***/
|
||||
function load_css() {
|
||||
|
||||
wp_register_style( 'um_admin_menu', $this->css_url . 'um-admin-menu.css' );
|
||||
wp_enqueue_style( 'um_admin_menu' );
|
||||
|
||||
wp_register_style( 'um_admin_columns', $this->css_url . 'um-admin-columns.css' );
|
||||
wp_enqueue_style( 'um_admin_columns' );
|
||||
|
||||
wp_register_style( 'um_admin_misc', $this->css_url . 'um-admin-misc.css' );
|
||||
wp_enqueue_style( 'um_admin_misc' );
|
||||
|
||||
if ( get_post_type() != 'shop_order' ) {
|
||||
wp_register_style( 'um_admin_select2', $this->css_url . 'um-admin-select2.css' );
|
||||
wp_enqueue_style( 'um_admin_select2' );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
*** @Load global css
|
||||
***/
|
||||
function load_global_css() {
|
||||
|
||||
wp_register_style( 'um_admin_global', $this->css_url . 'um-admin-global.css' );
|
||||
wp_enqueue_style( 'um_admin_global' );
|
||||
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
*** @Load jQuery custom code
|
||||
***/
|
||||
function load_custom_scripts() {
|
||||
|
||||
wp_register_script( 'um_admin_scripts', $this->js_url . 'um-admin-scripts.js', '', '', true );
|
||||
wp_enqueue_script( 'um_admin_scripts' );
|
||||
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
*** @Load AJAX
|
||||
***/
|
||||
function load_ajax_js() {
|
||||
|
||||
wp_register_script( 'um_admin_ajax', $this->js_url . 'um-admin-ajax.js', '', '', true );
|
||||
wp_enqueue_script( 'um_admin_ajax' );
|
||||
|
||||
$localize_data = array(
|
||||
'ajax_url' => UM()->get_ajax_route( 'um\core\Fields', 'do_ajax_action' ),
|
||||
);
|
||||
wp_localize_script( 'um_admin_ajax', 'um_admin_ajax_data', $localize_data );
|
||||
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
*** @Boolean check if we're viewing UM backend
|
||||
***/
|
||||
function is_UM_admin() {
|
||||
global $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' ) return true;
|
||||
|
||||
global $post;
|
||||
if ( isset( $post->post_type ) ) return true;
|
||||
|
||||
global $tax;
|
||||
if ( isset( $tax->name ) ) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/***
|
||||
*** @Adds class to our admin pages
|
||||
***/
|
||||
function admin_body_class($classes){
|
||||
if ( $this->is_UM_admin() ) {
|
||||
return "$classes um-admin";
|
||||
}
|
||||
return $classes;
|
||||
}
|
||||
|
||||
/***
|
||||
*** @Enqueue scripts and styles
|
||||
***/
|
||||
function admin_enqueue_scripts() {
|
||||
if ( $this->is_UM_admin() ) {
|
||||
|
||||
if ( get_post_type() != 'shop_order' ) {
|
||||
UM()->enqueue()->wp_enqueue_scripts();
|
||||
}
|
||||
|
||||
$this->load_global_css();
|
||||
$this->load_form();
|
||||
$this->load_forms();
|
||||
$this->load_modal();
|
||||
$this->load_dashboard();
|
||||
$this->load_settings();
|
||||
$this->load_field();
|
||||
$this->load_builder();
|
||||
$this->load_css();
|
||||
$this->load_core_wp();
|
||||
$this->load_ajax_js();
|
||||
$this->load_custom_scripts();
|
||||
|
||||
if ( is_rtl() ) {
|
||||
wp_register_style( 'um_admin_rtl', $this->css_url . 'um-admin-rtl.css' );
|
||||
wp_enqueue_style( 'um_admin_rtl' );
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
$this->load_global_css();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,890 @@
|
||||
<?php
|
||||
namespace um\admin\core;
|
||||
|
||||
// Exit if accessed directly.
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
if ( ! class_exists( 'Admin_Forms' ) ) {
|
||||
class Admin_Forms {
|
||||
|
||||
var $form_data;
|
||||
|
||||
/**
|
||||
* Admin_Forms constructor.
|
||||
* @param bool $form_data
|
||||
*/
|
||||
function __construct( $form_data = false ) {
|
||||
|
||||
if ( $form_data )
|
||||
$this->form_data = $form_data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Render form
|
||||
*
|
||||
*
|
||||
* @param bool $echo
|
||||
* @return string
|
||||
*/
|
||||
function render_form( $echo = true ) {
|
||||
|
||||
if ( empty( $this->form_data['fields'] ) )
|
||||
return '';
|
||||
|
||||
$class = 'form-table um-form-table ' . ( ! empty( $this->form_data['class'] ) ? $this->form_data['class'] : '' );
|
||||
$class_attr = ' class="' . $class . '" ';
|
||||
|
||||
ob_start();
|
||||
|
||||
foreach ( $this->form_data['fields'] as $field_data ) {
|
||||
if ( isset( $field_data['type'] ) && 'hidden' == $field_data['type'] )
|
||||
echo $this->render_form_row( $field_data );
|
||||
}
|
||||
|
||||
|
||||
if ( empty( $this->form_data['without_wrapper'] ) ) { ?>
|
||||
|
||||
<table <?php echo $class_attr ?>>
|
||||
<tbody>
|
||||
|
||||
<?php }
|
||||
|
||||
foreach ( $this->form_data['fields'] as $field_data ) {
|
||||
if ( isset( $field_data['type'] ) && 'hidden' != $field_data['type'] )
|
||||
echo $this->render_form_row( $field_data );
|
||||
}
|
||||
|
||||
if ( empty( $this->form_data['without_wrapper'] ) ) { ?>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<?php }
|
||||
|
||||
if ( $echo ) {
|
||||
ob_get_flush();
|
||||
return '';
|
||||
} else {
|
||||
return ob_get_clean();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function render_form_row( $data ) {
|
||||
|
||||
if ( empty( $data['type'] ) )
|
||||
return '';
|
||||
|
||||
$conditional = ! empty( $data['conditional'] ) ? 'data-conditional="' . esc_attr( json_encode( $data['conditional'] ) ) . '"' : '';
|
||||
$prefix_attr = ! empty( $this->form_data['prefix_id'] ) ? ' data-prefix="' . $this->form_data['prefix_id'] . '" ' : '';
|
||||
|
||||
$html = '';
|
||||
if ( $data['type'] != 'hidden' ) {
|
||||
|
||||
if ( ! empty( $this->form_data['div_line'] ) ) {
|
||||
|
||||
if ( strpos( $this->form_data['class'], 'um-top-label' ) !== false ) {
|
||||
|
||||
$html .= '<div class="form-field um-forms-line" ' . $conditional . $prefix_attr . '>' . $this->render_field_label( $data );
|
||||
|
||||
if ( method_exists( $this, 'render_' . $data['type'] ) ) {
|
||||
|
||||
$html .= call_user_func( array( &$this, 'render_' . $data['type'] ), $data );
|
||||
|
||||
} else {
|
||||
|
||||
$html .= apply_filters( 'um_render_field_type_' . $data['type'], '', $data, $this->form_data );
|
||||
|
||||
}
|
||||
|
||||
if ( ! empty( $data['description'] ) )
|
||||
$html .= '<p class="description">' . $data['description'] . '</p>';
|
||||
|
||||
$html .= '</div>';
|
||||
|
||||
} else {
|
||||
|
||||
if ( ! empty( $data['without_label'] ) ) {
|
||||
|
||||
$html .= '<div class="form-field um-forms-line" ' . $conditional . $prefix_attr . '>';
|
||||
|
||||
if ( method_exists( $this, 'render_' . $data['type'] ) ) {
|
||||
|
||||
$html .= call_user_func( array( &$this, 'render_' . $data['type'] ), $data );
|
||||
|
||||
} else {
|
||||
|
||||
$html .= apply_filters( 'um_render_field_type_' . $data['type'], '', $data, $this->form_data );
|
||||
|
||||
}
|
||||
|
||||
if ( ! empty( $data['description'] ) )
|
||||
$html .= '<p class="description">' . $data['description'] . '</p>';
|
||||
|
||||
$html .= '</div>';
|
||||
|
||||
} else {
|
||||
|
||||
$html .= '<div class="form-field um-forms-line" ' . $conditional . $prefix_attr . '>' . $this->render_field_label( $data );
|
||||
|
||||
if ( method_exists( $this, 'render_' . $data['type'] ) ) {
|
||||
|
||||
$html .= call_user_func( array( &$this, 'render_' . $data['type'] ), $data );
|
||||
|
||||
} else {
|
||||
|
||||
$html .= apply_filters( 'um_render_field_type_' . $data['type'], '', $data, $this->form_data );
|
||||
|
||||
}
|
||||
|
||||
if ( ! empty( $data['description'] ) )
|
||||
$html .= '<p class="description">' . $data['description'] . '</p>';
|
||||
|
||||
$html .= '</div>';
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
if ( strpos( $this->form_data['class'], 'um-top-label' ) !== false ) {
|
||||
|
||||
$html .= '<tr class="um-forms-line" ' . $conditional . $prefix_attr . '>
|
||||
<td>' . $this->render_field_label( $data );
|
||||
|
||||
if ( method_exists( $this, 'render_' . $data['type'] ) ) {
|
||||
|
||||
$html .= call_user_func( array( &$this, 'render_' . $data['type'] ), $data );
|
||||
|
||||
} else {
|
||||
|
||||
$html .= apply_filters( 'um_render_field_type_' . $data['type'], '', $data, $this->form_data );
|
||||
|
||||
}
|
||||
|
||||
if ( ! empty( $data['description'] ) )
|
||||
$html .= '<div class="um-admin-clear"></div><p class="description">' . $data['description'] . '</p>';
|
||||
|
||||
$html .= '</td></tr>';
|
||||
|
||||
} else {
|
||||
|
||||
if ( ! empty( $data['without_label'] ) ) {
|
||||
|
||||
$html .= '<tr class="um-forms-line" ' . $conditional . $prefix_attr . '>
|
||||
<td colspan="2">';
|
||||
|
||||
if ( method_exists( $this, 'render_' . $data['type'] ) ) {
|
||||
|
||||
$html .= call_user_func( array( &$this, 'render_' . $data['type'] ), $data );
|
||||
|
||||
} else {
|
||||
|
||||
$html .= apply_filters( 'um_render_field_type_' . $data['type'], '', $data, $this->form_data );
|
||||
|
||||
}
|
||||
|
||||
if ( ! empty( $data['description'] ) )
|
||||
$html .= '<div class="um-admin-clear"></div><p class="description">' . $data['description'] . '</p>';
|
||||
|
||||
$html .= '</td></tr>';
|
||||
|
||||
} else {
|
||||
|
||||
$html .= '<tr class="um-forms-line" ' . $conditional . $prefix_attr . '>
|
||||
<th>' . $this->render_field_label( $data ) . '</th>
|
||||
<td>';
|
||||
|
||||
if ( method_exists( $this, 'render_' . $data['type'] ) ) {
|
||||
|
||||
$html .= call_user_func( array( &$this, 'render_' . $data['type'] ), $data );
|
||||
|
||||
} else {
|
||||
|
||||
$html .= apply_filters( 'um_render_field_type_' . $data['type'], '', $data, $this->form_data );
|
||||
|
||||
}
|
||||
|
||||
if ( ! empty( $data['description'] ) )
|
||||
$html .= '<div class="um-admin-clear"></div><p class="description">' . $data['description'] . '</p>';
|
||||
|
||||
$html .= '</td></tr>';
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
if ( method_exists( $this, 'render_' . $data['type'] ) ) {
|
||||
|
||||
$html .= call_user_func( array( &$this, 'render_' . $data['type'] ), $data );
|
||||
|
||||
} else {
|
||||
|
||||
$html .= apply_filters( 'um_render_field_type_' . $data['type'], '', $data, $this->form_data );
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
|
||||
function render_field_label( $data ) {
|
||||
if ( empty( $data['label'] ) )
|
||||
return false;
|
||||
|
||||
$id = ! empty( $data['id1'] ) ? $data['id1'] : $data['id'];
|
||||
$id = ( ! empty( $this->form_data['prefix_id'] ) ? $this->form_data['prefix_id'] : '' ) . '_' . $id;
|
||||
$for_attr = ' for="' . $id . '" ';
|
||||
|
||||
$label = $data['label'];
|
||||
$tooltip = ! empty( $data['tooltip'] ) ? UM()->tooltip( $data['tooltip'], false, false ) : '';
|
||||
|
||||
return "<label $for_attr>$label $tooltip</label>";
|
||||
}
|
||||
|
||||
|
||||
function render_hidden( $field_data ) {
|
||||
|
||||
if ( empty( $field_data['id'] ) )
|
||||
return false;
|
||||
|
||||
$id = ( ! empty( $this->form_data['prefix_id'] ) ? $this->form_data['prefix_id'] : '' ) . '_' . $field_data['id'];
|
||||
$id_attr = ' id="' . $id . '" ';
|
||||
|
||||
$class = ! empty( $field_data['class'] ) ? $field_data['class'] : '';
|
||||
$class_attr = ' class="um-forms-field ' . $class . '" ';
|
||||
|
||||
$data = array(
|
||||
'field_id' => $field_data['id']
|
||||
);
|
||||
|
||||
$data_attr = '';
|
||||
foreach ( $data as $key => $value ) {
|
||||
$data_attr .= " data-{$key}=\"{$value}\" ";
|
||||
}
|
||||
|
||||
$name = $field_data['id'];
|
||||
$name = ! empty( $this->form_data['prefix_id'] ) ? $this->form_data['prefix_id'] . '[' . $name . ']' : $name;
|
||||
$name_attr = ' name="' . $name . '" ';
|
||||
|
||||
$default = isset( $field_data['default'] ) ? $field_data['default'] : '';
|
||||
$value = isset( $field_data['value'] ) ? $field_data['value'] : $default;
|
||||
$value_attr = ' value="' . $value . '" ';
|
||||
|
||||
$html = "<input type=\"hidden\" $id_attr $class_attr $name_attr $data_attr $value_attr />";
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
|
||||
function render_text( $field_data ) {
|
||||
|
||||
if ( empty( $field_data['id'] ) )
|
||||
return false;
|
||||
|
||||
$id = ( ! empty( $this->form_data['prefix_id'] ) ? $this->form_data['prefix_id'] : '' ) . '_' . $field_data['id'];
|
||||
$id_attr = ' id="' . $id . '" ';
|
||||
|
||||
$class = ! empty( $field_data['class'] ) ? $field_data['class'] : '';
|
||||
$class .= ! empty( $field_data['size'] ) ? 'um-' . $field_data['size'] . '-field' : 'um-long-field';
|
||||
$class_attr = ' class="um-forms-field ' . $class . '" ';
|
||||
|
||||
$data = array(
|
||||
'field_id' => $field_data['id']
|
||||
);
|
||||
|
||||
$data_attr = '';
|
||||
foreach ( $data as $key => $value ) {
|
||||
$data_attr .= " data-{$key}=\"{$value}\" ";
|
||||
}
|
||||
|
||||
$placeholder_attr = ! empty( $field_data['placeholder'] ) ? ' placeholder="' . $field_data['placeholder'] . '"' : '';
|
||||
|
||||
$name = $field_data['id'];
|
||||
$name = ! empty( $this->form_data['prefix_id'] ) ? $this->form_data['prefix_id'] . '[' . $name . ']' : $name;
|
||||
$name_attr = ' name="' . $name . '" ';
|
||||
|
||||
$default = isset( $field_data['default'] ) ? $field_data['default'] : '';
|
||||
$value = isset( $field_data['value'] ) ? $field_data['value'] : $default;
|
||||
$value_attr = ' value="' . $value . '" ';
|
||||
|
||||
$html = "<input type=\"text\" $id_attr $class_attr $name_attr $data_attr $value_attr $placeholder_attr />";
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
|
||||
function render_color( $field_data ) {
|
||||
|
||||
if ( empty( $field_data['id'] ) )
|
||||
return false;
|
||||
|
||||
$id = ( ! empty( $this->form_data['prefix_id'] ) ? $this->form_data['prefix_id'] : '' ) . '_' . $field_data['id'];
|
||||
$id_attr = ' id="' . $id . '" ';
|
||||
|
||||
$class = ! empty( $field_data['class'] ) ? $field_data['class'] : '';
|
||||
$class .= ! empty( $field_data['size'] ) ? ' um-' . $field_data['size'] . '-field ' : ' um-long-field ';
|
||||
$class .= ' um-admin-colorpicker ';
|
||||
$class_attr = ' class="um-forms-field ' . $class . '" ';
|
||||
|
||||
$data = array(
|
||||
'field_id' => $field_data['id']
|
||||
);
|
||||
|
||||
$data_attr = '';
|
||||
foreach ( $data as $key => $value ) {
|
||||
$data_attr .= " data-{$key}=\"{$value}\" ";
|
||||
}
|
||||
|
||||
$placeholder_attr = ! empty( $field_data['placeholder'] ) ? ' placeholder="' . $field_data['placeholder'] . '"' : '';
|
||||
|
||||
$name = $field_data['id'];
|
||||
$name = ! empty( $this->form_data['prefix_id'] ) ? $this->form_data['prefix_id'] . '[' . $name . ']' : $name;
|
||||
$name_attr = ' name="' . $name . '" ';
|
||||
|
||||
$default = isset( $field_data['default'] ) ? $field_data['default'] : '';
|
||||
$value = isset( $field_data['value'] ) ? $field_data['value'] : $default;
|
||||
$value_attr = ' value="' . $value . '" ';
|
||||
|
||||
$html = "<input type=\"text\" $id_attr $class_attr $name_attr $data_attr $value_attr $placeholder_attr />";
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
|
||||
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'];
|
||||
$id_attr = ' id="' . $id . '" ';
|
||||
|
||||
$name = $field_data['id'];
|
||||
$name = ! empty( $this->form_data['prefix_id'] ) ? $this->form_data['prefix_id'] . '[' . $name . ']' : $name;
|
||||
$name_attr = ' name="' . $name . '" ';
|
||||
|
||||
$default = isset( $field_data['default'] ) ? $field_data['default'] : '';
|
||||
$value = isset( $field_data['value'] ) ? $field_data['value'] : $default;
|
||||
$value_attr = ' value="' . $value . '" ';
|
||||
|
||||
$html = '<a href="#" 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>
|
||||
<span class="um-admin-icon-value">';
|
||||
|
||||
if ( ! empty( $value ) ) {
|
||||
$html .= '<i class="' . $value . '"></i>';
|
||||
} else {
|
||||
$html .= __( 'No Icon', 'ultimate-member' );
|
||||
}
|
||||
|
||||
$html .= '</span><input type="hidden" ' . $name_attr . ' ' . $id_attr . ' ' . $value_attr . ' />';
|
||||
|
||||
if ( get_post_meta( get_the_ID(), '_um_icon', true ) ) {
|
||||
$html .= '<span class="um-admin-icon-clear show"><i class="um-icon-android-cancel"></i></span>';
|
||||
} else {
|
||||
$html .= '<span class="um-admin-icon-clear"><i class="um-icon-android-cancel"></i></span>';
|
||||
}
|
||||
|
||||
$html .= '</span>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
|
||||
function render_datepicker( $field_data ) {
|
||||
|
||||
if ( empty( $field_data['id'] ) )
|
||||
return false;
|
||||
|
||||
$id = ( ! empty( $this->form_data['prefix_id'] ) ? $this->form_data['prefix_id'] : '' ) . '_' . $field_data['id'];
|
||||
$id_attr = ' id="' . $id . '" ';
|
||||
|
||||
$class = ! empty( $field_data['class'] ) ? $field_data['class'] : '';
|
||||
$class .= ! empty( $field_data['size'] ) ? 'um-' . $field_data['size'] . '-field' : 'um-long-field';
|
||||
$class_attr = ' class="um-forms-field ' . $class . '" ';
|
||||
|
||||
$data = array(
|
||||
'field_id' => $field_data['id']
|
||||
);
|
||||
|
||||
$data_attr = '';
|
||||
foreach ( $data as $key => $value ) {
|
||||
$data_attr .= " data-{$key}=\"{$value}\" ";
|
||||
}
|
||||
|
||||
$placeholder_attr = ! empty( $field_data['placeholder'] ) ? ' placeholder="' . $field_data['placeholder'] . '"' : '';
|
||||
|
||||
$name = $field_data['id'];
|
||||
$name = ! empty( $this->form_data['prefix_id'] ) ? $this->form_data['prefix_id'] . '[' . $name . ']' : $name;
|
||||
$name_attr = ' name="' . $name . '" ';
|
||||
|
||||
$default = isset( $field_data['default'] ) ? $field_data['default'] : '';
|
||||
$value = isset( $field_data['value'] ) ? $field_data['value'] : $default;
|
||||
$value_attr = ' value="' . $value . '" ';
|
||||
|
||||
$html = "<input type=\"date\" $id_attr $class_attr $name_attr $data_attr $value_attr $placeholder_attr />";
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
|
||||
function render_inline_texts( $field_data ) {
|
||||
|
||||
if ( empty( $field_data['id1'] ) )
|
||||
return false;
|
||||
|
||||
|
||||
$i = 1;
|
||||
$fields = array();
|
||||
while( ! empty( $field_data['id' . $i] ) ) {
|
||||
$id = ( ! empty( $this->form_data['prefix_id'] ) ? $this->form_data['prefix_id'] : '' ) . '_' . $field_data['id'. $i];
|
||||
$id_attr = ' id="' . $id . '" ';
|
||||
|
||||
$class = ! empty( $field_data['class'] ) ? $field_data['class'] : '';
|
||||
$class .= ! empty( $field_data['size'] ) ? 'um-' . $field_data['size'] . '-field' : 'um-long-field';
|
||||
$class_attr = ' class="um-forms-field ' . $class . '" ';
|
||||
|
||||
$data = array(
|
||||
'field_id' => $field_data['id'. $i]
|
||||
);
|
||||
|
||||
$data_attr = '';
|
||||
foreach ( $data as $key => $value ) {
|
||||
$data_attr .= " data-{$key}=\"{$value}\" ";
|
||||
}
|
||||
|
||||
$placeholder_attr = ! empty( $field_data['placeholder'] ) ? ' placeholder="' . $field_data['placeholder'] . '"' : '';
|
||||
|
||||
$name = $field_data['id'. $i];
|
||||
$name = ! empty( $this->form_data['prefix_id'] ) ? $this->form_data['prefix_id'] . '[' . $name . ']' : $name;
|
||||
$name_attr = ' name="' . $name . '" ';
|
||||
|
||||
$default = isset( $field_data['default'. $i] ) ? $field_data['default'. $i] : '';
|
||||
$value = isset( $field_data['value'. $i] ) ? $field_data['value'. $i] : $default;
|
||||
$value_attr = ' value="' . $value . '" ';
|
||||
|
||||
$fields[$i] = "<input type=\"text\" $id_attr $class_attr $name_attr $data_attr $value_attr $placeholder_attr style=\"display:inline;\"/>";
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
$html = vsprintf( $field_data['mask'], $fields );
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
|
||||
function render_textarea( $field_data ) {
|
||||
|
||||
if ( empty( $field_data['id'] ) )
|
||||
return false;
|
||||
|
||||
$id = ( ! empty( $this->form_data['prefix_id'] ) ? $this->form_data['prefix_id'] : '' ) . '_' . $field_data['id'];
|
||||
$id_attr = ' id="' . $id . '" ';
|
||||
|
||||
$class = ! empty( $field_data['class'] ) ? $field_data['class'] : '';
|
||||
$class .= ! empty( $field_data['size'] ) ? $field_data['size'] : 'um-long-field';
|
||||
$class_attr = ' class="um-forms-field ' . $class . '" ';
|
||||
|
||||
$data = array(
|
||||
'field_id' => $field_data['id']
|
||||
);
|
||||
|
||||
$data_attr = '';
|
||||
foreach ( $data as $key => $value ) {
|
||||
$data_attr .= " data-{$key}=\"{$value}\" ";
|
||||
}
|
||||
|
||||
$rows = ! empty( $field_data['args']['textarea_rows'] ) ? ' rows="' . $field_data['args']['textarea_rows'] . '" ' : '';
|
||||
|
||||
$name = $field_data['id'];
|
||||
$name = ! empty( $this->form_data['prefix_id'] ) ? $this->form_data['prefix_id'] . '[' . $name . ']' : $name;
|
||||
$name_attr = ' name="' . $name . '" ';
|
||||
|
||||
$default = isset( $field_data['default'] ) ? $field_data['default'] : '';
|
||||
$value = isset( $field_data['value'] ) ? $field_data['value'] : $default;
|
||||
$html = "<textarea $id_attr $class_attr $name_attr $data_attr $rows>$value</textarea>";
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
|
||||
function render_wp_editor( $field_data ) {
|
||||
|
||||
if ( empty( $field_data['id'] ) )
|
||||
return false;
|
||||
|
||||
$id = ( ! empty( $this->form_data['prefix_id'] ) ? $this->form_data['prefix_id'] : '' ) . '_' . $field_data['id'];
|
||||
|
||||
$class = ! empty( $field_data['class'] ) ? $field_data['class'] : '';
|
||||
$class .= ! empty( $field_data['size'] ) ? $field_data['size'] : 'um-long-field';
|
||||
|
||||
$data = array(
|
||||
'field_id' => $field_data['id']
|
||||
);
|
||||
|
||||
$data_attr = '';
|
||||
foreach ( $data as $key => $value ) {
|
||||
$data_attr .= " data-{$key}=\"{$value}\" ";
|
||||
}
|
||||
|
||||
$name = $field_data['id'];
|
||||
$name = ! empty( $this->form_data['prefix_id'] ) ? $this->form_data['prefix_id'] . '[' . $name . ']' : $name;
|
||||
|
||||
$default = isset( $field_data['default'] ) ? $field_data['default'] : '';
|
||||
$value = isset( $field_data['value'] ) ? $field_data['value'] : $default;
|
||||
|
||||
ob_start();
|
||||
wp_editor( $value,
|
||||
$id,
|
||||
array(
|
||||
'textarea_name' => $name,
|
||||
'textarea_rows' => 20,
|
||||
'editor_height' => 425,
|
||||
'wpautop' => false,
|
||||
'media_buttons' => false,
|
||||
'editor_class' => $class
|
||||
)
|
||||
);
|
||||
|
||||
$html = ob_get_clean();
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
|
||||
function render_checkbox( $field_data ) {
|
||||
|
||||
if ( empty( $field_data['id'] ) )
|
||||
return false;
|
||||
|
||||
$id = ( ! empty( $this->form_data['prefix_id'] ) ? $this->form_data['prefix_id'] : '' ) . '_' . $field_data['id'];
|
||||
$id_attr = ' id="' . $id . '" ';
|
||||
$id_attr_hidden = ' id="' . $id . '_hidden" ';
|
||||
|
||||
$class = ! empty( $field_data['class'] ) ? $field_data['class'] : '';
|
||||
$class .= ! empty( $field_data['size'] ) ? $field_data['size'] : 'um-long-field';
|
||||
$class_attr = ' class="um-forms-field ' . $class . '" ';
|
||||
|
||||
$data = array(
|
||||
'field_id' => $field_data['id']
|
||||
);
|
||||
|
||||
$data_attr = '';
|
||||
foreach ( $data as $key => $value ) {
|
||||
$data_attr .= " data-{$key}=\"{$value}\" ";
|
||||
}
|
||||
|
||||
$name = $field_data['id'];
|
||||
$name = ! empty( $this->form_data['prefix_id'] ) ? $this->form_data['prefix_id'] . '[' . $name . ']' : $name;
|
||||
$name_attr = ' name="' . $name . '" ';
|
||||
|
||||
$default = isset( $field_data['default'] ) ? $field_data['default'] : '';
|
||||
$value = ( '' !== $field_data['value'] ) ? $field_data['value'] : $default;
|
||||
/*$value = isset( $field_data['value'] ) ? $field_data['value'] : $default;
|
||||
$value = ! empty( $field_data['value'] ) ? $field_data['value'] : 0;
|
||||
*/
|
||||
|
||||
$html = "<input type=\"hidden\" $id_attr_hidden $name_attr value=\"0\" />
|
||||
<input type=\"checkbox\" $id_attr $class_attr $name_attr $data_attr " . checked( $value, true, false ) . " value=\"1\" />";
|
||||
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
|
||||
function render_select( $field_data ) {
|
||||
|
||||
if ( empty( $field_data['id'] ) )
|
||||
return false;
|
||||
|
||||
$multiple = ! empty( $field_data['multi'] ) ? 'multiple' : '';
|
||||
|
||||
$id = ( ! empty( $this->form_data['prefix_id'] ) ? $this->form_data['prefix_id'] : '' ) . '_' . $field_data['id'];
|
||||
$id_attr = ' id="' . $id . '" ';
|
||||
|
||||
$class = ! empty( $field_data['class'] ) ? $field_data['class'] : '';
|
||||
$class .= ! empty( $field_data['size'] ) ? 'um-' . $field_data['size'] . '-field' : 'um-long-field';
|
||||
$class_attr = ' class="um-forms-field ' . $class . '" ';
|
||||
|
||||
$data = array(
|
||||
'field_id' => $field_data['id']
|
||||
);
|
||||
|
||||
$data_attr = '';
|
||||
foreach ( $data as $key => $value ) {
|
||||
$data_attr .= " data-{$key}=\"{$value}\" ";
|
||||
}
|
||||
|
||||
$name = $field_data['id'];
|
||||
$name = ! empty( $this->form_data['prefix_id'] ) ? $this->form_data['prefix_id'] . '[' . $name . ']' : $name;
|
||||
$name = $name . ( ! empty( $field_data['multi'] ) ? '[]' : '' );
|
||||
$name_attr = ' name="' . $name . '" ';
|
||||
|
||||
$default = isset( $field_data['default'] ) ? $field_data['default'] : '';
|
||||
$value = isset( $field_data['value'] ) ? $field_data['value'] : $default;
|
||||
|
||||
$options = '';
|
||||
foreach ( $field_data['options'] as $key=>$option ) {
|
||||
if ( ! empty( $field_data['multi'] ) ) {
|
||||
|
||||
if ( ! is_array( $value ) && empty( $value ) )
|
||||
$value = array();
|
||||
|
||||
$options .= '<option value="' . $key . '" ' . selected( in_array( $key, $value ), true, false ) . '>' . $option . '</option>';
|
||||
} else {
|
||||
$options .= '<option value="' . $key . '" ' . selected( (string)$key == $value, true, false ) . '>' . $option . '</option>';
|
||||
}
|
||||
}
|
||||
|
||||
$html = "<select $multiple $id_attr $name_attr $class_attr $data_attr>$options</select>";
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
|
||||
function render_multi_selects( $field_data ) {
|
||||
|
||||
if ( empty( $field_data['id'] ) )
|
||||
return false;
|
||||
|
||||
$id = ( ! empty( $this->form_data['prefix_id'] ) ? $this->form_data['prefix_id'] : '' ) . '_' . $field_data['id'];
|
||||
|
||||
$class = ! empty( $field_data['class'] ) ? $field_data['class'] : '';
|
||||
$class .= ! empty( $field_data['size'] ) ? $field_data['size'] : 'um-long-field';
|
||||
$class_attr = ' class="um-forms-field ' . $class . '" ';
|
||||
|
||||
$data = array(
|
||||
'field_id' => $field_data['id'],
|
||||
'id_attr' => $id
|
||||
);
|
||||
|
||||
$data_attr = '';
|
||||
foreach ( $data as $key => $value ) {
|
||||
$data_attr .= " data-{$key}=\"{$value}\" ";
|
||||
}
|
||||
|
||||
$name = $field_data['id'];
|
||||
$name = ! empty( $this->form_data['prefix_id'] ) ? $this->form_data['prefix_id'] . '[' . $name . ']' : $name;
|
||||
$name = "{$name}[]";
|
||||
$name_attr = ' name="' . $name . '" ';
|
||||
|
||||
$default = isset( $field_data['default'] ) ? $field_data['default'] : '';
|
||||
$values = isset( $field_data['value'] ) ? $field_data['value'] : $default;
|
||||
|
||||
$options = '';
|
||||
foreach ( $field_data['options'] as $key=>$option ) {
|
||||
$options .= '<option value="' . $key . '">' . $option . '</option>';
|
||||
}
|
||||
|
||||
$html = "<select class=\"um-hidden-multi-selects\" $data_attr>$options</select>";
|
||||
$html .= "<ul class=\"um-multi-selects-list\" $data_attr>";
|
||||
|
||||
if ( ! empty( $values ) ) {
|
||||
foreach ( $values as $k=>$value ) {
|
||||
|
||||
$id_attr = ' id="' . $id . '-' . $k . '" ';
|
||||
|
||||
$options = '';
|
||||
foreach ( $field_data['options'] as $key=>$option ) {
|
||||
$options .= '<option value="' . $key . '" ' . selected( $key == $value, true, false ) . '>' . $option . '</option>';
|
||||
}
|
||||
|
||||
$html .= "<li class=\"um-multi-selects-option-line\"><span class=\"um-field-wrapper\">
|
||||
<select $id_attr $name_attr $class_attr $data_attr>$options</select></span>
|
||||
<span class=\"um-field-control\"><a href=\"javascript:void(0);\" class=\"um-select-delete\">" . __( 'Remove', 'ultimate-member' ) . "</a></span></li>";
|
||||
}
|
||||
} elseif ( ! empty( $field_data['show_default_number'] ) && is_numeric( $field_data['show_default_number'] ) && $field_data['show_default_number'] > 0 ) {
|
||||
$i = 0;
|
||||
while( $i < $field_data['show_default_number'] ) {
|
||||
$id_attr = ' id="' . $id . '-' . $i . '" ';
|
||||
|
||||
$options = '';
|
||||
foreach ( $field_data['options'] as $key=>$option ) {
|
||||
$options .= '<option value="' . $key . '">' . $option . '</option>';
|
||||
}
|
||||
|
||||
$html .= "<li class=\"um-multi-selects-option-line\"><span class=\"um-field-wrapper\">
|
||||
<select $id_attr $name_attr $class_attr $data_attr>$options</select></span>
|
||||
<span class=\"um-field-control\"><a href=\"javascript:void(0);\" class=\"um-select-delete\">" . __( 'Remove', 'ultimate-member' ) . "</a></span></li>";
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
$html .= "</ul><a href=\"javascript:void(0);\" class=\"button button-primary um-multi-selects-add-option\" data-name=\"$name\">{$field_data['add_text']}</a>";
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
|
||||
function render_multi_checkbox( $field_data ) {
|
||||
|
||||
if ( empty( $field_data['id'] ) )
|
||||
return false;
|
||||
|
||||
$id = ( ! empty( $this->form_data['prefix_id'] ) ? $this->form_data['prefix_id'] : '' ) . '_' . $field_data['id'];
|
||||
|
||||
$class = ! empty( $field_data['class'] ) ? $field_data['class'] : '';
|
||||
$class .= ! empty( $field_data['size'] ) ? $field_data['size'] : 'um-long-field';
|
||||
$class_attr = ' class="um-forms-field ' . $class . '" ';
|
||||
|
||||
$name = $field_data['id'];
|
||||
$name = ! empty( $this->form_data['prefix_id'] ) ? $this->form_data['prefix_id'] . '[' . $name . ']' : $name;
|
||||
|
||||
$default = isset( $field_data['default'] ) ? $field_data['default'] : '';
|
||||
$values = ( '' !== $field_data['value'] ) ? $field_data['value'] : $default;
|
||||
|
||||
$i = 0;
|
||||
$html = '';
|
||||
|
||||
$columns = ( ! empty( $field_data['columns'] ) && is_numeric( $field_data['columns'] ) ) ? $field_data['columns'] : 1;
|
||||
while ( $i < $columns ) {
|
||||
$per_page = ceil( count( $field_data['options'] ) / $columns );
|
||||
$section_fields_per_page = array_slice( $field_data['options'], $i*$per_page, $per_page );
|
||||
$html .= '<span class="um-form-fields-section" style="width:' . floor( 100 / $columns ) . '% !important;">';
|
||||
|
||||
foreach ( $section_fields_per_page as $k => $title ) {
|
||||
$id_attr = ' id="' . $id . '_' . $k . '" ';
|
||||
$for_attr = ' for="' . $id . '_' . $k . '" ';
|
||||
$name_attr = ' name="' . $name . '[' . $k . ']" ';
|
||||
|
||||
$html .= "<label $for_attr>
|
||||
<input type=\"checkbox\" " . checked( in_array( $k, $values ), true, false ) . "$id_attr $name_attr value=\"1\" $class_attr>
|
||||
<span>$title</span>
|
||||
</label>";
|
||||
}
|
||||
|
||||
$html .= '</span>';
|
||||
$i++;
|
||||
}
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
|
||||
function render_multi_text( $field_data ) {
|
||||
|
||||
if ( empty( $field_data['id'] ) )
|
||||
return false;
|
||||
|
||||
$id = ( ! empty( $this->form_data['prefix_id'] ) ? $this->form_data['prefix_id'] : '' ) . '_' . $field_data['id'];
|
||||
|
||||
$size = ! empty( $field_data['size'] ) ? 'um-' . $field_data['size'] . '-field' : 'um-long-field';
|
||||
|
||||
$class = ! empty( $field_data['class'] ) ? $field_data['class'] : '';
|
||||
$class_attr = ' class="um-forms-field ' . $class . '" ';
|
||||
|
||||
$data = array(
|
||||
'field_id' => $field_data['id'],
|
||||
'id_attr' => $id
|
||||
);
|
||||
|
||||
$data_attr = '';
|
||||
foreach ( $data as $key => $value ) {
|
||||
$data_attr .= " data-{$key}=\"{$value}\" ";
|
||||
}
|
||||
|
||||
$name = $field_data['id'];
|
||||
$name = ! empty( $this->form_data['prefix_id'] ) ? $this->form_data['prefix_id'] . '[' . $name . ']' : $name;
|
||||
$name = "{$name}[]";
|
||||
$name_attr = ' name="' . $name . '" ';
|
||||
|
||||
//$values = ! empty( $field_data['value'] ) ? $field_data['value'] : ( ! empty( $field_data['default'] ) ? $field_data['default'] : '' );
|
||||
|
||||
$default = isset( $field_data['default'] ) ? $field_data['default'] : '';
|
||||
$values = isset( $field_data['value'] ) ? $field_data['value'] : $default;
|
||||
|
||||
$html = "<input type=\"text\" class=\"um-hidden-multi-text\" $data_attr />";
|
||||
$html .= "<ul class=\"um-multi-text-list\" $data_attr>";
|
||||
|
||||
if ( ! empty( $values ) ) {
|
||||
foreach ( $values as $k=>$value ) {
|
||||
|
||||
$id_attr = ' id="' . $id . '-' . $k . '" ';
|
||||
|
||||
$html .= "<li class=\"um-multi-text-option-line {$size}\"><span class=\"um-field-wrapper\">
|
||||
<input type=\"text\" $id_attr $name_attr $class_attr $data_attr value=\"$value\" /></span>
|
||||
<span class=\"um-field-control\"><a href=\"javascript:void(0);\" class=\"um-text-delete\">" . __( 'Remove', 'ultimate-member' ) . "</a></span></li>";
|
||||
}
|
||||
} elseif ( ! empty( $field_data['show_default_number'] ) && is_numeric( $field_data['show_default_number'] ) && $field_data['show_default_number'] > 0 ) {
|
||||
$i = 0;
|
||||
while( $i < $field_data['show_default_number'] ) {
|
||||
$id_attr = ' id="' . $id . '-' . $i . '" ';
|
||||
|
||||
$html .= "<li class=\"um-multi-text-option-line {$size}\"><span class=\"um-field-wrapper\">
|
||||
<input type=\"text\" $id_attr $name_attr $class_attr $data_attr value=\"\" /></span>
|
||||
<span class=\"um-field-control\"><a href=\"javascript:void(0);\" class=\"um-text-delete\">" . __( 'Remove', 'ultimate-member' ) . "</a></span></li>";
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
$html .= "</ul><a href=\"javascript:void(0);\" class=\"button button-primary um-multi-text-add-option\" data-name=\"$name\">{$field_data['add_text']}</a>";
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
|
||||
function render_media( $field_data ) {
|
||||
|
||||
if ( empty( $field_data['id'] ) )
|
||||
return false;
|
||||
|
||||
$id = ( ! empty( $this->form_data['prefix_id'] ) ? $this->form_data['prefix_id'] : '' ) . '_' . $field_data['id'];
|
||||
|
||||
$class = ! empty( $field_data['class'] ) ? $field_data['class'] : '';
|
||||
$class .= ! empty( $field_data['size'] ) ? $field_data['size'] : 'um-long-field';
|
||||
$class_attr = ' class="um-forms-field um-media-upload-data-url ' . $class . '"';
|
||||
|
||||
$data = array(
|
||||
'field_id' => $field_data['id'],
|
||||
);
|
||||
|
||||
if ( ! empty( $field_data['default']['url'] ) )
|
||||
$data['default'] = esc_attr( $field_data['default']['url'] );
|
||||
|
||||
$data_attr = '';
|
||||
foreach ( $data as $key => $value ) {
|
||||
$data_attr .= " data-{$key}=\"{$value}\" ";
|
||||
}
|
||||
|
||||
$name = $field_data['id'];
|
||||
$name = ! empty( $this->form_data['prefix_id'] ) ? $this->form_data['prefix_id'] . '[' . $name . ']' : $name;
|
||||
$default = isset( $field_data['default'] ) ? $field_data['default'] : '';
|
||||
$value = ! empty( $field_data['value'] ) ? $field_data['value'] : $default;
|
||||
|
||||
$upload_frame_title = ! empty( $field_data['upload_frame_title'] ) ? $field_data['upload_frame_title'] : __( 'Select media', 'ultimate-member' );
|
||||
|
||||
$image_id = ! empty( $value['id'] ) ? $value['id'] : '';
|
||||
$image_width = ! empty( $value['width'] ) ? $value['width'] : '';
|
||||
$image_height = ! empty( $value['height'] ) ? $value['height'] : '';
|
||||
$image_thumbnail = ! empty( $value['thumbnail'] ) ? $value['thumbnail'] : '';
|
||||
$image_url = ! empty( $value['url'] ) ? $value['url'] : '';
|
||||
|
||||
$html = "<div class=\"um-media-upload\">" .
|
||||
"<input type=\"hidden\" class=\"um-media-upload-data-id\" name=\"{$name}[id]\" id=\"{$id}_id\" value=\"$image_id\">" .
|
||||
"<input type=\"hidden\" class=\"um-media-upload-data-width\" name=\"{$name}[width]\" id=\"{$id}_width\" value=\"$image_width\">" .
|
||||
"<input type=\"hidden\" class=\"um-media-upload-data-height\" name=\"{$name}[height]\" id=\"{$id}_height\" value=\"$image_height\">" .
|
||||
"<input type=\"hidden\" class=\"um-media-upload-data-thumbnail\" name=\"{$name}[thumbnail]\" id=\"{$id}_thumbnail\" value=\"$image_thumbnail\">" .
|
||||
"<input type=\"hidden\" $class_attr name=\"{$name}[url]\" id=\"{$id}_url\" value=\"$image_url\" $data_attr>";
|
||||
|
||||
if ( ! isset( $field_data['preview'] ) || $field_data['preview'] !== false ) {
|
||||
$html .= '<img src="' . $image_url . '" alt="" class="icon_preview"><div style="clear:both;"></div>';
|
||||
}
|
||||
|
||||
if ( ! empty( $field_data['url'] ) ) {
|
||||
$html .= '<input type="text" class="um-media-upload-url" readonly value="' . $image_url . '" /><div style="clear:both;"></div>';
|
||||
}
|
||||
|
||||
$html .= '<input type="button" class="um-set-image button button-primary" value="' . __( 'Select', 'ultimate-member' ) . '" data-upload_frame="' . $upload_frame_title . '" />
|
||||
<input type="button" class="um-clear-image button" value="' . __( 'Clear', 'ultimate-member' ) . '" /></div>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
<?php
|
||||
namespace um\admin\core;
|
||||
|
||||
// Exit if accessed directly.
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
if ( ! class_exists( 'Admin_Functions' ) ) {
|
||||
class Admin_Functions {
|
||||
|
||||
function __construct() {
|
||||
|
||||
$this->slug = 'ultimatemember';
|
||||
|
||||
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') );
|
||||
|
||||
}
|
||||
|
||||
/***
|
||||
*** @updated post messages
|
||||
***/
|
||||
function post_updated_messages($messages) {
|
||||
global $post, $post_ID;
|
||||
|
||||
$post_type = get_post_type( $post_ID );
|
||||
if ($post_type == 'um_form') {
|
||||
|
||||
$messages['um_form'] = array(
|
||||
0 => '',
|
||||
1 => __('Form updated.'),
|
||||
2 => __('Custom field updated.'),
|
||||
3 => __('Custom field deleted.'),
|
||||
4 => __('Form updated.'),
|
||||
5 => isset($_GET['revision']) ? __('Form restored to revision.') : false,
|
||||
6 => __('Form created.'),
|
||||
7 => __('Form saved.'),
|
||||
8 => __('Form submitted.'),
|
||||
9 => __('Form scheduled.'),
|
||||
10=> __('Form draft updated.'),
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
if ($post_type == 'um_role') {
|
||||
|
||||
$messages['um_role'] = array(
|
||||
0 => '',
|
||||
1 => __('Role updated.'),
|
||||
2 => __('Custom field updated.'),
|
||||
3 => __('Custom field deleted.'),
|
||||
4 => __('Role updated.'),
|
||||
5 => isset($_GET['revision']) ? __('Role restored to revision.') : false,
|
||||
6 => __('Role created.'),
|
||||
7 => __('Role saved.'),
|
||||
8 => __('Role submitted.'),
|
||||
9 => __('Role scheduled.'),
|
||||
10=> __('Role draft updated.'),
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
return $messages;
|
||||
}
|
||||
|
||||
/***
|
||||
*** @check that we're on a custom post type supported by UM
|
||||
***/
|
||||
function is_plugin_post_type(){
|
||||
if (isset($_REQUEST['post_type'])){
|
||||
$post_type = $_REQUEST['post_type'];
|
||||
if ( in_array($post_type, array('um_form','um_role','um_directory'))){
|
||||
return true;
|
||||
}
|
||||
} else if ( isset($_REQUEST['action'] ) && $_REQUEST['action'] == 'edit') {
|
||||
$post_type = get_post_type();
|
||||
if ( in_array($post_type, array('um_form','um_role','um_directory'))){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/***
|
||||
*** @gettext filters
|
||||
***/
|
||||
function gettext($translation, $text, $domain) {
|
||||
global $post;
|
||||
//$screen = get_current_screen();
|
||||
if ( isset( $post->post_type ) && $this->is_plugin_post_type() ) {
|
||||
$translations = get_translations_for_domain( $domain);
|
||||
if ( $text == 'Publish') {
|
||||
return $translations->translate( 'Create' );
|
||||
}
|
||||
if ( $text == 'Move to Trash') {
|
||||
return $translations->translate( 'Delete' );
|
||||
}
|
||||
}
|
||||
|
||||
return $translation;
|
||||
}
|
||||
|
||||
/***
|
||||
*** @Fix parent file for correct highlighting
|
||||
***/
|
||||
function parent_file($parent_file){
|
||||
global $current_screen;
|
||||
$screen_id = $current_screen->id;
|
||||
if ( strstr($screen_id, 'um_') ) {
|
||||
$parent_file = $this->slug;
|
||||
}
|
||||
return $parent_file;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,321 @@
|
||||
<?php
|
||||
namespace um\admin\core;
|
||||
|
||||
|
||||
use \RecursiveDirectoryIterator;
|
||||
// Exit if accessed directly.
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
if ( ! class_exists( 'Admin_Menu' ) ) {
|
||||
class Admin_Menu {
|
||||
var $about_tabs = array();
|
||||
|
||||
function __construct() {
|
||||
|
||||
$this->slug = 'ultimatemember';
|
||||
|
||||
$this->about_tabs['about'] = 'About';
|
||||
$this->about_tabs['start'] = 'Getting Started';
|
||||
|
||||
add_action('admin_menu', array(&$this, 'primary_admin_menu'), 0);
|
||||
add_action('admin_menu', array(&$this, 'secondary_menu_items'), 1000);
|
||||
add_action('admin_menu', array(&$this, 'extension_menu'), 9999);
|
||||
|
||||
add_action( 'admin_head', array( $this, 'menu_order_count' ) );
|
||||
|
||||
add_filter( 'admin_footer_text', array( $this, 'admin_footer_text' ), 1000 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the admin footer text on UM admin pages
|
||||
*/
|
||||
public function admin_footer_text( $footer_text ) {
|
||||
$current_screen = get_current_screen();
|
||||
|
||||
// Add the dashboard pages
|
||||
$um_pages[] = 'toplevel_page_ultimatemember';
|
||||
$um_pages[] = 'admin_page_ultimatemember-about';
|
||||
$um_pages[] = 'ultimate-member_page_um_options';
|
||||
$um_pages[] = 'edit-um_form';
|
||||
$um_pages[] = 'edit-um_role';
|
||||
$um_pages[] = 'edit-um_directory';
|
||||
$um_pages[] = 'ultimate-member_page_ultimatemember-extensions';
|
||||
|
||||
if ( isset( $current_screen->id ) && in_array( $current_screen->id, $um_pages ) ) {
|
||||
// Change the footer text
|
||||
if ( ! get_option( 'um_admin_footer_text_rated' ) ) {
|
||||
|
||||
$footer_text = sprintf( __( 'If you like Ultimate Member please consider leaving a %s★★★★★%s review. It will help us to grow the plugin and make it more popular. Thank you.', 'ultimate-member' ), '<a href="https://wordpress.org/support/plugin/ultimate-member/reviews/?filter=5" target="_blank" class="um-admin-rating-link" data-rated="' . __( 'Thanks :)', 'ultimate-member' ) . '">', '</a>' );
|
||||
|
||||
$footer_text .= "<script type='text/javascript'>
|
||||
jQuery('a.um-admin-rating-link').click(function() {
|
||||
jQuery.post( '" . UM()->get_ajax_route( get_class( $this ), 'ultimatemember_rated' ) . "', {} );
|
||||
jQuery(this).parent().text( jQuery(this).data( 'rated' ) );
|
||||
});
|
||||
</script>";
|
||||
}
|
||||
}
|
||||
|
||||
return $footer_text;
|
||||
}
|
||||
|
||||
/**
|
||||
* When user clicks the review link in backend
|
||||
*/
|
||||
function ultimatemember_rated() {
|
||||
update_option('um_admin_footer_text_rated', 1 );
|
||||
die();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Manage order of admin menu items
|
||||
*/
|
||||
public function menu_order_count() {
|
||||
global $menu, $submenu;
|
||||
|
||||
if ( ! current_user_can( 'list_users' ) )
|
||||
return;
|
||||
|
||||
$count = UM()->user()->get_pending_users_count();
|
||||
if ( is_array( $menu ) ) {
|
||||
foreach ( $menu as $key => $menu_item ) {
|
||||
if ( 0 === strpos( $menu_item[0], _x( 'Users', 'Admin menu name' ) ) ) {
|
||||
$menu[ $key ][0] .= ' <span class="update-plugins count-'.$count.'"><span class="processing-count">'.$count.'</span></span>';
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if ( is_array( $submenu ) ) {
|
||||
foreach ( $submenu['users.php'] as $key => $menu_item ) {
|
||||
if ( 0 === strpos( $menu_item[0], _x( 'All Users', 'Admin menu name' ) ) ) {
|
||||
$submenu['users.php'][ $key ][0] .= ' <span class="update-plugins count-'.$count.'"><span class="processing-count">'.$count.'</span></span>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/***
|
||||
*** @setup admin menu
|
||||
***/
|
||||
function primary_admin_menu() {
|
||||
|
||||
$this->pagehook = add_menu_page( __('Ultimate Member', $this->slug), __('Ultimate Member', $this->slug), 'manage_options', $this->slug, array(&$this, 'admin_page'), 'dashicons-admin-users', '42.78578');
|
||||
add_action( 'load-' . $this->pagehook, array( &$this, 'on_load_page' ) );
|
||||
|
||||
add_submenu_page( $this->slug, __('Dashboard', $this->slug), __('Dashboard', $this->slug), 'manage_options', $this->slug, array(&$this, 'admin_page') );
|
||||
|
||||
foreach( $this->about_tabs as $k => $tab ) {
|
||||
add_submenu_page( '_'. $k . '_um', sprintf(__('%s | Ultimate Member', $this->slug), $tab), sprintf(__('%s | Ultimate Member', $this->slug), $tab), 'manage_options', $this->slug . '-' . $k, array(&$this, 'admin_page') );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
*** @secondary admin menu (after settings)
|
||||
***/
|
||||
function secondary_menu_items() {
|
||||
|
||||
add_submenu_page( $this->slug, __('Forms', $this->slug), __('Forms', $this->slug), 'manage_options', 'edit.php?post_type=um_form', '', '' );
|
||||
|
||||
add_submenu_page( $this->slug, __( 'User Roles', 'ultimate-member' ), __( 'User Roles', 'ultimate-member' ), 'manage_options', 'um_roles', array( &$this, 'um_roles_pages' ) );
|
||||
|
||||
if ( um_get_option('members_page' ) || !get_option('um_options') ){
|
||||
add_submenu_page( $this->slug, __('Member Directories', $this->slug), __('Member Directories', $this->slug), 'manage_options', 'edit.php?post_type=um_directory', '', '' );
|
||||
}
|
||||
|
||||
do_action('um_extend_admin_menu');
|
||||
|
||||
}
|
||||
|
||||
|
||||
function um_roles_pages() {
|
||||
|
||||
if ( empty( $_GET['tab'] ) ) {
|
||||
include_once um_path . 'includes/admin/core/list-tables/roles-list-table.php';
|
||||
} elseif ( $_GET['tab'] == 'add' || $_GET['tab'] == 'edit' ) {
|
||||
include_once um_path . 'includes/admin/templates/role/role-edit.php';
|
||||
} else {
|
||||
um_js_redirect( add_query_arg( array( 'page' => 'um_roles' ), get_admin_url( 'admin.php' ) ) );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
*** @extension menu
|
||||
***/
|
||||
function extension_menu() {
|
||||
|
||||
add_submenu_page( $this->slug, __('Extensions', $this->slug), '<span style="color: #00B9EB">' .__('Extensions', $this->slug) . '</span>', 'manage_options', $this->slug . '-extensions', array(&$this, 'admin_page') );
|
||||
|
||||
}
|
||||
|
||||
/***
|
||||
*** @load metabox stuff
|
||||
***/
|
||||
function on_load_page() {
|
||||
wp_enqueue_script('common');
|
||||
wp_enqueue_script('wp-lists');
|
||||
wp_enqueue_script('postbox');
|
||||
|
||||
/** custom metaboxes for dashboard defined here **/
|
||||
|
||||
add_meta_box('um-metaboxes-contentbox-1', __('Users Overview','ultimate-member'), array(&$this, 'users_overview'), $this->pagehook, 'core', 'core');
|
||||
|
||||
add_meta_box('um-metaboxes-mainbox-1', __('Latest from our blog','ultimate-member'), array(&$this, 'um_news'), $this->pagehook, 'normal', 'core');
|
||||
|
||||
add_meta_box('um-metaboxes-sidebox-1', __('Purge Temp Files','ultimate-member'), array(&$this, 'purge_temp'), $this->pagehook, 'side', 'core');
|
||||
add_meta_box('um-metaboxes-sidebox-2', __('User Cache','ultimate-member'), array(&$this, 'user_cache'), $this->pagehook, 'side', 'core');
|
||||
|
||||
if ( $this->language_avaialable_not_installed() ) {
|
||||
add_meta_box('um-metaboxes-sidebox-2', __('Language','ultimate-member'), array(&$this, 'dl_language'), $this->pagehook, 'side', 'core');
|
||||
} else if ( $this->language_avaialable_installed() ) {
|
||||
add_meta_box('um-metaboxes-sidebox-2', __('Language','ultimate-member'), array(&$this, 'up_language'), $this->pagehook, 'side', 'core');
|
||||
} else if ( $this->language_not_available() ) {
|
||||
add_meta_box('um-metaboxes-sidebox-2', __('Language','ultimate-member'), array(&$this, 'ct_language'), $this->pagehook, 'side', 'core');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function up_language() {
|
||||
$locale = get_option('WPLANG');
|
||||
include_once UM()->admin()->templates_path . 'dashboard/language-update.php';
|
||||
}
|
||||
|
||||
function dl_language() {
|
||||
$locale = get_option('WPLANG');
|
||||
include_once UM()->admin()->templates_path . 'dashboard/language-download.php';
|
||||
}
|
||||
|
||||
function ct_language() {
|
||||
$locale = get_option('WPLANG');
|
||||
include_once UM()->admin()->templates_path . 'dashboard/language-contrib.php';
|
||||
}
|
||||
|
||||
function um_news() {
|
||||
include_once UM()->admin()->templates_path . 'dashboard/feed.php';
|
||||
}
|
||||
|
||||
function users_overview() {
|
||||
include_once UM()->admin()->templates_path . 'dashboard/users.php';
|
||||
}
|
||||
|
||||
function purge_temp() {
|
||||
include_once UM()->admin()->templates_path . 'dashboard/purge.php';
|
||||
}
|
||||
|
||||
function user_cache() {
|
||||
include_once UM()->admin()->templates_path . 'dashboard/cache.php';
|
||||
}
|
||||
|
||||
/***
|
||||
*** @language not available
|
||||
***/
|
||||
function language_not_available() {
|
||||
$locale = get_option('WPLANG');
|
||||
if ( $locale && !strstr($locale, 'en_') && !isset( UM()->available_languages[$locale] ) && !file_exists( WP_LANG_DIR . '/plugins/ultimatemember-' . $locale . '.mo' ) )
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/***
|
||||
*** @language available but not installed
|
||||
***/
|
||||
function language_avaialable_not_installed() {
|
||||
$locale = get_option('WPLANG');
|
||||
if ( $locale && isset( UM()->available_languages[$locale] ) && !file_exists( WP_LANG_DIR . '/plugins/ultimatemember-' . $locale . '.mo' ) )
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/***
|
||||
*** @language available and installed
|
||||
***/
|
||||
function language_avaialable_installed() {
|
||||
$locale = get_option('WPLANG');
|
||||
if ( $locale && isset( UM()->available_languages[$locale] ) && file_exists( WP_LANG_DIR . '/plugins/ultimatemember-' . $locale . '.mo' ) )
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/***
|
||||
*** @get a directory size
|
||||
***/
|
||||
function dir_size( $directory ) {
|
||||
if ( $directory == 'temp' ) {
|
||||
$directory = UM()->files()->upload_temp;
|
||||
$size = 0;
|
||||
|
||||
foreach( new \RecursiveIteratorIterator( new \RecursiveDirectoryIterator( $directory ) ) as $file ) {
|
||||
$size+=$file->getSize();
|
||||
}
|
||||
return round ( $size / 1048576, 2);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/***
|
||||
*** @which admin page to show?
|
||||
***/
|
||||
function admin_page() {
|
||||
|
||||
$page = $_REQUEST['page'];
|
||||
if ( $page == 'ultimatemember' && ! isset( $_REQUEST['um-addon'] ) ) {
|
||||
|
||||
?>
|
||||
|
||||
<div id="um-metaboxes-general" class="wrap">
|
||||
|
||||
<h2>Ultimate Member <sup><?php echo ultimatemember_version; ?></sup></h2>
|
||||
|
||||
<?php wp_nonce_field('um-metaboxes-general'); ?>
|
||||
<?php wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false ); ?>
|
||||
<?php wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false ); ?>
|
||||
|
||||
<input type="hidden" name="action" value="save_um_metaboxes_general" />
|
||||
|
||||
<div id="dashboard-widgets-wrap">
|
||||
|
||||
<div id="dashboard-widgets" class="metabox-holder um-metabox-holder">
|
||||
|
||||
<div id="postbox-container-1" class="postbox-container"><?php do_meta_boxes($this->pagehook,'core',null); ?></div>
|
||||
<div id="postbox-container-2" class="postbox-container"><?php do_meta_boxes($this->pagehook,'normal',null); ?></div>
|
||||
<div id="postbox-container-3" class="postbox-container"><?php do_meta_boxes($this->pagehook,'side',null); ?></div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div><div class="um-admin-clear"></div>
|
||||
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
jQuery(document).ready( function($) {
|
||||
// postboxes setup
|
||||
postboxes.add_postbox_toggles('<?php echo $this->pagehook; ?>');
|
||||
});
|
||||
//]]>
|
||||
</script>
|
||||
|
||||
<?php
|
||||
|
||||
} else if ( $page == 'ultimatemember-extensions' ) {
|
||||
|
||||
include_once UM()->admin()->templates_path . 'extensions.php';
|
||||
|
||||
} else if ( $page == 'ultimatemember-about' ) {
|
||||
|
||||
include_once UM()->admin()->templates_path . 'welcome/about.php';
|
||||
|
||||
} else if ( $page == 'ultimatemember-start' ) {
|
||||
|
||||
include_once UM()->admin()->templates_path . 'welcome/start.php';
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,220 @@
|
||||
<?php
|
||||
namespace um\admin\core;
|
||||
|
||||
// Exit if accessed directly.
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
if ( ! class_exists( 'Admin_Notices' ) ) {
|
||||
class Admin_Notices {
|
||||
|
||||
function __construct() {
|
||||
|
||||
add_action('admin_init', array(&$this, 'create_languages_folder') );
|
||||
|
||||
add_action('admin_notices', array(&$this, 'main_notices'), 1);
|
||||
|
||||
add_action('admin_notices', array(&$this, 'localize_note'), 2);
|
||||
|
||||
add_action('admin_notices', array(&$this, 'show_update_messages'), 10);
|
||||
|
||||
}
|
||||
|
||||
/***
|
||||
*** @to store plugin languages
|
||||
***/
|
||||
function create_languages_folder() {
|
||||
|
||||
$path = UM()->files()->upload_basedir;
|
||||
$path = str_replace('/uploads/ultimatemember','',$path);
|
||||
$path = $path . '/languages/plugins/';
|
||||
$path = str_replace('//','/',$path);
|
||||
|
||||
if ( !file_exists( $path ) ) {
|
||||
$old = umask(0);
|
||||
@mkdir( $path, 0777, true);
|
||||
umask($old);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/***
|
||||
*** @show main notices
|
||||
***/
|
||||
function main_notices() {
|
||||
|
||||
if ( ! defined( 'DOING_AJAX' ) ) {
|
||||
|
||||
$hide_exif_notice = get_option( 'um_hide_exif_notice' );
|
||||
|
||||
if ( !extension_loaded('exif') && !$hide_exif_notice ) {
|
||||
|
||||
echo '<div class="updated" style="border-color: #0085ba;"><p>';
|
||||
|
||||
echo sprintf(__( 'Exif is not enabled on your server. Mobile photo uploads will not be rotated correctly until you enable the exif extension. <a href="%s">Hide this notice</a>', 'ultimate-member' ), add_query_arg('um_adm_action', 'um_hide_exif_notice') );
|
||||
|
||||
echo '</p></div>';
|
||||
|
||||
}
|
||||
|
||||
// Regarding page setup
|
||||
$pages = UM()->config()->permalinks;
|
||||
if ( $pages && is_array( $pages ) ) {
|
||||
|
||||
$err = false;
|
||||
|
||||
foreach( $pages as $slug => $page_id ) {
|
||||
|
||||
$page = get_post( $page_id );
|
||||
|
||||
if ( !isset( $page->ID ) && in_array( $slug, array( 'user','account','members','register','login','logout','password-reset' ) ) ) {
|
||||
$err = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ( $err ) {
|
||||
echo '<div class="updated" style="border-color: #0085ba;"><p>' . __('One or more of your Ultimate Member pages are not correctly setup. Please visit <strong>Ultimate Member > Settings</strong> to re-assign your missing pages.','ultimate-member') . '</p></div>';
|
||||
}
|
||||
|
||||
if ( isset( $pages['user'] ) ) {
|
||||
$test = get_post( $pages['user'] );
|
||||
if ( isset( $test->post_parent ) && $test->post_parent > 0 ) {
|
||||
echo '<div class="updated" style="border-color: #0085ba;"><p>' . __('Ultimate Member Setup Error: User page can not be a child page.','ultimate-member') . '</p></div>';
|
||||
}
|
||||
}
|
||||
|
||||
if ( isset( $pages['account'] ) ) {
|
||||
$test = get_post( $pages['account'] );
|
||||
if ( isset( $test->post_parent ) && $test->post_parent > 0 ) {
|
||||
echo '<div class="updated" style="border-color: #0085ba;"><p>' . __('Ultimate Member Setup Error: Account page can not be a child page.','ultimate-member') . '</p></div>';
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
do_action('um_admin_after_main_notices');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
*** @localization notice
|
||||
***/
|
||||
function localize_note() {
|
||||
$locale = get_option('WPLANG');
|
||||
if ( !$locale ) return;
|
||||
if ( strstr( $locale, 'en_' ) ) return; // really, english!
|
||||
if ( file_exists( WP_LANG_DIR . '/plugins/ultimatemember-' . $locale . '.mo' ) ) return;
|
||||
|
||||
if ( isset( UM()->available_languages[ $locale ] ) ) {
|
||||
|
||||
$download_uri = add_query_arg('um_adm_action', 'um_language_downloader');
|
||||
|
||||
$hide_locale_notice = get_option('um_hide_locale_notice');
|
||||
if ( !$hide_locale_notice ) {
|
||||
echo '<div class="updated" style="border-color: #0085ba;"><p>';
|
||||
|
||||
echo sprintf(__('Your site language is <strong>%1$s</strong>. Good news! Ultimate Member is already available in <strong>%2$s language</strong>. <a href="%3$s">Download the translation</a> files and start using the plugin in your language now. <a href="%4$s">Hide this notice</a>','ultimate-member'), $locale, UM()->available_languages[$locale], $download_uri, add_query_arg('um_adm_action', 'um_hide_locale_notice') );
|
||||
|
||||
echo '</p></div>';
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
$hide_locale_notice = get_option('um_hide_locale_notice');
|
||||
if ( !$hide_locale_notice ) {
|
||||
|
||||
echo '<div class="updated" style="border-color: #0085ba;"><p>';
|
||||
|
||||
echo sprintf(__('Ultimate Member has not yet been translated to your langeuage: <strong>%1$s</strong>. If you have translated the plugin you need put these files <code>ultimatemember-%1$s.po and ultimatemember-%1$s.mo</code> in <strong>/wp-content/languages/plugins/</strong> for the plugin to be translated in your language. <a href="%2$s">Hide this notice</a>','ultimate-member'), $locale, add_query_arg('um_adm_action', 'um_hide_locale_notice') );
|
||||
|
||||
echo '</p></div>';
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/***
|
||||
*** @updating users
|
||||
***/
|
||||
function show_update_messages(){
|
||||
|
||||
if ( !isset($_REQUEST['update']) ) return;
|
||||
|
||||
$update = $_REQUEST['update'];
|
||||
switch($update) {
|
||||
|
||||
case 'confirm_delete':
|
||||
$confirm_uri = admin_url('users.php?' . http_build_query(array(
|
||||
'um_adm_action' => 'delete_users',
|
||||
'user' => array_map('intval', (array) $_REQUEST['user']),
|
||||
'confirm' => 1
|
||||
)));
|
||||
$users = '';
|
||||
|
||||
if( isset( $_REQUEST['user'] ) ){
|
||||
foreach( $_REQUEST['user'] as $user_id ) {
|
||||
$user = get_userdata( $user_id );
|
||||
$users .= '#' . $user_id . ': ' . $user->user_login . '<br />';
|
||||
}
|
||||
}
|
||||
|
||||
$ignore = admin_url('users.php');
|
||||
|
||||
$messages[0]['err_content'] = sprintf(__('Are you sure you want to delete the selected user(s)? The following users will be deleted: <p>%s</p> <strong>This cannot be undone!</strong>','ultimate-member'), $users);
|
||||
$messages[0]['err_content'] .= '<p><a href="'. esc_html( $confirm_uri ) .'" class="button-primary">' . __('Remove','ultimate-member') . '</a> <a href="'.$ignore.'" class="button">' . __('Undo','ultimate-member') . '</a></p>';
|
||||
|
||||
break;
|
||||
|
||||
case 'language_updated':
|
||||
$messages[0]['content'] = __('Your translation files have been updated successfully.','ultimate-member');
|
||||
break;
|
||||
|
||||
case 'purged_temp':
|
||||
$messages[0]['content'] = __('Your temp uploads directory is now clean.','ultimate-member');
|
||||
break;
|
||||
|
||||
case 'cleared_cache':
|
||||
$messages[0]['content'] = __('Your user cache is now removed.','ultimate-member');
|
||||
break;
|
||||
|
||||
case 'form_duplicated':
|
||||
$messages[0]['content'] = __('The form has been duplicated successfully.','ultimate-member');
|
||||
break;
|
||||
|
||||
case 'user_updated':
|
||||
$messages[0]['content'] = __('User has been updated.','ultimate-member');
|
||||
break;
|
||||
|
||||
case 'users_updated':
|
||||
$messages[0]['content'] = __('Users have been updated.','ultimate-member');
|
||||
break;
|
||||
|
||||
case 'users_role_updated':
|
||||
$messages[0]['content'] = __('Changed roles.','ultimate-member');
|
||||
break;
|
||||
|
||||
case 'err_users_updated':
|
||||
$messages[0]['err_content'] = __('Super administrators cannot be modified.','ultimate-member');
|
||||
$messages[1]['content'] = __('Other users have been updated.','ultimate-member');
|
||||
|
||||
}
|
||||
|
||||
if ( !empty( $messages ) ) {
|
||||
foreach( $messages as $message ) {
|
||||
if ( isset($message['err_content'])) {
|
||||
echo '<div class="error"><p>' . $message['err_content'] . '</p></div>';
|
||||
} else {
|
||||
echo '<div class="updated" style="border-color: #0085ba;"><p>' . $message['content'] . '</p></div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
namespace um\admin\core;
|
||||
|
||||
// Exit if accessed directly.
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
if ( ! class_exists( 'Admin_Upgrade' ) ) {
|
||||
/**
|
||||
* This class handles all functions that changes data structures and moving files
|
||||
*/
|
||||
class Admin_Upgrade {
|
||||
var $update_versions;
|
||||
var $packages_dir;
|
||||
|
||||
|
||||
function __construct() {
|
||||
$this->packages_dir = plugin_dir_path( __FILE__ ).'packages/';
|
||||
|
||||
$um_last_version_upgrade = get_option( 'um_last_version_upgrade' );
|
||||
|
||||
if ( ! $um_last_version_upgrade || version_compare( $um_last_version_upgrade, ultimatemember_version, '<' ) )
|
||||
add_action( 'admin_init', array( $this, 'packages' ), 10 );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load packages
|
||||
*/
|
||||
public function packages() {
|
||||
$this->set_update_versions();
|
||||
|
||||
$um_last_version_upgrade = get_option( 'um_last_version_upgrade' );
|
||||
$um_last_version_upgrade = ! $um_last_version_upgrade ? '0.0.0' : $um_last_version_upgrade;
|
||||
|
||||
foreach ( $this->update_versions as $update_version ) {
|
||||
|
||||
if ( version_compare( $update_version, $um_last_version_upgrade, '<=' ) )
|
||||
continue;
|
||||
|
||||
if ( version_compare( $update_version, ultimatemember_version, '>' ) )
|
||||
continue;
|
||||
|
||||
$file_path = $this->packages_dir . $update_version . '.php';
|
||||
|
||||
if ( file_exists( $file_path ) ) {
|
||||
include_once( $file_path );
|
||||
update_option( 'um_last_version_upgrade', $update_version );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Parse packages dir for packages files
|
||||
*/
|
||||
function set_update_versions() {
|
||||
$update_versions = array();
|
||||
$handle = opendir( $this->packages_dir );
|
||||
while ( false !== ( $filename = readdir( $handle ) ) ) {
|
||||
|
||||
if ( $filename != '.' && $filename != '..' )
|
||||
$update_versions[] = preg_replace( '/(.*?)\.php/i', '$1', $filename );
|
||||
|
||||
}
|
||||
closedir( $handle );
|
||||
|
||||
sort( $update_versions );
|
||||
|
||||
$this->update_versions = $update_versions;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,295 @@
|
||||
<?php
|
||||
namespace um\admin\core;
|
||||
|
||||
// Exit if accessed directly.
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
if ( ! class_exists( 'Admin_Users' ) ) {
|
||||
class Admin_Users {
|
||||
|
||||
function __construct() {
|
||||
|
||||
$this->custom_role = 'um_role';
|
||||
|
||||
add_action( 'restrict_manage_users', array( &$this, 'restrict_manage_users' ) );
|
||||
|
||||
add_filter( 'user_row_actions', array( &$this, 'user_row_actions' ), 10, 2 );
|
||||
|
||||
add_filter( 'pre_user_query', array( &$this, 'sort_by_newest' ) );
|
||||
|
||||
add_filter( 'pre_user_query', array( &$this, 'filter_users_by_status' ) );
|
||||
|
||||
add_filter( 'views_users', array( &$this, 'add_status_links' ) );
|
||||
|
||||
add_action( 'admin_init', array( &$this, 'um_bulk_users_edit' ), 9 );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add UM Bulk actions to Users List Table
|
||||
*
|
||||
*/
|
||||
function restrict_manage_users() { ?>
|
||||
<div style="float:right;margin:0 4px">
|
||||
|
||||
<label class="screen-reader-text" for="um_bulk_action"><?php _e( 'UM Action', 'ultimate-member' ); ?></label>
|
||||
|
||||
<select name="um_bulk_action[]" id="um_bulk_action" class="" style="width: 200px">
|
||||
<option value="0"><?php _e( 'UM Action', 'ultimate-member' ); ?></option>
|
||||
<?php echo $this->get_bulk_admin_actions(); ?>
|
||||
</select>
|
||||
|
||||
<input name="um_bulkedit" id="um_bulkedit" class="button" value="<?php _e( 'Apply', 'ultimate-member' ); ?>" type="submit" />
|
||||
|
||||
</div>
|
||||
|
||||
<?php if ( ! empty( $_REQUEST['status'] ) ) { ?>
|
||||
<input type="hidden" name="status" id="um_status" value="<?php echo esc_attr( $_REQUEST['status'] );?>"/>
|
||||
<?php }
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get UM bulk actions HTML
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function get_bulk_admin_actions() {
|
||||
|
||||
$actions = apply_filters( 'um_admin_bulk_user_actions_hook', array(
|
||||
'um_approve_membership' => array(
|
||||
'label' => __( 'Approve Membership', 'ultimate-member' )
|
||||
),
|
||||
'um_reject_membership' => array(
|
||||
'label' => __( 'Reject Membership', 'ultimate-member' )
|
||||
),
|
||||
'um_put_as_pending' => array(
|
||||
'label' => __( 'Put as Pending Review', 'ultimate-member' )
|
||||
),
|
||||
'um_resend_activation' => array(
|
||||
'label' => __( 'Resend Activation E-mail', 'ultimate-member' )
|
||||
),
|
||||
'um_deactivate' => array(
|
||||
'label' => __( 'Deactivate', 'ultimate-member' )
|
||||
),
|
||||
'um_reenable' => array(
|
||||
'label' => __( 'Reactivate', 'ultimate-member' )
|
||||
)
|
||||
) );
|
||||
|
||||
$output = '';
|
||||
foreach ( $actions as $id => $action_data ) {
|
||||
$output .= '<option value="' . $id . '" '. disabled( isset( $arr['disabled'] ), true, false ) . '>' . $action_data['label'] . '</option>';
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Custom row actions for users page
|
||||
*
|
||||
* @param array $actions
|
||||
* @param $user_object \WP_User
|
||||
* @return array
|
||||
*/
|
||||
function user_row_actions( $actions, $user_object ) {
|
||||
$user_id = $user_object->ID;
|
||||
|
||||
$actions['frontend_profile'] = "<a class='' href='" . UM()->user()->get_profile_url( $user_id ) . "'>" . __( 'View profile', 'ultimate-member' ) . "</a>";
|
||||
|
||||
$submitted = get_user_meta( $user_id, 'submitted', true );
|
||||
if ( ! empty( $submitted ) )
|
||||
$actions['view_info'] = '<a href="#" data-modal="UM_preview_registration" data-modal-size="smaller" data-dynamic-content="um_admin_review_registration" data-arg1="' . $user_id . '" data-arg2="edit_registration">' . __( 'Info', 'ultimate-member' ) . '</a>';
|
||||
|
||||
$actions = apply_filters( 'um_admin_user_row_actions', $actions, $user_id );
|
||||
|
||||
return $actions;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Change default sorting at WP Users list table
|
||||
*
|
||||
* @param $query
|
||||
* @return mixed
|
||||
*/
|
||||
function sort_by_newest( $query ) {
|
||||
global $pagenow;
|
||||
|
||||
if ( is_admin() && $pagenow == 'users.php' ) {
|
||||
if ( ! isset( $_REQUEST['orderby'] ) ) {
|
||||
$query->query_vars["order"] = 'desc';
|
||||
$query->query_orderby = " ORDER BY user_registered " . ( $query->query_vars["order"] == "desc" ? "desc " : "asc " ); //set sort order
|
||||
}
|
||||
}
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Filter WP users by UM Status
|
||||
*
|
||||
* @param $query
|
||||
* @return mixed
|
||||
*/
|
||||
function filter_users_by_status( $query ) {
|
||||
global $wpdb, $pagenow;
|
||||
|
||||
if ( is_admin() && $pagenow == 'users.php' && ! empty( $_GET['status'] ) ) {
|
||||
|
||||
$status = urldecode( $_GET['status'] );
|
||||
|
||||
if ( $status == 'needs-verification' ) {
|
||||
$query->query_where = str_replace('WHERE 1=1',
|
||||
"WHERE 1=1 AND {$wpdb->users}.ID IN (
|
||||
SELECT {$wpdb->usermeta}.user_id FROM $wpdb->usermeta
|
||||
WHERE {$wpdb->usermeta}.meta_key = '_um_verified'
|
||||
AND {$wpdb->usermeta}.meta_value = 'pending')",
|
||||
$query->query_where
|
||||
);
|
||||
} else {
|
||||
$query->query_where = str_replace('WHERE 1=1',
|
||||
"WHERE 1=1 AND {$wpdb->users}.ID IN (
|
||||
SELECT {$wpdb->usermeta}.user_id FROM $wpdb->usermeta
|
||||
WHERE {$wpdb->usermeta}.meta_key = 'account_status'
|
||||
AND {$wpdb->usermeta}.meta_value = '{$status}')",
|
||||
$query->query_where
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add status links to WP Users List Table
|
||||
*
|
||||
* @param $views
|
||||
* @return array|mixed|void
|
||||
*/
|
||||
function add_status_links( $views ) {
|
||||
remove_filter( 'pre_user_query', array( &$this, 'filter_users_by_status' ) );
|
||||
|
||||
$old_views = $views;
|
||||
$views = array();
|
||||
|
||||
if ( ! isset( $_REQUEST['role'] ) && ! isset( $_REQUEST['status'] ) ) {
|
||||
$views['all'] = '<a href="' . admin_url( 'users.php' ) . '" class="current">All <span class="count">(' . UM()->query()->count_users() . ')</span></a>';
|
||||
} else {
|
||||
$views['all'] = '<a href="' . admin_url( 'users.php' ) . '">All <span class="count">(' . UM()->query()->count_users() . ')</span></a>';
|
||||
}
|
||||
|
||||
$status = array(
|
||||
'approved' => __( 'Approved', 'ultimate-member' ),
|
||||
'awaiting_admin_review' => __( 'Pending review', 'ultimate-member' ),
|
||||
'awaiting_email_confirmation' => __( 'Waiting e-mail confirmation', 'ultimate-member' ),
|
||||
'inactive' => __( 'Inactive', 'ultimate-member' ),
|
||||
'rejected' => __( 'Rejected', 'ultimate-member' )
|
||||
);
|
||||
|
||||
UM()->query()->count_users_by_status( 'unassigned' );
|
||||
|
||||
foreach ( $status as $k => $v ) {
|
||||
if ( isset( $_REQUEST['status'] ) && $_REQUEST['status'] == $k ) {
|
||||
$current = 'class="current"';
|
||||
} else {
|
||||
$current = '';
|
||||
}
|
||||
|
||||
$views[$k] = '<a href="' . admin_url( 'users.php' ) . '?status=' . $k . '" ' . $current . '>'. $v . ' <span class="count">('.UM()->query()->count_users_by_status( $k ).')</span></a>';
|
||||
}
|
||||
|
||||
$views = apply_filters( 'um_admin_views_users', $views );
|
||||
|
||||
// remove all filters
|
||||
unset( $old_views['all'] );
|
||||
|
||||
// add separator
|
||||
$views['subsep'] = '<span></span>';
|
||||
|
||||
// merge views
|
||||
foreach ( $old_views as $key => $view ) {
|
||||
$views[ $key ] = $view;
|
||||
}
|
||||
|
||||
return $views;
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
*** @Bulk user editing actions
|
||||
***/
|
||||
function um_bulk_users_edit() {
|
||||
$admin_err = 0;
|
||||
|
||||
// bulk edit users
|
||||
if ( ! empty( $_REQUEST['users'] ) && ! empty( $_REQUEST['um_bulkedit'] ) && ! empty( $_REQUEST['um_bulk_action'] ) ) {
|
||||
|
||||
if ( ! current_user_can( 'edit_users' ) )
|
||||
wp_die( __( 'You do not have enough permissions to do that.', 'ultimate-member' ) );
|
||||
|
||||
check_admin_referer( 'bulk-users' );
|
||||
|
||||
$users = $_REQUEST['users'];
|
||||
$bulk_action = current( array_filter( $_REQUEST['um_bulk_action'] ) );
|
||||
|
||||
foreach ( $users as $user_id ) {
|
||||
UM()->user()->set( $user_id );
|
||||
if ( ! um_user( 'super_admin' ) ) {
|
||||
|
||||
do_action( "um_admin_user_action_hook", $bulk_action );
|
||||
|
||||
do_action( "um_admin_user_action_{$bulk_action}_hook" );
|
||||
|
||||
} else {
|
||||
$admin_err = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Finished. redirect now
|
||||
if ( $admin_err == 0 ) {
|
||||
|
||||
$uri = $this->set_redirect_uri( admin_url( 'users.php' ) );
|
||||
$uri = add_query_arg( 'update', 'users_updated', $uri );
|
||||
|
||||
wp_redirect( $uri );
|
||||
|
||||
exit;
|
||||
} else {
|
||||
wp_redirect( admin_url( 'users.php?update=err_users_updated' ) );
|
||||
exit;
|
||||
}
|
||||
|
||||
} else if ( ! empty( $_REQUEST['um_bulkedit'] ) ) {
|
||||
|
||||
$uri = $this->set_redirect_uri( admin_url( 'users.php' ) );
|
||||
wp_redirect( $uri );
|
||||
exit;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets redirect URI after bulk action
|
||||
*
|
||||
* @param string $uri
|
||||
* @return string
|
||||
*/
|
||||
function set_redirect_uri( $uri ) {
|
||||
|
||||
if ( ! empty( $_REQUEST['s'] ) )
|
||||
$uri = add_query_arg( 's', $_REQUEST['s'], $uri );
|
||||
|
||||
if ( ! empty( $_REQUEST['status'] ) )
|
||||
$uri = add_query_arg( 'status', $_REQUEST['status'], $uri );
|
||||
|
||||
return $uri;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,192 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) )
|
||||
exit; // Exit if accessed directly
|
||||
|
||||
global $wpdb;
|
||||
|
||||
if ( isset($_REQUEST['_wp_http_referer']) ) {
|
||||
$redirect = remove_query_arg(array('_wp_http_referer' ), wp_unslash( $_REQUEST['_wp_http_referer'] ) );
|
||||
} else {
|
||||
$redirect = get_admin_url(). 'admin.php?page=ultimatemember';
|
||||
}
|
||||
|
||||
//remove extra query arg
|
||||
if ( !empty( $_GET['_wp_http_referer'] ) ) {
|
||||
do_action( 'wp_client_redirect', remove_query_arg( array( '_wp_http_referer', '_wpnonce'), wp_unslash( $_SERVER['REQUEST_URI'] ) ) );
|
||||
exit;
|
||||
}
|
||||
|
||||
$order_by = 'u.user_registered';
|
||||
if ( isset( $_GET['orderby'] ) ) {
|
||||
switch( $_GET['orderby'] ) {
|
||||
case 'username' :
|
||||
$order_by = 'u.user_login';
|
||||
break;
|
||||
case 'nickname' :
|
||||
$order_by = 'u.user_nicename';
|
||||
break;
|
||||
case 'email' :
|
||||
$order_by = 'u.user_email';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$order = ( isset( $_GET['order'] ) && 'asc' == strtolower( $_GET['order'] ) ) ? 'ASC' : 'DESC';
|
||||
|
||||
|
||||
if( ! class_exists( 'WP_List_Table' ) )
|
||||
require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
|
||||
|
||||
|
||||
class UM_Emails_List_Table extends WP_List_Table {
|
||||
|
||||
var $no_items_message = '';
|
||||
var $sortable_columns = array();
|
||||
var $default_sorting_field = '';
|
||||
var $actions = array();
|
||||
var $bulk_actions = array();
|
||||
var $columns = array();
|
||||
|
||||
function __construct( $args = array() ){
|
||||
$args = wp_parse_args( $args, array(
|
||||
'singular' => __( 'item', 'ultimate-member' ),
|
||||
'plural' => __( 'items', 'ultimate-member' ),
|
||||
'ajax' => false
|
||||
) );
|
||||
|
||||
$this->no_items_message = $args['plural'] . ' ' . __( 'not found.', 'ultimate-member' );
|
||||
|
||||
parent::__construct( $args );
|
||||
|
||||
|
||||
}
|
||||
|
||||
function __call( $name, $arguments ) {
|
||||
return call_user_func_array( array( $this, $name ), $arguments );
|
||||
}
|
||||
|
||||
function prepare_items() {
|
||||
$columns = $this->get_columns();
|
||||
$hidden = array();
|
||||
$sortable = $this->get_sortable_columns();
|
||||
$this->_column_headers = array( $columns, $hidden, $sortable );
|
||||
}
|
||||
|
||||
function column_default( $item, $column_name ) {
|
||||
if( isset( $item[ $column_name ] ) ) {
|
||||
return $item[ $column_name ];
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
function no_items() {
|
||||
echo $this->no_items_message;
|
||||
}
|
||||
|
||||
function set_sortable_columns( $args = array() ) {
|
||||
$return_args = array();
|
||||
foreach( $args as $k=>$val ) {
|
||||
if( is_numeric( $k ) ) {
|
||||
$return_args[ $val ] = array( $val, $val == $this->default_sorting_field );
|
||||
} else if( is_string( $k ) ) {
|
||||
$return_args[ $k ] = array( $val, $k == $this->default_sorting_field );
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
$this->sortable_columns = $return_args;
|
||||
return $this;
|
||||
}
|
||||
|
||||
function get_sortable_columns() {
|
||||
return $this->sortable_columns;
|
||||
}
|
||||
|
||||
function set_columns( $args = array() ) {
|
||||
if( count( $this->bulk_actions ) ) {
|
||||
$args = array_merge( array( 'cb' => '<input type="checkbox" />' ), $args );
|
||||
}
|
||||
$this->columns = $args;
|
||||
return $this;
|
||||
}
|
||||
|
||||
function get_columns() {
|
||||
return $this->columns;
|
||||
}
|
||||
|
||||
function set_actions( $args = array() ) {
|
||||
$this->actions = $args;
|
||||
return $this;
|
||||
}
|
||||
|
||||
function get_actions() {
|
||||
return $this->actions;
|
||||
}
|
||||
|
||||
function set_bulk_actions( $args = array() ) {
|
||||
$this->bulk_actions = $args;
|
||||
return $this;
|
||||
}
|
||||
|
||||
function get_bulk_actions() {
|
||||
return $this->bulk_actions;
|
||||
}
|
||||
|
||||
function column_email( $item ) {
|
||||
$active = um_get_option( $item['key'] . '_on' );
|
||||
if ( $active === '' )
|
||||
$active = ! empty( $item['default_active'] );
|
||||
return '<span class="dashicons um-notification-status ' . ( ! empty( $active ) ? 'um-notification-is-active dashicons-yes' : 'dashicons-no-alt' ) . '"></span><a href="' . add_query_arg( array( 'email' => $item['key'] ) ) . '"><strong>'. $item['title'] . '</strong></a>';
|
||||
}
|
||||
|
||||
|
||||
function column_recipients( $item ) {
|
||||
if ( $item['recipient'] == 'admin' )
|
||||
return um_get_option( 'admin_email' );
|
||||
else
|
||||
return __( 'Member', 'ultimate-member' );
|
||||
}
|
||||
|
||||
|
||||
function column_configure( $item ) {
|
||||
return '<a class="button um-email-configure" href="' . add_query_arg( array( 'email' => $item['key'] ) ) . '"><span class="dashicons dashicons-admin-generic"></span></a>';
|
||||
}
|
||||
|
||||
|
||||
function wpc_set_pagination_args( $attr = array() ) {
|
||||
$this->set_pagination_args( $attr );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$ListTable = new UM_Emails_List_Table( array(
|
||||
'singular' => __( 'Email Notification', 'ultimate-member' ),
|
||||
'plural' => __( 'Email Notifications', 'ultimate-member' ),
|
||||
'ajax' => false
|
||||
));
|
||||
|
||||
$per_page = 20;
|
||||
$paged = $ListTable->get_pagenum();
|
||||
|
||||
$ListTable->set_columns( array(
|
||||
'email' => __( 'Email', 'ultimate-member' ),
|
||||
'recipients' => __( 'Recipient(s)', 'ultimate-member' ),
|
||||
'configure' => '',
|
||||
) );
|
||||
|
||||
$emails = UM()->config()->email_notifications;
|
||||
|
||||
$ListTable->prepare_items();
|
||||
$ListTable->items = $emails;
|
||||
$ListTable->wpc_set_pagination_args( array( 'total_items' => count( $emails ), 'per_page' => $per_page ) ); ?>
|
||||
|
||||
<form action="" method="get" name="um-settings-emails" id="um-settings-emails">
|
||||
<input type="hidden" name="page" value="um_options" />
|
||||
<input type="hidden" name="tab" value="email" />
|
||||
<?php if ( ! empty( $_GET['section'] ) ) { ?>
|
||||
<input type="hidden" name="section" value="<?php echo $_GET['section'] ?>" />
|
||||
<?php }
|
||||
|
||||
$ListTable->display(); ?>
|
||||
</form>
|
||||
@@ -0,0 +1,366 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
|
||||
global $wpdb;
|
||||
|
||||
if ( isset( $_REQUEST['_wp_http_referer'] ) ) {
|
||||
$redirect = remove_query_arg(array('_wp_http_referer' ), wp_unslash( $_REQUEST['_wp_http_referer'] ) );
|
||||
} else {
|
||||
$redirect = get_admin_url(). 'admin.php?page=um_roles';
|
||||
}
|
||||
|
||||
global $wp_roles;
|
||||
|
||||
if ( isset( $_GET['action'] ) ) {
|
||||
switch ( $_GET['action'] ) {
|
||||
/* delete action */
|
||||
case 'delete': {
|
||||
$role_keys = array();
|
||||
if ( isset( $_REQUEST['id'] ) ) {
|
||||
check_admin_referer( 'um_role_delete' . $_REQUEST['id'] . get_current_user_id() );
|
||||
$role_keys = (array)$_REQUEST['id'];
|
||||
} elseif( isset( $_REQUEST['item'] ) ) {
|
||||
check_admin_referer( 'bulk-' . sanitize_key( __( 'Roles', 'ultimate-member' ) ) );
|
||||
$role_keys = $_REQUEST['item'];
|
||||
}
|
||||
|
||||
if ( ! count( $role_keys ) )
|
||||
um_js_redirect( $redirect );
|
||||
|
||||
$um_roles = get_option( 'um_roles' );
|
||||
|
||||
foreach ( $role_keys as $k=>$role_key ) {
|
||||
$role_meta = get_option( "um_role_{$role_key}_meta" );
|
||||
|
||||
if ( empty( $role_meta['_um_is_custom'] ) ) {
|
||||
unset( $role_keys[array_search( $role_key, $role_keys )] );
|
||||
continue;
|
||||
}
|
||||
|
||||
delete_option( "um_role_{$role_key}_meta" );
|
||||
|
||||
$role_keys[$k] = 'um_' . $role_key;
|
||||
}
|
||||
|
||||
//set for users with deleted roles role "Subscriber"
|
||||
$args = array(
|
||||
'blog_id' => get_current_blog_id(),
|
||||
'role__in' => $role_keys,
|
||||
'number' => -1,
|
||||
'count_total' => false,
|
||||
'fields' => 'ids',
|
||||
);
|
||||
$users_to_subscriber = get_users( $args );
|
||||
if ( ! empty( $users_to_subscriber ) ) {
|
||||
foreach ( $users_to_subscriber as $user_id ) {
|
||||
$object_user = get_userdata( $user_id );
|
||||
|
||||
if ( ! empty( $object_user ) ) {
|
||||
foreach ( $role_keys as $roleID ) {
|
||||
$object_user->remove_role( $roleID );
|
||||
}
|
||||
}
|
||||
|
||||
//update user role if it's empty
|
||||
if ( empty( $object_user->roles ) )
|
||||
wp_update_user( array( 'ID' => $user_id, 'role' => 'subscriber' ) );
|
||||
}
|
||||
}
|
||||
|
||||
um_js_redirect( add_query_arg( 'msg', 'd', $redirect ) );
|
||||
break;
|
||||
}
|
||||
case 'reset': {
|
||||
$role_keys = array();
|
||||
if ( isset( $_REQUEST['id'] ) ) {
|
||||
check_admin_referer( 'um_role_reset' . $_REQUEST['id'] . get_current_user_id() );
|
||||
$role_keys = (array)$_REQUEST['id'];
|
||||
} elseif( isset( $_REQUEST['item'] ) ) {
|
||||
check_admin_referer( 'bulk-' . sanitize_key( __( 'Roles', 'ultimate-member' ) ) );
|
||||
$role_keys = $_REQUEST['item'];
|
||||
}
|
||||
|
||||
if ( ! count( $role_keys ) )
|
||||
um_js_redirect( $redirect );
|
||||
|
||||
foreach ( $role_keys as $k=>$role_key ) {
|
||||
$role_meta = get_option( "um_role_{$role_key}_meta" );
|
||||
|
||||
if ( ! empty( $role_meta['_um_is_custom'] ) ) {
|
||||
unset( $role_keys[array_search( $role_key, $role_keys )] );
|
||||
continue;
|
||||
}
|
||||
|
||||
delete_option( "um_role_{$role_key}_meta" );
|
||||
}
|
||||
|
||||
um_js_redirect( add_query_arg( 'msg', 'reset', $redirect ) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//remove extra query arg
|
||||
if ( ! empty( $_GET['_wp_http_referer'] ) )
|
||||
um_js_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce'), wp_unslash( $_SERVER['REQUEST_URI'] ) ) );
|
||||
|
||||
$order_by = 'name';
|
||||
$order = ( isset( $_GET['order'] ) && 'asc' == strtolower( $_GET['order'] ) ) ? 'ASC' : 'DESC';
|
||||
|
||||
if( ! class_exists( 'WP_List_Table' ) )
|
||||
require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
|
||||
|
||||
|
||||
class UM_Roles_List_Table extends WP_List_Table {
|
||||
|
||||
var $no_items_message = '';
|
||||
var $sortable_columns = array();
|
||||
var $default_sorting_field = '';
|
||||
var $actions = array();
|
||||
var $bulk_actions = array();
|
||||
var $columns = array();
|
||||
|
||||
function __construct( $args = array() ){
|
||||
$args = wp_parse_args( $args, array(
|
||||
'singular' => __( 'item', 'ultimate-member' ),
|
||||
'plural' => __( 'items', 'ultimate-member' ),
|
||||
'ajax' => false
|
||||
) );
|
||||
|
||||
$this->no_items_message = $args['plural'] . ' ' . __( 'not found.', 'ultimate-member' );
|
||||
|
||||
parent::__construct( $args );
|
||||
|
||||
|
||||
}
|
||||
|
||||
function __call( $name, $arguments ) {
|
||||
return call_user_func_array( array( $this, $name ), $arguments );
|
||||
}
|
||||
|
||||
function prepare_items() {
|
||||
$columns = $this->get_columns();
|
||||
$hidden = array();
|
||||
$sortable = $this->get_sortable_columns();
|
||||
$this->_column_headers = array( $columns, $hidden, $sortable );
|
||||
}
|
||||
|
||||
function column_default( $item, $column_name ) {
|
||||
if( isset( $item[ $column_name ] ) ) {
|
||||
return $item[ $column_name ];
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
function no_items() {
|
||||
echo $this->no_items_message;
|
||||
}
|
||||
|
||||
function set_sortable_columns( $args = array() ) {
|
||||
$return_args = array();
|
||||
foreach( $args as $k=>$val ) {
|
||||
if( is_numeric( $k ) ) {
|
||||
$return_args[ $val ] = array( $val, $val == $this->default_sorting_field );
|
||||
} else if( is_string( $k ) ) {
|
||||
$return_args[ $k ] = array( $val, $k == $this->default_sorting_field );
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
$this->sortable_columns = $return_args;
|
||||
return $this;
|
||||
}
|
||||
|
||||
function get_sortable_columns() {
|
||||
return $this->sortable_columns;
|
||||
}
|
||||
|
||||
function set_columns( $args = array() ) {
|
||||
if( count( $this->bulk_actions ) ) {
|
||||
$args = array_merge( array( 'cb' => '<input type="checkbox" />' ), $args );
|
||||
}
|
||||
$this->columns = $args;
|
||||
return $this;
|
||||
}
|
||||
|
||||
function get_columns() {
|
||||
return $this->columns;
|
||||
}
|
||||
|
||||
function set_actions( $args = array() ) {
|
||||
$this->actions = $args;
|
||||
return $this;
|
||||
}
|
||||
|
||||
function get_actions() {
|
||||
return $this->actions;
|
||||
}
|
||||
|
||||
function set_bulk_actions( $args = array() ) {
|
||||
$this->bulk_actions = $args;
|
||||
return $this;
|
||||
}
|
||||
|
||||
function get_bulk_actions() {
|
||||
return $this->bulk_actions;
|
||||
}
|
||||
|
||||
|
||||
function column_cb( $item ) {
|
||||
return sprintf( '<input type="checkbox" name="item[]" value="%s" />', $item['key'] );
|
||||
}
|
||||
|
||||
|
||||
function column_title( $item ) {
|
||||
$actions = array();
|
||||
|
||||
$actions['edit'] = '<a href="admin.php?page=um_roles&tab=edit&id=' . $item['key'] . '">' . __( 'Edit', 'ultimate-member' ). '</a>';
|
||||
|
||||
if ( ! empty( $item['_um_is_custom'] ) ) {
|
||||
$actions['delete'] = '<a href="admin.php?page=um_roles&action=delete&id=' . $item['key'] . '&_wpnonce=' . wp_create_nonce( 'um_role_delete' . $item['key'] . get_current_user_id() ) . '" onclick="return confirm( \'' . __( 'Are you sure you want to delete this role?', 'ultimate-member' ) . '\' );">' . __( 'Delete', 'ultimate-member' ). '</a>';
|
||||
} else {
|
||||
$role_meta = get_option( "um_role_{$item['key']}_meta" );
|
||||
|
||||
if ( ! empty( $role_meta ) ) {
|
||||
$actions['reset'] = '<a href="admin.php?page=um_roles&action=reset&id=' . $item['key'] . '&_wpnonce=' . wp_create_nonce( 'um_role_reset' . $item['key'] . get_current_user_id() ) . '" onclick="return confirm( \'' . __( 'Are you sure you want to reset UM role meta?', 'ultimate-member' ) . '\' );">' . __( 'Reset UM Role meta', 'ultimate-member' ). '</a>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
return sprintf('%1$s %2$s', '<strong><a class="row-title" href="admin.php?page=um_roles&tab=edit&id=' . $item['key'] . '">'. ( ! empty( $item['_um_is_custom'] ) ? 'UM ' : '' ) . $item['name'] . '</a></strong>', $this->row_actions( $actions ) );
|
||||
}
|
||||
|
||||
function column_roleid( $item ) {
|
||||
return ! empty( $item['_um_is_custom'] ) ? 'um_' . $item['key'] : $item['key'];
|
||||
}
|
||||
|
||||
|
||||
function column_core( $item ) {
|
||||
if ( ! empty( $item['_um_is_custom'] ) ) {
|
||||
echo '<span class="um-adm-ico um-admin-tipsy-n" title="' . __( 'UM Custom Role', 'ultimate-member' ) . '"><i class="um-faicon-check"></i></span>';
|
||||
} else {
|
||||
echo '—';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function column_admin_access( $item ) {
|
||||
if ( ! empty( $item['_um_can_access_wpadmin'] ) ) {
|
||||
echo '<span class="um-adm-ico um-admin-tipsy-n" title="' . __( 'This role can access the WordPress backend', 'ultimate-member' ).'"><i class="um-faicon-check"></i></span>';
|
||||
} else {
|
||||
echo __( 'No', 'ultimate-member' );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function um_set_pagination_args( $attr = array() ) {
|
||||
$this->set_pagination_args( $attr );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$ListTable = new UM_Roles_List_Table( array(
|
||||
'singular' => __( 'Role', 'ultimate-member' ),
|
||||
'plural' => __( 'Roles', 'ultimate-member' ),
|
||||
'ajax' => false
|
||||
));
|
||||
|
||||
$per_page = 20;
|
||||
$paged = $ListTable->get_pagenum();
|
||||
|
||||
$ListTable->set_bulk_actions( array(
|
||||
'delete' => __( 'Delete', 'ultimate-member' )
|
||||
) );
|
||||
|
||||
$ListTable->set_columns( array(
|
||||
'title' => __( 'Role Title', 'ultimate-member' ),
|
||||
'roleid' => __( 'Role ID', 'ultimate-member' ),
|
||||
'users' => __( 'No.of Members', 'ultimate-member' ),
|
||||
'core' => __( 'UM Custom Role', 'ultimate-member' ),
|
||||
'admin_access' => __( 'WP-Admin Access', 'ultimate-member' ),
|
||||
) );
|
||||
|
||||
$ListTable->set_sortable_columns( array(
|
||||
'title' => 'title'
|
||||
) );
|
||||
|
||||
$users_count = count_users();
|
||||
|
||||
$roles = array();
|
||||
$role_keys = get_option( 'um_roles' );
|
||||
|
||||
if ( $role_keys ) {
|
||||
foreach ( $role_keys as $role_key ) {
|
||||
$role_meta = get_option( "um_role_{$role_key}_meta" );
|
||||
if ( $role_meta ) {
|
||||
|
||||
$roles['um_' . $role_key] = array(
|
||||
'key' => $role_key,
|
||||
'users' => ! empty( $users_count['avail_roles']['um_' . $role_key] ) ? $users_count['avail_roles']['um_' . $role_key] : 0
|
||||
);
|
||||
$roles['um_' . $role_key] = array_merge( $roles['um_' . $role_key], $role_meta );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
global $wp_roles;
|
||||
|
||||
foreach ( $wp_roles->roles as $roleID => $role_data ) {
|
||||
if ( in_array( $roleID, array_keys( $roles ) ) )
|
||||
continue;
|
||||
|
||||
$roles[$roleID] = array(
|
||||
'key' => $roleID,
|
||||
'users' => ! empty( $users_count['avail_roles'][$roleID] ) ? $users_count['avail_roles'][$roleID] : 0,
|
||||
'name' => $role_data['name']
|
||||
);
|
||||
|
||||
$role_meta = get_option( "um_role_{$roleID}_meta" );
|
||||
if ( $role_meta )
|
||||
$roles[$roleID] = array_merge( $roles[$roleID], $role_meta );
|
||||
}
|
||||
|
||||
switch( strtolower( $order ) ) {
|
||||
case 'asc':
|
||||
uasort( $roles, function( $a, $b ) {
|
||||
$a['name'] = ! empty( $a['_um_is_custom'] ) ? 'UM ' . $a['name'] : $a['name'];
|
||||
$b['name'] = ! empty( $b['_um_is_custom'] ) ? 'UM ' . $b['name'] : $b['name'];
|
||||
|
||||
return strnatcmp( $a['name'], $b['name'] );
|
||||
} );
|
||||
break;
|
||||
case 'desc':
|
||||
uasort( $roles, function( $a, $b ) {
|
||||
$a['name'] = ! empty( $a['_um_is_custom'] ) ? 'UM ' . $a['name'] : $a['name'];
|
||||
$b['name'] = ! empty( $b['_um_is_custom'] ) ? 'UM ' . $b['name'] : $b['name'];
|
||||
|
||||
return strnatcmp( $a['name'], $b['name'] ) * -1;
|
||||
} );
|
||||
break;
|
||||
}
|
||||
|
||||
$ListTable->prepare_items();
|
||||
$ListTable->items = $roles;
|
||||
$ListTable->um_set_pagination_args( array( 'total_items' => count( $roles ), 'per_page' => $per_page ) ); ?>
|
||||
|
||||
<div class="wrap">
|
||||
<h2>
|
||||
<?php _e( 'User Roles', 'ultimate-member' ) ?>
|
||||
<a class="add-new-h2" href="<?php echo add_query_arg( array( 'page' => 'um_roles', 'tab' => 'add' ), admin_url( 'admin.php' ) ) ?>"><?php _e( 'Add New', 'ultimate-member' ) ?></a>
|
||||
</h2>
|
||||
|
||||
<?php if ( ! empty( $_GET['msg'] ) ) {
|
||||
switch( $_GET['msg'] ) {
|
||||
case 'd':
|
||||
echo '<div id="message" class="updated fade"><p>' . __( 'User Role <strong>Deleted</strong> Successfully.', 'ultimate-member' ) . '</p></div>';
|
||||
break;
|
||||
}
|
||||
} ?>
|
||||
|
||||
<form action="" method="get" name="um-roles" id="um-roles" style="float: left;margin-right: 10px;">
|
||||
<input type="hidden" name="page" value="um_roles" />
|
||||
<?php $ListTable->display(); ?>
|
||||
</form>
|
||||
</div>
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
// If this file is called directly, abort.
|
||||
if ( ! defined( 'WPINC' ) ) {
|
||||
die;
|
||||
}
|
||||
|
||||
/**
|
||||
* This populates all existing UM users with meta_key `last_login` as `user_registered` if the meta key doesn't exist.
|
||||
* Target Version: 1.3.39
|
||||
*/
|
||||
|
||||
global $wpdb;
|
||||
$wpdb->query('INSERT INTO '.$wpdb->usermeta.'(user_id, meta_key, meta_value)
|
||||
SELECT uu.ID, "_um_last_login", uu.user_registered
|
||||
FROM '.$wpdb->users.' AS uu
|
||||
WHERE
|
||||
uu.ID NOT IN(
|
||||
SELECT user_id FROM '.$wpdb->usermeta.'
|
||||
WHERE meta_key = "_um_last_login"
|
||||
GROUP BY user_id
|
||||
)'
|
||||
);
|
||||
|
||||
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
|
||||
/***
|
||||
*** @Put status handler in modal
|
||||
***/
|
||||
add_action('um_admin_field_modal_header', 'um_admin_add_message_handlers');
|
||||
function um_admin_add_message_handlers(){ ?><div class="um-admin-error-block"></div><div class="um-admin-success-block"></div> <?php }
|
||||
|
||||
/***
|
||||
*** @Footer of modal
|
||||
***/
|
||||
add_action('um_admin_field_modal_footer', 'um_admin_add_conditional_support', 10, 4);
|
||||
function um_admin_add_conditional_support( $form_id, $field_args, $in_edit, $edit_array ){
|
||||
$metabox = UM()->metabox();
|
||||
|
||||
if ( isset( $field_args['conditional_support'] ) && $field_args['conditional_support'] == 0 )
|
||||
return;
|
||||
|
||||
?>
|
||||
|
||||
<div class="um-admin-btn-toggle">
|
||||
|
||||
<?php if ( $in_edit ) { $metabox->in_edit = true; $metabox->edit_array = $edit_array; ?>
|
||||
<a href="#"><i class="um-icon-plus"></i><?php _e('Manage conditional fields support'); ?></a> <?php UM()->tooltip( __( 'Here you can setup conditional logic to show/hide this field based on specific fields value or conditions', 'ultimate-member' ) ); ?>
|
||||
<?php } else { ?>
|
||||
<a href="#"><i class="um-icon-plus"></i><?php _e('Add conditional fields support'); ?></a> <?php UM()->tooltip( __( 'Here you can setup conditional logic to show/hide this field based on specific fields value or conditions', 'ultimate-member' ) ); ?>
|
||||
<?php } ?>
|
||||
|
||||
<div class="um-admin-btn-content">
|
||||
|
||||
<p class="um-admin-reset-conditions"><a href="#" class="button button-primary"><?php _e('Reset all rules','ultimate-member'); ?></a></p>
|
||||
<div class="um-admin-clear"></div>
|
||||
|
||||
<?php
|
||||
|
||||
if ( isset( $edit_array['conditions'] ) ){
|
||||
|
||||
foreach( $edit_array['conditions'] as $k => $arr ) {
|
||||
|
||||
if ( $k == 0 ) $k = '';
|
||||
?>
|
||||
|
||||
<div class="um-admin-cur-condition">
|
||||
|
||||
<?php $metabox->field_input( '_conditional_action' . $k, $form_id ); ?>
|
||||
<?php $metabox->field_input( '_conditional_field' . $k , $form_id ); ?>
|
||||
<?php $metabox->field_input( '_conditional_operator' . $k, $form_id ); ?>
|
||||
<?php $metabox->field_input( '_conditional_value' . $k, $form_id ); ?>
|
||||
|
||||
<?php if ( $k == '' ) { ?>
|
||||
<p><a href="#" class="um-admin-new-condition button um-admin-tipsy-n" title="Add new condition"><i class="um-icon-plus" style="margin-right:0!important"></i></a></p>
|
||||
<?php } else { ?>
|
||||
<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>
|
||||
<?php } ?>
|
||||
|
||||
<div class="um-admin-clear"></div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
?>
|
||||
|
||||
<div class="um-admin-cur-condition">
|
||||
|
||||
<?php $metabox->field_input( '_conditional_action', $form_id ); ?>
|
||||
<?php $metabox->field_input( '_conditional_field', $form_id ); ?>
|
||||
<?php $metabox->field_input( '_conditional_operator', $form_id ); ?>
|
||||
<?php $metabox->field_input( '_conditional_value', $form_id ); ?>
|
||||
|
||||
<p><a href="#" class="um-admin-new-condition button um-admin-tipsy-n" title="Add new condition"><i class="um-icon-plus" style="margin-right:0!important"></i></a></p>
|
||||
|
||||
<div class="um-admin-clear"></div>
|
||||
</div>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<?php
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
/***
|
||||
*** @Does an action to user asap
|
||||
***/
|
||||
add_action('um_admin_user_action_hook', 'um_admin_user_action_hook');
|
||||
function um_admin_user_action_hook( $action ){
|
||||
switch ( $action ) {
|
||||
|
||||
default:
|
||||
do_action("um_admin_custom_hook_{$action}", UM()->user()->id );
|
||||
break;
|
||||
|
||||
case 'um_put_as_pending':
|
||||
UM()->user()->pending();
|
||||
break;
|
||||
|
||||
case 'um_approve_membership':
|
||||
case 'um_reenable':
|
||||
UM()->user()->approve();
|
||||
break;
|
||||
|
||||
case 'um_reject_membership':
|
||||
UM()->user()->reject();
|
||||
break;
|
||||
|
||||
case 'um_resend_activation':
|
||||
UM()->user()->email_pending();
|
||||
break;
|
||||
|
||||
case 'um_deactivate':
|
||||
UM()->user()->deactivate();
|
||||
break;
|
||||
|
||||
case 'um_delete':
|
||||
if ( is_admin() )
|
||||
wp_die('This action is not allowed in backend.','ultimate-member');
|
||||
UM()->user()->delete();
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,226 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
*
|
||||
* Add access settings to category
|
||||
*
|
||||
**/
|
||||
|
||||
/***
|
||||
*** @add option for WPML
|
||||
***/
|
||||
add_filter( 'um_admin_access_settings_fields', 'um_admin_wpml_post_options', 10, 2 );
|
||||
function um_admin_wpml_post_options( $fields, $data ) {
|
||||
global $post;
|
||||
|
||||
if ( ! function_exists('icl_get_current_language') )
|
||||
return $fields;
|
||||
|
||||
if ( empty( $post->post_type ) || $post->post_type != 'page' )
|
||||
return $fields;
|
||||
|
||||
$fields[] = array(
|
||||
'id' => '_um_wpml_user',
|
||||
'type' => 'checkbox',
|
||||
'label' => __( 'This is a translation of UM profile page?', 'ultimate-member' ),
|
||||
'value' => ! empty( $data['_um_wpml_user'] ) ? $data['_um_wpml_user'] : 0
|
||||
);
|
||||
|
||||
$fields[] = array(
|
||||
'id' => '_um_wpml_account',
|
||||
'type' => 'checkbox',
|
||||
'label' => __( 'This is a translation of UM account page?', 'ultimate-member' ),
|
||||
'value' => ! empty( $data['_um_wpml_account'] ) ? $data['_um_wpml_account'] : 0
|
||||
);
|
||||
|
||||
return $fields;
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
*** @clear user cache
|
||||
***/
|
||||
add_action('um_admin_do_action__user_cache', 'um_admin_do_action__user_cache');
|
||||
function um_admin_do_action__user_cache( $action ){
|
||||
global $wpdb;
|
||||
if ( !is_admin() || !current_user_can('manage_options') ) die();
|
||||
|
||||
|
||||
$wpdb->query( "DELETE FROM {$wpdb->options} WHERE option_name LIKE 'um_cache_userdata_%'" );
|
||||
|
||||
|
||||
$url = admin_url('admin.php?page=ultimatemember');
|
||||
$url = add_query_arg('update','cleared_cache',$url);
|
||||
exit( wp_redirect($url) );
|
||||
}
|
||||
|
||||
/***
|
||||
*** @purge temp
|
||||
***/
|
||||
add_action('um_admin_do_action__purge_temp', 'um_admin_do_action__purge_temp');
|
||||
function um_admin_do_action__purge_temp( $action ){
|
||||
if ( !is_admin() || !current_user_can('manage_options') ) die();
|
||||
|
||||
UM()->files()->remove_dir( UM()->files()->upload_temp );
|
||||
|
||||
$url = remove_query_arg('um_adm_action', UM()->permalinks()->get_current_url() );
|
||||
$url = add_query_arg('update','purged_temp',$url);
|
||||
exit( wp_redirect($url) );
|
||||
}
|
||||
|
||||
/***
|
||||
*** @duplicate form
|
||||
***/
|
||||
add_action('um_admin_do_action__duplicate_form', 'um_admin_do_action__duplicate_form');
|
||||
function um_admin_do_action__duplicate_form( $action ) {
|
||||
if ( !is_admin() || !current_user_can('manage_options') ) die();
|
||||
if ( !isset($_REQUEST['post_id']) || !is_numeric( $_REQUEST['post_id'] ) ) die();
|
||||
|
||||
$post_id = $_REQUEST['post_id'];
|
||||
|
||||
$n = array(
|
||||
'post_type' => 'um_form',
|
||||
'post_title' => sprintf( __( 'Duplicate of %s', 'ultimate-member' ), get_the_title( $post_id ) ),
|
||||
'post_status' => 'publish',
|
||||
'post_author' => get_current_user_id(),
|
||||
);
|
||||
|
||||
$n_id = wp_insert_post( $n );
|
||||
|
||||
$n_fields = get_post_custom( $post_id );
|
||||
foreach ( $n_fields as $key => $value ) {
|
||||
|
||||
if ( $key == '_um_custom_fields' ) {
|
||||
$the_value = unserialize( $value[0] );
|
||||
} else {
|
||||
$the_value = $value[0];
|
||||
}
|
||||
|
||||
update_post_meta( $n_id, $key, $the_value );
|
||||
|
||||
}
|
||||
|
||||
delete_post_meta($n_id, '_um_core');
|
||||
|
||||
$url = admin_url('edit.php?post_type=um_form');
|
||||
$url = add_query_arg('update','form_duplicated',$url);
|
||||
|
||||
exit( wp_redirect( $url ) );
|
||||
|
||||
}
|
||||
|
||||
/***
|
||||
*** @download a language remotely
|
||||
***/
|
||||
add_action('um_admin_do_action__um_language_downloader', 'um_admin_do_action__um_language_downloader');
|
||||
function um_admin_do_action__um_language_downloader( $action ){
|
||||
if ( !is_admin() || !current_user_can('manage_options') ) die();
|
||||
|
||||
$locale = get_option('WPLANG');
|
||||
if ( !$locale ) return;
|
||||
if ( !isset( UM()->available_languages[$locale] ) ) return;
|
||||
|
||||
$path = UM()->files()->upload_basedir;
|
||||
$path = str_replace('/uploads/ultimatemember','',$path);
|
||||
$path = $path . '/languages/plugins/';
|
||||
$path = str_replace('//','/',$path);
|
||||
|
||||
$remote = 'https://ultimatemember.com/wp-content/languages/plugins/ultimatemember-' . $locale . '.po';
|
||||
$remote2 = 'https://ultimatemember.com/wp-content/languages/plugins/ultimatemember-' . $locale . '.mo';
|
||||
|
||||
$remote_tmp = download_url( $remote, $timeout = 300 );
|
||||
copy( $remote_tmp, $path . 'ultimatemember-' . $locale . '.po' );
|
||||
unlink( $remote_tmp );
|
||||
|
||||
$remote2_tmp = download_url( $remote2, $timeout = 300 );
|
||||
copy( $remote2_tmp, $path . 'ultimatemember-' . $locale . '.mo' );
|
||||
unlink( $remote2_tmp );
|
||||
|
||||
$url = remove_query_arg('um_adm_action', UM()->permalinks()->get_current_url() );
|
||||
$url = add_query_arg('update','language_updated',$url);
|
||||
exit( wp_redirect($url) );
|
||||
|
||||
}
|
||||
|
||||
/***
|
||||
*** @Action to hide notices in admin
|
||||
***/
|
||||
add_action('um_admin_do_action__um_hide_locale_notice', 'um_admin_do_action__hide_notice');
|
||||
add_action('um_admin_do_action__um_can_register_notice', 'um_admin_do_action__hide_notice');
|
||||
add_action('um_admin_do_action__um_hide_exif_notice', 'um_admin_do_action__hide_notice');
|
||||
function um_admin_do_action__hide_notice( $action ){
|
||||
if ( !is_admin() || !current_user_can('manage_options') ) die();
|
||||
update_option( $action, 1 );
|
||||
exit( wp_redirect( remove_query_arg('um_adm_action') ) );
|
||||
}
|
||||
|
||||
/***
|
||||
*** @Opt-in tracking
|
||||
***/
|
||||
add_action('um_admin_do_action__opt_into_tracking', 'um_admin_do_action__opt_into_tracking');
|
||||
function um_admin_do_action__opt_into_tracking( $action ) {
|
||||
if ( !is_admin() || !current_user_can('manage_options') ) die();
|
||||
|
||||
um_update_option( 'um_allow_tracking', 1 );
|
||||
update_option( 'um_tracking_notice', 1 );
|
||||
|
||||
$tracking = new um\core\Tracking();
|
||||
$tracking->send_checkin(true);
|
||||
|
||||
exit( wp_redirect( remove_query_arg('um_adm_action') ) );
|
||||
}
|
||||
|
||||
/***
|
||||
*** @Opt-out of tracking
|
||||
***/
|
||||
add_action('um_admin_do_action__opt_out_of_tracking', 'um_admin_do_action__opt_out_of_tracking');
|
||||
function um_admin_do_action__opt_out_of_tracking( $action ){
|
||||
if ( !is_admin() || !current_user_can('manage_options') ) die();
|
||||
|
||||
um_update_option( 'um_allow_tracking', 0 );
|
||||
update_option('um_tracking_notice', 1 );
|
||||
|
||||
exit( wp_redirect( remove_query_arg('um_adm_action') ) );
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
*** @various user actions
|
||||
***/
|
||||
add_action('um_admin_do_action__user_action', 'um_admin_do_action__user_action');
|
||||
function um_admin_do_action__user_action( $action ){
|
||||
if ( !is_admin() || !current_user_can( 'edit_users' ) ) die();
|
||||
if ( !isset( $_REQUEST['sub'] ) ) die();
|
||||
if ( !isset($_REQUEST['user_id']) ) die();
|
||||
|
||||
um_fetch_user( $_REQUEST['user_id'] );
|
||||
|
||||
$subaction = $_REQUEST['sub'];
|
||||
|
||||
do_action("um_admin_user_action_hook", $subaction);
|
||||
do_action("um_admin_user_action_{$subaction}_hook");
|
||||
|
||||
um_reset_user();
|
||||
|
||||
wp_redirect( add_query_arg( 'update', 'user_updated', admin_url('?page=ultimatemember') ) );
|
||||
exit;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
*** @Add any custom links to plugin page
|
||||
***/
|
||||
$prefix = is_network_admin() ? 'network_admin_' : '';
|
||||
add_filter( "{$prefix}plugin_action_links_" . um_plugin, 'ultimatemember_plugin_links' );
|
||||
function ultimatemember_plugin_links( $links ) {
|
||||
|
||||
$more_links[] = '<a href="http://docs.ultimatemember.com/">' . __('Docs','ultimate-member') . '</a>';
|
||||
|
||||
$more_links[] = '<a href="'.admin_url().'admin.php?page=um_options">' . __('Settings','ultimate-member') . '</a>';
|
||||
|
||||
$links = $more_links + $links;
|
||||
|
||||
return $links;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
<?php
|
||||
|
||||
/***
|
||||
*** @modify field args just before it is saved into form
|
||||
***/
|
||||
add_filter('um_admin_pre_save_field_to_form', 'um_admin_pre_save_field_to_form', 1 );
|
||||
function um_admin_pre_save_field_to_form( $array ){
|
||||
unset( $array['conditions'] );
|
||||
if ( isset($array['conditional_field']) && !empty( $array['conditional_action'] ) && !empty( $array['conditional_operator'] ) ) {
|
||||
$array['conditions'][] = array( $array['conditional_action'], $array['conditional_field'], $array['conditional_operator'], $array['conditional_value'] );
|
||||
}
|
||||
|
||||
if ( isset($array['conditional_field1']) && !empty( $array['conditional_action1'] ) && !empty( $array['conditional_operator1'] ) ) {
|
||||
$array['conditions'][] = array( $array['conditional_action1'], $array['conditional_field1'], $array['conditional_operator1'], $array['conditional_value1'] );
|
||||
}
|
||||
|
||||
if ( isset($array['conditional_field2']) && !empty( $array['conditional_action2'] ) && !empty( $array['conditional_operator2'] ) ) {
|
||||
$array['conditions'][] = array( $array['conditional_action2'], $array['conditional_field2'], $array['conditional_operator2'], $array['conditional_value2'] );
|
||||
}
|
||||
|
||||
if ( isset($array['conditional_field3']) && !empty( $array['conditional_action3'] ) && !empty( $array['conditional_operator3'] ) ) {
|
||||
$array['conditions'][] = array( $array['conditional_action3'], $array['conditional_field3'], $array['conditional_operator3'], $array['conditional_value3'] );
|
||||
}
|
||||
|
||||
if ( isset($array['conditional_field4']) && !empty( $array['conditional_action4'] ) && !empty( $array['conditional_operator4'] ) ) {
|
||||
$array['conditions'][] = array( $array['conditional_action4'], $array['conditional_field4'], $array['conditional_operator4'], $array['conditional_value4'] );
|
||||
}
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
/***
|
||||
*** @Some fields may require extra fields before saving
|
||||
***/
|
||||
add_filter('um_admin_pre_save_fields_hook', 'um_admin_pre_save_fields_hook', 1 );
|
||||
function um_admin_pre_save_fields_hook( $array ){
|
||||
extract( $array );
|
||||
|
||||
$fields_without_metakey = array('block','shortcode','spacing','divider','group');
|
||||
$fields_without_metakey = apply_filters('um_fields_without_metakey', $fields_without_metakey );
|
||||
|
||||
$fields = UM()->query()->get_attr('custom_fields', $form_id);
|
||||
$count = 1;
|
||||
if ( isset( $fields ) && !empty( $fields) ) $count = count($fields)+1;
|
||||
|
||||
// set unique meta key
|
||||
if ( in_array( $field_type, $fields_without_metakey ) && !isset($array['post']['_metakey']) ) {
|
||||
$array['post']['_metakey'] = "um_{$field_type}_{$form_id}_{$count}";
|
||||
}
|
||||
|
||||
// set position
|
||||
if ( !isset( $array['post']['_position'] ) ) {
|
||||
$array['post']['_position'] = $count;
|
||||
}
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
/***
|
||||
*** @Apply a filter to handle errors for field updating in backend
|
||||
***/
|
||||
add_filter('um_admin_field_update_error_handling', 'um_admin_field_update_error_handling', 1, 2 );
|
||||
function um_admin_field_update_error_handling( $errors, $array ){
|
||||
extract( $array );
|
||||
|
||||
$field_attr = UM()->builtin()->get_core_field_attrs( $field_type );
|
||||
|
||||
if ( isset( $field_attr['validate'] ) ) {
|
||||
|
||||
$validate = $field_attr['validate'];
|
||||
foreach ( $validate as $post_input => $arr ) {
|
||||
|
||||
$mode = $arr['mode'];
|
||||
|
||||
switch ( $mode ) {
|
||||
|
||||
case 'numeric':
|
||||
if ( !empty( $array['post'][$post_input] ) && !is_numeric( $array['post'][$post_input] ) ){
|
||||
$errors[$post_input] = $validate[$post_input]['error'];
|
||||
}
|
||||
break;
|
||||
|
||||
case 'unique':
|
||||
if ( !isset( $array['post']['edit_mode'] ) ) {
|
||||
if ( UM()->builtin()->unique_field_err( $array['post'][$post_input] ) ) {
|
||||
$errors[$post_input] = UM()->builtin()->unique_field_err( $array['post'][$post_input] );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 'required':
|
||||
if ( $array['post'][$post_input] == '' )
|
||||
$errors[$post_input] = $validate[$post_input]['error'];
|
||||
break;
|
||||
|
||||
case 'range-start':
|
||||
if ( UM()->builtin()->date_range_start_err( $array['post'][$post_input] ) && $array['post']['_range'] == 'date_range' )
|
||||
$errors[$post_input] = UM()->builtin()->date_range_start_err( $array['post'][$post_input] );
|
||||
break;
|
||||
|
||||
case 'range-end':
|
||||
if ( UM()->builtin()->date_range_end_err( $array['post'][$post_input], $array['post']['_range_start'] ) && $array['post']['_range'] == 'date_range' )
|
||||
$errors[$post_input] = UM()->builtin()->date_range_end_err( $array['post'][$post_input], $array['post']['_range_start'] );
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $errors;
|
||||
|
||||
}
|
||||
|
||||
/***
|
||||
*** @Filter validation types on loop
|
||||
****/
|
||||
add_filter('um_builtin_validation_types_continue_loop', 'um_builtin_validation_types_continue_loop', 1, 4);
|
||||
function um_builtin_validation_types_continue_loop( $break, $key, $form_id, $field_array ){
|
||||
|
||||
// show unique username validation only for user_login field
|
||||
if ( isset( $field_array['metakey'] ) && $field_array['metakey'] == 'user_login' && $key !== 'unique_username' ){
|
||||
return false;
|
||||
}
|
||||
|
||||
return $break;
|
||||
}
|
||||
@@ -0,0 +1,129 @@
|
||||
<?php
|
||||
// Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
?>
|
||||
|
||||
<div class="um-admin-metabox">
|
||||
<?php
|
||||
if ( ! empty( $object->ID ) )
|
||||
$data = get_post_meta( $object->ID, 'um_content_restriction', true );
|
||||
else
|
||||
$data = array();
|
||||
|
||||
$_um_access_roles_value = array();
|
||||
if ( ! empty( $data['_um_access_roles'] ) ) {
|
||||
foreach ( $data['_um_access_roles'] as $key => $value ) {
|
||||
if ( $value )
|
||||
$_um_access_roles_value[] = $key;
|
||||
}
|
||||
}
|
||||
|
||||
$fields = apply_filters( 'um_admin_access_settings_fields', array(
|
||||
array(
|
||||
'id' => '_um_custom_access_settings',
|
||||
'type' => 'checkbox',
|
||||
'name' => '_um_custom_access_settings',
|
||||
'label' => __( 'Restrict access to this content?', 'ultimate-member' ),
|
||||
'description' => __( 'Activate content restriction for this post', 'ultimate-member' ),
|
||||
'value' => ! empty( $data['_um_custom_access_settings'] ) ? $data['_um_custom_access_settings'] : 0,
|
||||
),
|
||||
array(
|
||||
'id' => '_um_accessible',
|
||||
'type' => 'select',
|
||||
'name' => '_um_accessible',
|
||||
'label' => __( 'Who can access this content?', 'ultimate-member' ),
|
||||
'description' => __( 'Activate content restriction for this post', 'ultimate-member' ),
|
||||
'value' => ! empty( $data['_um_accessible'] ) ? $data['_um_accessible'] : 0,
|
||||
'options' => array(
|
||||
'0' => __( 'Everyone', 'ultimate-member' ),
|
||||
'1' => __( 'Logged out users', 'ultimate-member' ),
|
||||
'2' => __( 'Logged in users', 'ultimate-member' ),
|
||||
),
|
||||
'conditional' => array( '_um_custom_access_settings', '=', '1' )
|
||||
),
|
||||
array(
|
||||
'id' => '_um_access_roles',
|
||||
'type' => 'multi_checkbox',
|
||||
'name' => '_um_access_roles',
|
||||
'label' => __( 'Select which roles can access this content', 'ultimate-member' ),
|
||||
'description' => __( 'Activate content restriction for this post', 'ultimate-member' ),
|
||||
'value' => $_um_access_roles_value,
|
||||
'options' => UM()->roles()->get_roles( false, array( 'administrator' ) ),
|
||||
'columns' => 3,
|
||||
'conditional' => array( '_um_accessible', '=', '2' )
|
||||
),
|
||||
array(
|
||||
'id' => '_um_noaccess_action',
|
||||
'type' => 'select',
|
||||
'name' => '_um_noaccess_action',
|
||||
'label' => __( 'What happens when users without access tries to view the content?', 'ultimate-member' ),
|
||||
'description' => __( 'Action when users without access tries to view the content', 'ultimate-member' ),
|
||||
'value' => ! empty( $data['_um_noaccess_action'] ) ? $data['_um_noaccess_action'] : 0,
|
||||
'options' => array(
|
||||
'0' => __( 'Show access restricted message', 'ultimate-member' ),
|
||||
'1' => __( 'Redirect user', 'ultimate-member' ),
|
||||
),
|
||||
'conditional' => array( '_um_accessible', '!=', '0' )
|
||||
),
|
||||
array(
|
||||
'id' => '_um_restrict_by_custom_message',
|
||||
'type' => 'select',
|
||||
'name' => '_um_restrict_by_custom_message',
|
||||
'label' => __( 'Would you like to use the global default message or apply a custom message to this content?', 'ultimate-member' ),
|
||||
'description' => __( 'Action when users without access tries to view the content', 'ultimate-member' ),
|
||||
'value' => ! empty( $data['_um_restrict_by_custom_message'] ) ? $data['_um_restrict_by_custom_message'] : '0',
|
||||
'options' => array(
|
||||
'0' => __( 'Global default message (default)', 'ultimate-member' ),
|
||||
'1' => __( 'Custom message', 'ultimate-member' ),
|
||||
),
|
||||
'conditional' => array( '_um_noaccess_action', '=', '0' )
|
||||
),
|
||||
array(
|
||||
'id' => '_um_restrict_custom_message',
|
||||
'type' => 'wp_editor',
|
||||
'name' => '_um_restrict_custom_message',
|
||||
'label' => __( 'Custom Restrict Content message', 'ultimate-member' ),
|
||||
'description' => __( 'Changed global restrict message', 'ultimate-member' ),
|
||||
'value' => ! empty( $data['_um_restrict_custom_message'] ) ? $data['_um_restrict_custom_message'] : '',
|
||||
'conditional' => array( '_um_restrict_by_custom_message', '=', '1' )
|
||||
),
|
||||
array(
|
||||
'id' => '_um_access_redirect',
|
||||
'type' => 'select',
|
||||
'name' => '_um_access_redirect',
|
||||
'label' => __( 'Where should users be redirected to?', 'ultimate-member' ),
|
||||
'description' => __( 'Select redirect to page when user hasn\'t access to content', 'ultimate-member' ),
|
||||
'value' => ! empty( $data['_um_access_redirect'] ) ? $data['_um_access_redirect'] : '0',
|
||||
'conditional' => array( '_um_noaccess_action', '=', '1' ),
|
||||
'options' => array(
|
||||
'0' => __( 'Login page', 'ultimate-member' ),
|
||||
'1' => __( 'Custom URL', 'ultimate-member' ),
|
||||
),
|
||||
),
|
||||
array(
|
||||
'id' => '_um_access_redirect_url',
|
||||
'type' => 'text',
|
||||
'name' => '_um_access_redirect_url',
|
||||
'label' => __( 'Redirect URL', 'ultimate-member' ),
|
||||
'description' => __( 'Changed global restrict message', 'ultimate-member' ),
|
||||
'value' => ! empty( $data['_um_access_redirect_url'] ) ? $data['_um_access_redirect_url'] : '',
|
||||
'conditional' => array( '_um_access_redirect', '=', '1' )
|
||||
),
|
||||
array(
|
||||
'id' => '_um_access_hide_from_queries',
|
||||
'type' => 'checkbox',
|
||||
'name' => '_um_access_hide_from_queries',
|
||||
'label' => __( 'Hide from queries', 'ultimate-member' ),
|
||||
'description' => __( 'Hide this content from archives, RSS feeds etc for users who do not have permission to view this content', 'ultimate-member' ),
|
||||
'value' => ! empty( $data['_um_access_hide_from_queries'] ) ? $data['_um_access_hide_from_queries'] : '',
|
||||
'conditional' => array( '_um_accessible', '!=', '0' )
|
||||
)
|
||||
), $data );
|
||||
|
||||
UM()->admin_forms( array(
|
||||
'class' => 'um-restrict-content um-third-column',
|
||||
'prefix_id' => 'um_content_restriction',
|
||||
'fields' => $fields
|
||||
) )->render_form(); ?>
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
$all_options = wp_load_alloptions();
|
||||
|
||||
$count = 0;
|
||||
foreach( $all_options as $k => $v ) {
|
||||
|
||||
if ( strstr( $k, 'um_cache_userdata_' ) ) {
|
||||
$count++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<p>Run this task from time to time to keep your DB clean.</p>
|
||||
<p><a href="<?php echo add_query_arg( 'um_adm_action', 'user_cache' ); ?>" class="button">Clear cache of <?php echo $count; ?> users</a></p>
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
echo '<div class="rss-widget">';
|
||||
|
||||
wp_widget_rss_output(array(
|
||||
'url' => 'https://ultimatemember.com/blog/feed/',
|
||||
'title' => 'Latest From Ultimate Member',
|
||||
'items' => 4,
|
||||
'show_summary' => 0,
|
||||
'show_author' => 0,
|
||||
'show_date' => 1,
|
||||
));
|
||||
|
||||
echo "</div>";
|
||||
|
||||
echo "<style type='text/css'>#um-metaboxes-mainbox-1 a.rsswidget {font-weight: 400}#um-metaboxes-mainbox-1 .rss-widget span.rss-date{ color: #777; margin-left: 12px;}</style>";
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,3 @@
|
||||
<p><?php printf(__('Ultimate Member is not yet available in your language: <strong>%1$s</strong>.','ultimate-member'), $locale); ?></p>
|
||||
|
||||
<p><?php _e('If you want to contribute this translation to the plugin, please add it on our <a href="https://ultimatemember.com/forums/">community forum</a>.','ultimate-member'); ?></p>
|
||||
@@ -0,0 +1,3 @@
|
||||
<p><?php printf(__('Ultimate Member is available in your language: <strong>%1$s (%2$s)</strong>.','ultimate-member'), UM()->available_languages[$locale], $locale); ?></p>
|
||||
|
||||
<p><a href="<?php echo add_query_arg( 'um_adm_action', 'um_language_downloader' ); ?>" class="button"><?php _e('Download Translation','ultimate-member'); ?></a></p>
|
||||
@@ -0,0 +1,3 @@
|
||||
<p><?php printf(__('You are currently using Ultimate Member in your language: <strong>%1$s (%2$s)</strong>.','ultimate-member'), UM()->available_languages[$locale], $locale); ?></p>
|
||||
|
||||
<p><a href="<?php echo add_query_arg( 'um_adm_action', 'um_language_downloader' ); ?>" class="button"><?php _e('Force Update Translation','ultimate-member'); ?></a></p>
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php if ( $this->dir_size('temp') > 0.1 ) { ?>
|
||||
|
||||
<p>You can free up <span class="red"><?php echo $this->dir_size('temp'); ?>MB</span> by purging your temp upload directory.</p>
|
||||
|
||||
<p><a href="<?php echo add_query_arg( 'um_adm_action', 'purge_temp' ); ?>" class="button">Purge Temp</a></p>
|
||||
|
||||
<?php } else { ?>
|
||||
|
||||
<p>Your temp uploads directory is <span class="ok">clean</span>. There is nothing to purge.</p>
|
||||
|
||||
<?php } ?>
|
||||
@@ -0,0 +1,45 @@
|
||||
<div class="table">
|
||||
|
||||
<table>
|
||||
|
||||
<tr class="first">
|
||||
<td class="first b"><a href="<?php echo admin_url('users.php'); ?>"><?php echo UM()->query()->count_users(); ?></a></td>
|
||||
<td class="t"><a href="<?php echo admin_url('users.php'); ?>"><?php _e('Users','ultimate-member'); ?></a></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="first b"><a href="<?php echo admin_url('users.php?status=approved'); ?>"><?php echo UM()->query()->count_users_by_status('approved'); ?></a></td>
|
||||
<td class="t"><a href="<?php echo admin_url('users.php?status=approved'); ?>"><?php _e('Approved','ultimate-member'); ?></a></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="first b"><a href="<?php echo admin_url('users.php?status=rejected'); ?>"><?php echo UM()->query()->count_users_by_status('rejected'); ?></a></td>
|
||||
<td class="t"><a href="<?php echo admin_url('users.php?status=rejected'); ?>"><?php _e('Rejected','ultimate-member'); ?></a></td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="table table_right">
|
||||
|
||||
<table>
|
||||
|
||||
<tr class="first">
|
||||
<td class="b"><a href="<?php echo admin_url('users.php?status=awaiting_admin_review'); ?>"><?php echo UM()->query()->count_users_by_status('awaiting_admin_review'); ?></a></td>
|
||||
<td class="last t"><a href="<?php echo admin_url('users.php?status=awaiting_admin_review'); ?>" class="warning"><?php _e('Pending Review','ultimate-member'); ?></a></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="b"><a href="<?php echo admin_url('users.php?status=awaiting_email_confirmation'); ?>"><?php echo UM()->query()->count_users_by_status('awaiting_email_confirmation'); ?></a></td>
|
||||
<td class="last t"><a href="<?php echo admin_url('users.php?status=awaiting_email_confirmation'); ?>" class="warning"><?php _e('Awaiting E-mail Confirmation','ultimate-member'); ?></a></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="first b"><a href="<?php echo admin_url('users.php?status=inactive'); ?>"><?php echo UM()->query()->count_users_by_status('inactive'); ?></a></td>
|
||||
<td class="t"><a href="<?php echo admin_url('users.php?status=inactive'); ?>"><?php _e('Inactive','ultimate-member'); ?></a></td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
</div><div class="um-admin-clear"></div>
|
||||
@@ -0,0 +1,17 @@
|
||||
<div class="um-admin-metabox">
|
||||
|
||||
<?php UM()->admin_forms( array(
|
||||
'class' => 'um-member-directory-appearance um-top-label',
|
||||
'prefix_id' => 'um_metadata',
|
||||
'fields' => array(
|
||||
array(
|
||||
'id' => '_um_directory_template',
|
||||
'type' => 'select',
|
||||
'name' => '_um_directory_template',
|
||||
'label' => __( 'Template', 'ultimate-member' ),
|
||||
'value' => UM()->query()->get_meta_value( '_um_directory_template', null, um_get_option( 'directory_template' ) ),
|
||||
'options' => UM()->shortcodes()->get_templates( 'members' ),
|
||||
)
|
||||
)
|
||||
) )->render_form(); ?>
|
||||
</div>
|
||||
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
$meta = get_post_custom( get_the_ID() );
|
||||
foreach( $meta as $k => $v ) {
|
||||
if ( strstr( $k, '_um_' ) && !is_array( $v[0] ) ) {
|
||||
//print "'$k' => '" . $v[0] . "',<br />";
|
||||
}
|
||||
}
|
||||
|
||||
$roles_array = array();
|
||||
|
||||
foreach ( UM()->roles()->get_roles() as $key => $value ) {
|
||||
if ( ! empty( UM()->query()->get_meta_value( '_um_roles', $key ) ) )
|
||||
$roles_array[] = UM()->query()->get_meta_value( '_um_roles', $key );
|
||||
}
|
||||
|
||||
$show_these_users = get_post_meta( get_the_ID(), '_um_show_these_users', true );
|
||||
if ( $show_these_users ) {
|
||||
$show_these_users = implode( "\n", str_replace( "\r", "", $show_these_users ) );
|
||||
} ?>
|
||||
|
||||
<div class="um-admin-metabox">
|
||||
|
||||
<?php $fields = array(
|
||||
array(
|
||||
'id' => '_um_mode',
|
||||
'type' => 'hidden',
|
||||
'name' => '_um_mode',
|
||||
'value' => 'directory',
|
||||
),
|
||||
array(
|
||||
'id' => '_um_roles',
|
||||
'type' => 'select',
|
||||
'name' => '_um_roles',
|
||||
'label' => __( 'User Roles to Display', 'ultimate-member' ),
|
||||
'tooltip' => __( 'If you do not want to show all members, select only user roles to appear in this directory', 'ultimate-member' ),
|
||||
'options' => UM()->roles()->get_roles(),
|
||||
'multi' => true,
|
||||
'value' => $roles_array,
|
||||
),
|
||||
array(
|
||||
'id' => '_um_has_profile_photo',
|
||||
'type' => 'checkbox',
|
||||
'name' => '_um_has_profile_photo',
|
||||
'label' => __( 'Only show members who have uploaded a profile photo', 'ultimate-member' ),
|
||||
'tooltip' => __( 'If \'Use Gravatars\' as profile photo is enabled, this option is ignored', 'ultimate-member' ),
|
||||
'value' => UM()->query()->get_meta_value( '_um_has_profile_photo' ),
|
||||
),
|
||||
array(
|
||||
'id' => '_um_has_cover_photo',
|
||||
'type' => 'checkbox',
|
||||
'name' => '_um_has_cover_photo',
|
||||
'label' => __( 'Only show members who have uploaded a cover photo', 'ultimate-member' ),
|
||||
'value' => UM()->query()->get_meta_value( '_um_has_cover_photo' ),
|
||||
),
|
||||
array(
|
||||
'id' => '_um_sortby',
|
||||
'type' => 'select',
|
||||
'name' => '_um_sortby',
|
||||
'label' => __( 'Sort users by', 'ultimate-member' ),
|
||||
'tooltip' => __( 'Sort users by a specific parameter in the directory', 'ultimate-member' ),
|
||||
'options' => apply_filters( 'um_admin_directory_sort_users_select', array(
|
||||
'user_registered_desc' => __( 'New users first', 'ultimate-member' ),
|
||||
'user_registered_asc' => __( 'Old users first', 'ultimate-member' ),
|
||||
'last_login' => __( 'Last login', 'ultimate-member' ),
|
||||
'display_name' => __( 'Display Name', 'ultimate-member' ),
|
||||
'first_name' => __( 'First Name', 'ultimate-member' ),
|
||||
'last_name' => __( 'Last Name', 'ultimate-member' ),
|
||||
'random' => __( 'Random', 'ultimate-member' ),
|
||||
'other' => __( 'Other (custom field)', 'ultimate-member' ),
|
||||
) ),
|
||||
'value' => UM()->query()->get_meta_value( '_um_sortby' ),
|
||||
),
|
||||
array(
|
||||
'id' => '_um_sortby_custom',
|
||||
'type' => 'text',
|
||||
'name' => '_um_sortby_custom',
|
||||
'label' => __( 'Meta key', 'ultimate-member' ),
|
||||
'tooltip' => __( 'To sort by a custom field, enter the meta key of field here', 'ultimate-member' ),
|
||||
'value' => UM()->query()->get_meta_value( '_um_sortby_custom', null, 'na' ),
|
||||
'conditional' => array( '_um_sortby', '=', 'other' )
|
||||
),
|
||||
array(
|
||||
'id' => '_um_show_these_users',
|
||||
'type' => 'textarea',
|
||||
'name' => '_um_show_these_users',
|
||||
'label' => __( 'Only show specific users (Enter one username per line)', 'ultimate-member' ),
|
||||
'value' => $show_these_users,
|
||||
)
|
||||
);
|
||||
|
||||
$fields = apply_filters( 'um_admin_extend_directory_options_general', $fields );
|
||||
|
||||
UM()->admin_forms( array(
|
||||
'class' => 'um-member-directory-general um-half-column',
|
||||
'prefix_id' => 'um_metadata',
|
||||
'fields' => $fields
|
||||
) )->render_form(); ?>
|
||||
|
||||
<div class="um-admin-clear"></div>
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,38 @@
|
||||
<div class="um-admin-metabox">
|
||||
|
||||
<?php UM()->admin_forms( array(
|
||||
'class' => 'um-member-directory-pagination um-half-column',
|
||||
'prefix_id' => 'um_metadata',
|
||||
'fields' => array(
|
||||
array(
|
||||
'id' => '_um_profiles_per_page',
|
||||
'type' => 'text',
|
||||
'name' => '_um_profiles_per_page',
|
||||
'label' => __( 'Number of profiles per page', 'ultimate-member' ),
|
||||
'tooltip' => __( 'Number of profiles to appear on page for standard users', 'ultimate-member' ),
|
||||
'value' => UM()->query()->get_meta_value( '_um_profiles_per_page', null, 12 ),
|
||||
'size' => 'small'
|
||||
),
|
||||
array(
|
||||
'id' => '_um_profiles_per_page_mobile',
|
||||
'type' => 'text',
|
||||
'name' => '_um_profiles_per_page_mobile',
|
||||
'label' => __( 'Number of profiles per page (for Mobiles & Tablets)', 'ultimate-member' ),
|
||||
'tooltip' => __( 'Number of profiles to appear on page for mobile users', 'ultimate-member' ),
|
||||
'value' => UM()->query()->get_meta_value( '_um_profiles_per_page_mobile', null, 8 ),
|
||||
'size' => 'small'
|
||||
),
|
||||
array(
|
||||
'id' => '_um_max_users',
|
||||
'type' => 'text',
|
||||
'name' => '_um_max_users',
|
||||
'label' => __( 'Maximum number of profiles', 'ultimate-member' ),
|
||||
'tooltip' => __( 'Use this setting to control the maximum number of profiles to appear in this directory. Leave blank to disable this limit', 'ultimate-member' ),
|
||||
'value' => UM()->query()->get_meta_value( '_um_max_users', null, 'na' ),
|
||||
'size' => 'small'
|
||||
)
|
||||
)
|
||||
) )->render_form(); ?>
|
||||
|
||||
<div class="um-admin-clear"></div>
|
||||
</div>
|
||||
@@ -0,0 +1,95 @@
|
||||
<div class="um-admin-metabox">
|
||||
|
||||
<?php
|
||||
$user_fields = array();
|
||||
foreach ( UM()->builtin()->all_user_fields() as $key => $arr ) {
|
||||
$user_fields[$key] = isset( $arr['title'] ) ? $arr['title'] : '';
|
||||
}
|
||||
|
||||
$post_id = get_the_ID();
|
||||
$_um_tagline_fields = get_post_meta( $post_id, '_um_tagline_fields', true );
|
||||
$_um_reveal_fields = get_post_meta( $post_id, '_um_reveal_fields', true );
|
||||
|
||||
UM()->admin_forms( array(
|
||||
'class' => 'um-member-directory-profile um-half-column',
|
||||
'prefix_id' => 'um_metadata',
|
||||
'fields' => array(
|
||||
array(
|
||||
'id' => '_um_profile_photo',
|
||||
'type' => 'checkbox',
|
||||
'name' => '_um_profile_photo',
|
||||
'label' => __( 'Enable Profile Photo', 'ultimate-member' ),
|
||||
'value' => UM()->query()->get_meta_value( '_um_profile_photo', null, 1 ),
|
||||
),
|
||||
array(
|
||||
'id' => '_um_cover_photos',
|
||||
'type' => 'checkbox',
|
||||
'name' => '_um_cover_photos',
|
||||
'label' => __( 'Enable Cover Photo', 'ultimate-member' ),
|
||||
'tooltip' => __( 'If turned on, the users cover photo will appear in the directory', 'ultimate-member' ),
|
||||
'value' => UM()->query()->get_meta_value( '_um_cover_photos', null, 1 ),
|
||||
),
|
||||
array(
|
||||
'id' => '_um_show_name',
|
||||
'type' => 'checkbox',
|
||||
'name' => '_um_show_name',
|
||||
'label' => __( 'Show display name', 'ultimate-member' ),
|
||||
'value' => UM()->query()->get_meta_value( '_um_show_name', null, 1 ),
|
||||
),
|
||||
array(
|
||||
'id' => '_um_show_tagline',
|
||||
'type' => 'checkbox',
|
||||
'name' => '_um_show_tagline',
|
||||
'label' => __( 'Show tagline below profile name', 'ultimate-member' ),
|
||||
'value' => UM()->query()->get_meta_value( '_um_show_tagline' ),
|
||||
),
|
||||
array(
|
||||
'id' => '_um_tagline_fields',
|
||||
'type' => 'multi_selects',
|
||||
'name' => '_um_tagline_fields',
|
||||
'label' => __( 'Choose field(s) to display in tagline', 'ultimate-member' ),
|
||||
'value' => $_um_tagline_fields,
|
||||
'conditional' => array( '_um_show_tagline', '=', 1 ),
|
||||
'add_text' => __( 'Add New Custom Field','ultimate-member' ),
|
||||
'options' => $user_fields,
|
||||
'show_default_number' => 1,
|
||||
),
|
||||
array(
|
||||
'id' => '_um_show_userinfo',
|
||||
'type' => 'checkbox',
|
||||
'name' => '_um_show_userinfo',
|
||||
'label' => __( 'Show extra user information below tagline?', 'ultimate-member' ),
|
||||
'value' => UM()->query()->get_meta_value( '_um_show_userinfo' ),
|
||||
),
|
||||
array(
|
||||
'id' => '_um_userinfo_animate',
|
||||
'type' => 'checkbox',
|
||||
'name' => '_um_userinfo_animate',
|
||||
'label' => __( 'Enable reveal section transition by default', 'ultimate-member' ),
|
||||
'value' => UM()->query()->get_meta_value( '_um_userinfo_animate' ),
|
||||
'conditional' => array( '_um_show_userinfo', '=', 1 )
|
||||
),
|
||||
array(
|
||||
'id' => '_um_reveal_fields',
|
||||
'type' => 'multi_selects',
|
||||
'name' => '_um_reveal_fields',
|
||||
'label' => __( 'Choose field(s) to display in reveal section', 'ultimate-member' ),
|
||||
'value' => $_um_reveal_fields,
|
||||
'add_text' => __( 'Add New Custom Field', 'ultimate-member' ),
|
||||
'conditional' => array( '_um_show_userinfo', '=', 1 ),
|
||||
'options' => $user_fields,
|
||||
'show_default_number' => 1,
|
||||
),
|
||||
array(
|
||||
'id' => '_um_show_social',
|
||||
'type' => 'checkbox',
|
||||
'name' => '_um_show_social',
|
||||
'label' => __( 'Show social connect icons', 'ultimate-member' ),
|
||||
'value' => UM()->query()->get_meta_value( '_um_show_social' ),
|
||||
'conditional' => array( '_um_show_userinfo', '=', 1 )
|
||||
)
|
||||
)
|
||||
) )->render_form(); ?>
|
||||
|
||||
<div class="um-admin-clear"></div>
|
||||
</div>
|
||||
@@ -0,0 +1,94 @@
|
||||
<div class="um-admin-metabox">
|
||||
<?php
|
||||
$can_search_array = array();
|
||||
foreach ( UM()->roles()->get_roles() as $key => $value ) {
|
||||
if ( ! empty( UM()->query()->get_meta_value( '_um_roles_can_search', $key ) ) )
|
||||
$can_search_array[] = UM()->query()->get_meta_value( '_um_roles_can_search', $key );
|
||||
}
|
||||
|
||||
$custom_search = apply_filters( 'um_admin_custom_search_filters', array() );
|
||||
$searchable_fields = UM()->builtin()->all_user_fields('date,time,url');
|
||||
$searchable_fields = $searchable_fields + $custom_search;
|
||||
$user_fields = array();
|
||||
foreach ( $searchable_fields as $key => $arr ) {
|
||||
$user_fields[$key] = isset( $arr['title'] ) ? $arr['title'] : '';
|
||||
}
|
||||
|
||||
$post_id = get_the_ID();
|
||||
$_um_search_fields = get_post_meta( $post_id, '_um_search_fields', true );
|
||||
|
||||
UM()->admin_forms( array(
|
||||
'class' => 'um-member-directory-search um-half-column',
|
||||
'prefix_id' => 'um_metadata',
|
||||
'fields' => array(
|
||||
array(
|
||||
'id' => '_um_search',
|
||||
'type' => 'checkbox',
|
||||
'name' => '_um_search',
|
||||
'label' => __( 'Enable Search feature', 'ultimate-member' ),
|
||||
'tooltip' => __( 'If turned on, users will be able to search members in this directory', 'ultimate-member' ),
|
||||
'value' => UM()->query()->get_meta_value( '_um_search' ),
|
||||
),
|
||||
array(
|
||||
'id' => '_um_must_search',
|
||||
'type' => 'checkbox',
|
||||
'name' => '_um_must_search',
|
||||
'label' => __( 'Show results only after search', 'ultimate-member' ),
|
||||
'tooltip' => __( 'If turned on, member results will only appear after search is performed', 'ultimate-member' ),
|
||||
'value' => UM()->query()->get_meta_value( '_um_must_search' ),
|
||||
'conditional' => array( '_um_search', '=', 1 )
|
||||
),
|
||||
array(
|
||||
'id' => '_um_roles_can_search',
|
||||
'type' => 'select',
|
||||
'multi' => true,
|
||||
'name' => '_um_roles_can_search',
|
||||
'label' => __( 'User Roles that can use search', 'ultimate-member' ),
|
||||
'tooltip' => __( 'If you want to allow specific user roles to be able to search only', 'ultimate-member' ),
|
||||
'value' => $can_search_array,
|
||||
'options' => UM()->roles()->get_roles(),
|
||||
'conditional' => array( '_um_search', '=', 1 )
|
||||
),
|
||||
array(
|
||||
'id' => '_um_search_fields',
|
||||
'type' => 'multi_selects',
|
||||
'name' => '_um_search_fields',
|
||||
'label' => __( 'Choose field(s) to enable in search', 'ultimate-member' ),
|
||||
'value' => $_um_search_fields,
|
||||
'conditional' => array( '_um_search', '=', 1 ),
|
||||
'options' => $user_fields,
|
||||
'add_text' => __( 'Add New Custom Field','ultimate-member' ),
|
||||
'show_default_number' => 1,
|
||||
),
|
||||
array(
|
||||
'id' => '_um_directory_header',
|
||||
'type' => 'text',
|
||||
'name' => '_um_directory_header',
|
||||
'label' => __( 'Results Text', 'ultimate-member' ),
|
||||
'tooltip' => __( 'Customize the search result text . e.g. Found 3,000 Members. Leave this blank to not show result text', 'ultimate-member' ),
|
||||
'value' => UM()->query()->get_meta_value('_um_directory_header', null, __('{total_users} Members','ultimate-member') ),
|
||||
'conditional' => array( '_um_search', '=', 1 )
|
||||
),
|
||||
array(
|
||||
'id' => '_um_directory_header_single',
|
||||
'type' => 'text',
|
||||
'name' => '_um_directory_header_single',
|
||||
'label' => __( 'Single Result Text', 'ultimate-member' ),
|
||||
'tooltip' => __( 'Same as above but in case of 1 user found only', 'ultimate-member' ),
|
||||
'value' => UM()->query()->get_meta_value('_um_directory_header_single', null, __('{total_users} Member','ultimate-member') ),
|
||||
'conditional' => array( '_um_search', '=', 1 )
|
||||
),
|
||||
array(
|
||||
'id' => '_um_directory_no_users',
|
||||
'type' => 'text',
|
||||
'name' => '_um_directory_no_users',
|
||||
'label' => __( 'Custom text if no users were found', 'ultimate-member' ),
|
||||
'tooltip' => __( 'This is the text that is displayed if no users are found during a search', 'ultimate-member' ),
|
||||
'value' => UM()->query()->get_meta_value('_um_directory_no_users', null, __('We are sorry. We cannot find any users who match your search criteria.','ultimate-member') ),
|
||||
'conditional' => array( '_um_search', '=', 1 )
|
||||
)
|
||||
)
|
||||
) )->render_form(); ?>
|
||||
|
||||
<div class="um-admin-clear"></div>
|
||||
</div>
|
||||
@@ -0,0 +1,5 @@
|
||||
<div class="um-admin-metabox">
|
||||
|
||||
<p><?php echo UM()->shortcodes()->get_shortcode( get_the_ID() ); ?></p>
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,214 @@
|
||||
<?php
|
||||
$premium['bbpress'] = array(
|
||||
'url' => 'https://ultimatemember.com/extensions/bbpress/',
|
||||
'image' => 'https://ultimatemember.com/wp-content/uploads/edd/2017/05/bbpress.png',
|
||||
'name' => 'bbPress',
|
||||
'desc' => 'With the bbPress extension you can integrate Ultimate Member with bbPress',
|
||||
);
|
||||
|
||||
$premium['profile-completeness'] = array(
|
||||
'url' => 'https://ultimatemember.com/extensions/profile-completeness/',
|
||||
'image' => 'https://ultimatemember.com/wp-content/uploads/edd/2017/05/profile-completeness.png',
|
||||
'name' => 'Profile Completeness',
|
||||
'desc' => 'Encourage or force users to complete their profile on your site',
|
||||
);
|
||||
|
||||
$premium['verified-users'] = array(
|
||||
'url' => 'https://ultimatemember.com/extensions/verified-users/',
|
||||
'image' => 'https://ultimatemember.com/wp-content/uploads/edd/2017/05/verified-users.png',
|
||||
'name' => 'Verified Users',
|
||||
'desc' => 'Add a user verficiation system to your site so user accounts can be verified',
|
||||
);
|
||||
|
||||
$premium['friends'] = array(
|
||||
'url' => 'https://ultimatemember.com/extensions/friends/',
|
||||
'image' => 'https://ultimatemember.com/wp-content/uploads/edd/2017/05/friends.png',
|
||||
'name' => 'Friends',
|
||||
'desc' => 'Increase user interaction on your site by allowing users to become friends',
|
||||
);
|
||||
|
||||
$premium['woocommerce'] = array(
|
||||
'url' => 'https://ultimatemember.com/extensions/woocommerce/',
|
||||
'image' => 'https://ultimatemember.com/wp-content/uploads/edd/2017/05/woocommerce.png',
|
||||
'name' => 'WooCommerce',
|
||||
'desc' => 'Integrates the popular e-commerce plugin WooCommerce with Ultimate Member',
|
||||
);
|
||||
|
||||
$premium['notices'] = array(
|
||||
'url' => 'https://ultimatemember.com/extensions/notices/',
|
||||
'image' => 'https://ultimatemember.com/wp-content/uploads/edd/2017/05/notices.png',
|
||||
'name' => 'Notices',
|
||||
'desc' => 'Alert users to important information using conditional notices',
|
||||
);
|
||||
|
||||
$premium['followers'] = array(
|
||||
'url' => 'https://ultimatemember.com/extensions/followers/',
|
||||
'image' => 'https://ultimatemember.com/wp-content/uploads/edd/2017/05/follow.png',
|
||||
'name' => 'Followers',
|
||||
'desc' => 'Increase user interaction on your site by allowing users to follow each other',
|
||||
);
|
||||
|
||||
$premium['mycred'] = array(
|
||||
'url' => 'https://ultimatemember.com/extensions/mycred/',
|
||||
'image' => 'https://ultimatemember.com/wp-content/uploads/edd/2017/05/mycred.png',
|
||||
'name' => 'myCRED',
|
||||
'desc' => 'With the myCRED extension you can integrate Ultimate Member with myCRED',
|
||||
);
|
||||
|
||||
$premium['private-messages'] = array(
|
||||
'url' => 'https://ultimatemember.com/extensions/private-messages/',
|
||||
'image' => 'https://ultimatemember.com/wp-content/uploads/edd/2017/05/private-messages.png',
|
||||
'name' => 'Private Messages',
|
||||
'desc' => 'Add a private messaging system to your site & allow users to message each other',
|
||||
);
|
||||
|
||||
$premium['social-activity'] = array(
|
||||
'url' => 'https://ultimatemember.com/extensions/social-activity/',
|
||||
'image' => 'https://ultimatemember.com/wp-content/uploads/edd/2017/05/social-activity.png',
|
||||
'name' => 'Social Activity',
|
||||
'desc' => 'Let users create public wall posts & see the activity of other users',
|
||||
);
|
||||
|
||||
$premium['social-login'] = array(
|
||||
'url' => 'https://ultimatemember.com/extensions/social-login/',
|
||||
'image' => 'https://ultimatemember.com/wp-content/uploads/edd/2017/05/social-login.png',
|
||||
'name' => 'Social Login',
|
||||
'desc' => 'Let users register & login to your site via Facebook, Twitter, G+, LinkedIn, and more',
|
||||
);
|
||||
|
||||
$premium['instagram'] = array(
|
||||
'url' => 'https://ultimatemember.com/extensions/instagram/',
|
||||
'image' => 'https://ultimatemember.com/wp-content/uploads/edd/2017/05/instagram.png',
|
||||
'name' => 'Instagram',
|
||||
'desc' => 'Allow users to show their Instagram photos on their profile',
|
||||
);
|
||||
|
||||
$premium['user-tags'] = array(
|
||||
'url' => 'https://ultimatemember.com/extensions/user-tags/',
|
||||
'image' => 'https://ultimatemember.com/wp-content/uploads/edd/2017/05/usertags.png',
|
||||
'name' => 'User Tags',
|
||||
'desc' => 'With this extension you can add a user tag system to your website',
|
||||
);
|
||||
|
||||
|
||||
$premium['mailchimp'] = array(
|
||||
'url' => 'https://ultimatemember.com/extensions/mailchimp/',
|
||||
'image' => 'https://ultimatemember.com/wp-content/uploads/edd/2017/05/mailchimp.png',
|
||||
'name' => 'MailChimp',
|
||||
'desc' => 'Allow users to subscribe to your mailchimp lists when they signup on your site',
|
||||
);
|
||||
|
||||
|
||||
$premium['user-reviews'] = array(
|
||||
'url' => 'https://ultimatemember.com/extensions/user-reviews/',
|
||||
'image' => 'https://ultimatemember.com/wp-content/uploads/edd/2017/05/user-reviews.png',
|
||||
'name' => 'User Reviews',
|
||||
'desc' => 'Allow users to rate & review each other using a 5 star rate/review system',
|
||||
);
|
||||
|
||||
$premium['real-time-notifications'] = array(
|
||||
'url' => 'https://ultimatemember.com/extensions/real-time-notifications/',
|
||||
'image' => 'https://ultimatemember.com/wp-content/uploads/edd/2017/05/notifications.png',
|
||||
'name' => 'Real-time Notifications',
|
||||
'desc' => 'Add a notifications system to your site so users can receive real-time notifications',
|
||||
);
|
||||
|
||||
|
||||
$free['online-users'] = array(
|
||||
'url' => 'https://ultimatemember.com/extensions/online-users/',
|
||||
'image' => 'https://ultimatemember.com/wp-content/uploads/edd/2017/07/Online-Users.png',
|
||||
'name' => 'Online Users',
|
||||
'desc' => 'Display online users on your site so users can see who is online'
|
||||
);
|
||||
|
||||
$free['google-recaptcha'] = array(
|
||||
'url' => 'https://ultimatemember.com/extensions/google-recaptcha/',
|
||||
'image' => 'https://ultimatemember.com/wp-content/uploads/edd/2017/07/google.png',
|
||||
'name' => 'Google reCAPTCHA',
|
||||
'desc' => 'Stop bots on your registration & login forms with Google reCAPTCHA',
|
||||
);
|
||||
|
||||
$free['terms-conditions'] = array(
|
||||
'url' => 'https://ultimatemember.com/extensions/terms-conditions/',
|
||||
'image' => 'https://ultimatemember.com/wp-content/uploads/edd/2017/07/terms-conditions.png',
|
||||
'name' => 'Terms & Conditions',
|
||||
'desc' => 'Add terms & conditions to your registration form',
|
||||
);
|
||||
|
||||
?>
|
||||
|
||||
<div id="um-extensions-wrap" class="wrap">
|
||||
|
||||
<h2>Ultimate Member - Extensions</h2>
|
||||
|
||||
<div class="wp-filter um-admin-notice um-filter">
|
||||
<div class="alignleft"><strong>Core Extensions Bundle</strong> – Check out our extensions bundle which includes all extensions at a significant discount.</div>
|
||||
<div class="alignright"><a href="https://ultimatemember.com/core-extensions-bundle/" class="button button-primary" target="_blank">View our Extensions Bundle</a></div>
|
||||
</div>
|
||||
|
||||
<div class="wp-filter">
|
||||
<ul class="filter-links">
|
||||
<li><a href='?page=ultimatemember-extensions&filter=premium' class='<?php if ( !isset($_REQUEST['filter']) || isset( $_REQUEST['filter'] ) && $_REQUEST['filter'] == 'premium' ) { echo 'current'; } ?>'>Premium</a></li>
|
||||
<li><a href='?page=ultimatemember-extensions&filter=free' class='<?php if ( isset( $_REQUEST['filter'] ) && $_REQUEST['filter'] == 'free' ) { echo 'current'; } ?>'>Free</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="wp-list-table widefat plugin-install">
|
||||
<div id="the-list">
|
||||
|
||||
<?php if ( !isset($_REQUEST['filter']) || isset( $_REQUEST['filter'] ) && $_REQUEST['filter'] == 'premium' ) { ?>
|
||||
|
||||
<?php foreach( $premium as $key => $info ) { ?>
|
||||
|
||||
<div class="plugin-card">
|
||||
<a href="<?php echo $info['url']; ?>" class="plugin-image"><img src="<?php echo $info['image']; ?>" /></a>
|
||||
<div class="plugin-card-top">
|
||||
<h3><a href="<?php echo $info['url']; ?>"><?php echo $info['name']; ?></a></h3>
|
||||
|
||||
<div class="desc column-description">
|
||||
<?php echo $info['desc']; ?>
|
||||
</div>
|
||||
|
||||
<div class="action-links">
|
||||
<ul class="plugin-action-buttons">
|
||||
<li><a class="install-now button" href="<?php echo $info['url']; ?>">Get this Add on</a></li>
|
||||
<li><a href="<?php echo $info['url']; ?>">More Details</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php }
|
||||
|
||||
} ?>
|
||||
|
||||
<?php if ( isset( $_REQUEST['filter'] ) && $_REQUEST['filter'] == 'free' ) { ?>
|
||||
|
||||
<?php foreach( $free as $key => $info ) { ?>
|
||||
|
||||
<div class="plugin-card">
|
||||
<a href="<?php echo $info['url']; ?>" class="plugin-image"><img src="<?php echo $info['image']; ?>" /></a>
|
||||
<div class="plugin-card-top">
|
||||
<h3><a href="<?php echo $info['url']; ?>"><?php echo $info['name']; ?></a></h3>
|
||||
|
||||
<div class="desc column-description">
|
||||
<?php echo $info['desc']; ?>
|
||||
</div>
|
||||
|
||||
<div class="action-links">
|
||||
<ul class="plugin-action-buttons">
|
||||
<li><a class="install-now button" href="<?php echo $info['url']; ?>">Get this Add on</a></li>
|
||||
<li><a href="<?php echo $info['url']; ?>">More Details</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php }
|
||||
|
||||
} ?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div><div class="um-admin-clear"></div>
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
if ( empty( UM()->builder()->form_id ) ) {
|
||||
UM()->builder()->form_id = $this->form_id;
|
||||
}
|
||||
?>
|
||||
|
||||
<div class="um-admin-builder" data-form_id="<?php echo UM()->builder()->form_id; ?>">
|
||||
|
||||
<div class="um-admin-drag-ctrls-demo um-admin-drag-ctrls">
|
||||
|
||||
<a href="#" class="active" data-modal="UM_preview_form" data-modal-size="smaller" data-dynamic-content="um_admin_preview_form" data-arg1="<?php the_ID(); ?>" data-arg2=""><?php _e('Live Preview','ultimate-member'); ?></a>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="um-admin-clear"></div>
|
||||
|
||||
<div class="um-admin-drag">
|
||||
|
||||
<div class="um-admin-drag-ajax" data-form_id="<?php echo UM()->builder()->form_id; ?>">
|
||||
|
||||
<?php UM()->builder()->show_builder(); ?>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="um-admin-drag-addrow um-admin-tipsy-n" title="<?php _e('Add Master Row','ultimate-member'); ?>" data-row_action="add_row"><i class="um-icon-plus"></i></div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,87 @@
|
||||
<div class="um-admin-metabox">
|
||||
<?php UM()->admin_forms( array(
|
||||
'class' => 'um-form-login-customize um-top-label',
|
||||
'prefix_id' => 'form',
|
||||
'fields' => array(
|
||||
array(
|
||||
'id' => '_um_login_use_globals',
|
||||
'type' => 'select',
|
||||
'label' => __( 'Apply custom settings to this form', 'ultimate-member' ),
|
||||
'tooltip' => __( 'Switch to yes if you want to customize this form settings, styling & appearance', 'ultimate-member' ),
|
||||
'value' => UM()->query()->get_meta_value( '_um_login_use_globals', null, 0 ),
|
||||
'options' => array(
|
||||
0 => __( 'No', 'ultimate-member' ),
|
||||
1 => __( 'Yes', 'ultimate-member' ),
|
||||
),
|
||||
),
|
||||
array(
|
||||
'id' => '_um_login_template',
|
||||
'type' => 'select',
|
||||
'label' => __( 'Template', 'ultimate-member' ),
|
||||
'value' => UM()->query()->get_meta_value( '_um_login_template', null, um_get_option( 'login_template' ) ),
|
||||
'options' => UM()->shortcodes()->get_templates( 'login' ),
|
||||
'conditional' => array( '_um_login_use_globals', '=', 1 )
|
||||
),
|
||||
array(
|
||||
'id' => '_um_login_max_width',
|
||||
'type' => 'text',
|
||||
'label' => __( 'Max. Width (px)', 'ultimate-member' ),
|
||||
'tooltip' => __( 'The maximum width of shortcode in pixels e.g. 600px', 'ultimate-member' ),
|
||||
'value' => UM()->query()->get_meta_value('_um_login_max_width', null, um_get_option( 'login_max_width' ) ),
|
||||
'conditional' => array( '_um_login_use_globals', '=', 1 )
|
||||
),
|
||||
array(
|
||||
'id' => '_um_login_icons',
|
||||
'type' => 'select',
|
||||
'label' => __( 'Field Icons', 'ultimate-member' ),
|
||||
'tooltip' => __( 'Whether to show field icons and where to show them relative to the field', 'ultimate-member' ),
|
||||
'value' => UM()->query()->get_meta_value( '_um_login_icons', null, um_get_option( 'login_icons' ) ) ,
|
||||
'options' => array(
|
||||
'field' => __( 'Show inside text field', 'ultimate-member' ),
|
||||
'label' => __( 'Show with label', 'ultimate-member' ),
|
||||
'off' => __( 'Turn off', 'ultimate-member' )
|
||||
),
|
||||
'conditional' => array( '_um_login_use_globals', '=', 1 )
|
||||
),
|
||||
array(
|
||||
'id' => '_um_login_primary_btn_word',
|
||||
'type' => 'text',
|
||||
'label' => __( 'Primary Button Text', 'ultimate-member' ),
|
||||
'tooltip' => __( 'Customize the button text', 'ultimate-member' ),
|
||||
'value' => UM()->query()->get_meta_value( '_um_login_primary_btn_word', null, um_get_option( 'login_primary_btn_word' ) ),
|
||||
'conditional' => array( '_um_login_use_globals', '=', 1 )
|
||||
),
|
||||
array(
|
||||
'id' => '_um_login_secondary_btn',
|
||||
'type' => 'checkbox',
|
||||
'label' => __( 'Show Secondary Button', 'ultimate-member' ),
|
||||
'value' => UM()->query()->get_meta_value( '_um_login_secondary_btn', null, 1 ),
|
||||
'conditional' => array( '_um_login_use_globals', '=', 1 )
|
||||
),
|
||||
array(
|
||||
'id' => '_um_login_secondary_btn_word',
|
||||
'type' => 'text',
|
||||
'label' => __( 'Primary Button Text', 'ultimate-member' ),
|
||||
'tooltip' => __( 'Customize the button text', 'ultimate-member' ),
|
||||
'value' => UM()->query()->get_meta_value( '_um_login_secondary_btn_word', null, um_get_option( 'login_secondary_btn_word' ) ),
|
||||
'conditional' => array( '_um_login_secondary_btn', '=', 1 )
|
||||
),
|
||||
array(
|
||||
'id' => '_um_login_forgot_pass_link',
|
||||
'type' => 'checkbox',
|
||||
'label' => __( 'Show Forgot Password Link?', 'ultimate-member' ),
|
||||
'value' => UM()->query()->get_meta_value( '_um_login_forgot_pass_link', null, um_get_option('login_forgot_pass_link') ),
|
||||
'conditional' => array( '_um_login_use_globals', '=', 1 )
|
||||
),
|
||||
array(
|
||||
'id' => '_um_login_show_rememberme',
|
||||
'type' => 'checkbox',
|
||||
'label' => __( 'Show "Remember Me"?', 'ultimate-member' ),
|
||||
'value' => UM()->query()->get_meta_value( '_um_login_show_rememberme', null, um_get_option('login_show_rememberme') ),
|
||||
'conditional' => array( '_um_login_use_globals', '=', 1 )
|
||||
),
|
||||
)
|
||||
) )->render_form(); ?>
|
||||
|
||||
<div class="um-admin-clear"></div>
|
||||
</div>
|
||||
@@ -0,0 +1,32 @@
|
||||
<div class="um-admin-metabox">
|
||||
|
||||
<?php UM()->admin_forms( array(
|
||||
'class' => 'um-form-login-settings um-top-label',
|
||||
'prefix_id' => 'form',
|
||||
'fields' => array(
|
||||
array(
|
||||
'id' => '_um_login_after_login',
|
||||
'type' => 'select',
|
||||
'label' => __( 'Redirection after Login', 'ultimate-member' ),
|
||||
'tooltip' => __( 'Change this If you want to override role redirection settings after login only.', 'ultimate-member' ),
|
||||
'value' => UM()->query()->get_meta_value( '_um_login_after_login', null, 0 ),
|
||||
'options' => array(
|
||||
'0' => __( 'Default', 'ultimate-member' ),
|
||||
'redirect_profile' => __( 'Redirect to profile', 'ultimate-member' ),
|
||||
'redirect_url' => __( 'Redirect to URL', 'ultimate-member' ),
|
||||
'refresh' => __( 'Refresh active page', 'ultimate-member' ),
|
||||
'redirect_admin' => __( 'Redirect to WordPress Admin', 'ultimate-member' ),
|
||||
),
|
||||
),
|
||||
array(
|
||||
'id' => '_um_login_redirect_url',
|
||||
'type' => 'text',
|
||||
'label' => __( 'Set Custom Redirect URL', 'ultimate-member' ),
|
||||
'value' => UM()->query()->get_meta_value('_um_login_redirect_url', null, 'na' ),
|
||||
'conditional' => array( '_um_login_after_login', '=', 'redirect_url' )
|
||||
)
|
||||
)
|
||||
) )->render_form(); ?>
|
||||
|
||||
<div class="um-admin-clear"></div>
|
||||
</div>
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php $is_core = get_post_meta( get_the_ID(), '_um_core', true ); ?>
|
||||
|
||||
<div class="um-admin-boxed-links um-admin-ajaxlink <?php if ( $is_core ) echo 'is-core-form'; ?>">
|
||||
|
||||
<?php if ( $is_core ) { ?>
|
||||
<p><?php _e('<strong>Note:</strong> Form type cannot be changed for the default forms.','ultimate-member'); ?></p>
|
||||
<?php } ?>
|
||||
|
||||
<a href="#" data-role="register"><?php _e('Registration Form','ultimate-member'); ?></a>
|
||||
|
||||
<a href="#" data-role="profile"><?php _e('Profile Form','ultimate-member'); ?></a>
|
||||
|
||||
<a href="#" data-role="login"><?php _e('Login Form','ultimate-member'); ?></a>
|
||||
|
||||
<input type="hidden" name="_um_mode" id="_um_mode" value="<?php echo UM()->query()->get_meta_value('_um_mode', null, 'register' ); ?>" />
|
||||
|
||||
</div><div class="um-admin-clear"></div>
|
||||
@@ -0,0 +1,154 @@
|
||||
<div class="um-admin-metabox">
|
||||
|
||||
<?php
|
||||
foreach ( UM()->roles()->get_roles( __( 'All roles', 'ultimate-member' ) ) as $key => $value ) {
|
||||
if ( ! empty( UM()->query()->get_meta_value( '_um_profile_role', $key ) ) )
|
||||
$profile_role = UM()->query()->get_meta_value( '_um_profile_role', $key );
|
||||
}
|
||||
|
||||
UM()->admin_forms( array(
|
||||
'class' => 'um-form-profile-customize um-top-label',
|
||||
'prefix_id' => 'form',
|
||||
'fields' => array(
|
||||
array(
|
||||
'id' => '_um_profile_use_globals',
|
||||
'type' => 'select',
|
||||
'label' => __( 'Apply custom settings to this form', 'ultimate-member' ),
|
||||
'tooltip' => __( 'Switch to yes if you want to customize this form settings, styling & appearance', 'ultimate-member' ),
|
||||
'value' => UM()->query()->get_meta_value( '_um_profile_use_globals', null, 0 ),
|
||||
'options' => array(
|
||||
0 => __( 'No', 'ultimate-member' ),
|
||||
1 => __( 'Yes', 'ultimate-member' ),
|
||||
),
|
||||
),
|
||||
array(
|
||||
'id' => '_um_profile_role',
|
||||
'type' => 'select',
|
||||
'label' => __( 'Make this profile role-specific', 'ultimate-member' ),
|
||||
'value' => ! empty( $profile_role ) ? $profile_role : 0,
|
||||
'options' => UM()->roles()->get_roles( __( 'All roles', 'ultimate-member' ) ),
|
||||
'conditional' => array( '_um_profile_use_globals', '=', 1 )
|
||||
),
|
||||
array(
|
||||
'id' => '_um_profile_template',
|
||||
'type' => 'select',
|
||||
'label' => __( 'Template', 'ultimate-member' ),
|
||||
'value' => UM()->query()->get_meta_value( '_um_profile_template', null, um_get_option( 'profile_template' ) ),
|
||||
'options' => UM()->shortcodes()->get_templates( 'profile' ),
|
||||
'conditional' => array( '_um_profile_use_globals', '=', 1 )
|
||||
),
|
||||
array(
|
||||
'id' => '_um_profile_max_width',
|
||||
'type' => 'text',
|
||||
'label' => __( 'Max. Width (px)', 'ultimate-member' ),
|
||||
'tooltip' => __( 'The maximum width of shortcode in pixels e.g. 600px', 'ultimate-member' ),
|
||||
'value' => UM()->query()->get_meta_value('_um_profile_max_width', null, um_get_option( 'profile_max_width' ) ),
|
||||
'conditional' => array( '_um_profile_use_globals', '=', 1 )
|
||||
),
|
||||
array(
|
||||
'id' => '_um_profile_area_max_width',
|
||||
'type' => 'text',
|
||||
'label' => __( 'Profile Area Max. Width (px)', 'ultimate-member' ),
|
||||
'tooltip' => __( 'The maximum width of the profile area inside profile (below profile header)', 'ultimate-member' ),
|
||||
'value' => UM()->query()->get_meta_value('_um_profile_area_max_width', null, um_get_option( 'profile_area_max_width' ) ),
|
||||
'conditional' => array( '_um_profile_use_globals', '=', 1 )
|
||||
),
|
||||
array(
|
||||
'id' => '_um_profile_icons',
|
||||
'type' => 'select',
|
||||
'label' => __( 'Field Icons', 'ultimate-member' ),
|
||||
'tooltip' => __( 'Whether to show field icons and where to show them relative to the field', 'ultimate-member' ),
|
||||
'value' => UM()->query()->get_meta_value( '_um_profile_icons', null, um_get_option( 'profile_icons' ) ) ,
|
||||
'options' => array(
|
||||
'field' => __( 'Show inside text field', 'ultimate-member' ),
|
||||
'label' => __( 'Show with label', 'ultimate-member' ),
|
||||
'off' => __( 'Turn off', 'ultimate-member' )
|
||||
),
|
||||
'conditional' => array( '_um_profile_use_globals', '=', 1 )
|
||||
),
|
||||
array(
|
||||
'id' => '_um_profile_primary_btn_word',
|
||||
'type' => 'text',
|
||||
'label' => __( 'Primary Button Text', 'ultimate-member' ),
|
||||
'tooltip' => __( 'Customize the button text', 'ultimate-member' ),
|
||||
'value' => UM()->query()->get_meta_value( '_um_profile_primary_btn_word', null, um_get_option( 'profile_primary_btn_word' ) ),
|
||||
'conditional' => array( '_um_profile_use_globals', '=', 1 )
|
||||
),
|
||||
array(
|
||||
'id' => '_um_profile_secondary_btn',
|
||||
'type' => 'checkbox',
|
||||
'label' => __( 'Show Secondary Button', 'ultimate-member' ),
|
||||
'value' => UM()->query()->get_meta_value( '_um_profile_secondary_btn', null, 1 ),
|
||||
'conditional' => array( '_um_profile_use_globals', '=', 1 )
|
||||
),
|
||||
array(
|
||||
'id' => '_um_profile_secondary_btn_word',
|
||||
'type' => 'text',
|
||||
'label' => __( 'Primary Button Text', 'ultimate-member' ),
|
||||
'tooltip' => __( 'Customize the button text', 'ultimate-member' ),
|
||||
'value' => UM()->query()->get_meta_value( '_um_profile_secondary_btn_word', null, um_get_option( 'profile_secondary_btn_word' ) ),
|
||||
'conditional' => array( '_um_profile_secondary_btn', '=', 1 )
|
||||
),
|
||||
array(
|
||||
'id' => '_um_profile_cover_enabled',
|
||||
'type' => 'checkbox',
|
||||
'label' => __( 'Enable Cover Photos', 'ultimate-member' ),
|
||||
'value' => UM()->query()->get_meta_value( '_um_profile_cover_enabled', null, 1 ),
|
||||
'conditional' => array( '_um_profile_use_globals', '=', 1 )
|
||||
),
|
||||
array(
|
||||
'id' => '_um_profile_cover_ratio',
|
||||
'type' => 'select',
|
||||
'label' => __( 'Cover photo ratio', 'ultimate-member' ),
|
||||
'tooltip' => __( 'The shortcode is centered by default unless you specify otherwise here', 'ultimate-member' ),
|
||||
'value' => UM()->query()->get_meta_value( '_um_profile_cover_ratio', null, um_get_option( 'profile_cover_ratio' ) ),
|
||||
'options' => array(
|
||||
'2.7:1' => '2.7:1',
|
||||
'2.2:1' => '2.2:1',
|
||||
'3.2:1' => '3.2:1'
|
||||
),
|
||||
'conditional' => array( '_um_profile_cover_enabled', '=', 1 )
|
||||
),
|
||||
array(
|
||||
'id' => '_um_profile_photosize',
|
||||
'type' => 'text',
|
||||
'label' => __( 'Profile Photo Size', 'ultimate-member' ),
|
||||
'tooltip' => __( 'Set the profile photo size in pixels here', 'ultimate-member' ),
|
||||
'value' => UM()->query()->get_meta_value( '_um_profile_photosize', null, um_get_option( 'profile_photosize' ) ),
|
||||
'conditional' => array( '_um_profile_use_globals', '=', 1 )
|
||||
),
|
||||
array(
|
||||
'id' => '_um_profile_photo_required',
|
||||
'type' => 'checkbox',
|
||||
'label' => __( 'Make Profile Photo Required', 'ultimate-member' ),
|
||||
'tooltip' => __( 'Require user to update a profile photo when updating their profile', 'ultimate-member' ),
|
||||
'value' => UM()->query()->get_meta_value( '_um_profile_photo_required' ),
|
||||
'conditional' => array( '_um_profile_use_globals', '=', 1 )
|
||||
),
|
||||
array(
|
||||
'id' => '_um_profile_show_name',
|
||||
'type' => 'checkbox',
|
||||
'label' => __( 'Show display name in profile header?', 'ultimate-member' ),
|
||||
'value' => UM()->query()->get_meta_value( '_um_profile_show_name', null, 1 ),
|
||||
'conditional' => array( '_um_profile_use_globals', '=', 1 )
|
||||
),
|
||||
array(
|
||||
'id' => '_um_profile_show_social_links',
|
||||
'type' => 'checkbox',
|
||||
'label' => __( 'Show social links in profile header?', 'ultimate-member' ),
|
||||
'value' => UM()->query()->get_meta_value( '_um_profile_show_social_links', null, 0 ),
|
||||
'conditional' => array( '_um_profile_use_globals', '=', 1 )
|
||||
),
|
||||
array(
|
||||
'id' => '_um_profile_show_bio',
|
||||
'type' => 'checkbox',
|
||||
'label' => __( 'Show user description in profile header?', 'ultimate-member' ),
|
||||
'value' => UM()->query()->get_meta_value( '_um_profile_show_bio', null, 1 ),
|
||||
'conditional' => array( '_um_profile_use_globals', '=', 1 )
|
||||
),
|
||||
|
||||
)
|
||||
) )->render_form(); ?>
|
||||
|
||||
<div class="um-admin-clear"></div>
|
||||
</div>
|
||||
@@ -0,0 +1,27 @@
|
||||
<div class="um-admin-metabox">
|
||||
<?php $user_fields = array();
|
||||
foreach ( UM()->builtin()->all_user_fields() as $key => $arr ) {
|
||||
$user_fields[$key] = isset( $arr['title'] ) ? $arr['title'] : '';
|
||||
}
|
||||
|
||||
$post_id = get_the_ID();
|
||||
$_um_search_fields = get_post_meta( $post_id, '_um_profile_metafields', true );
|
||||
|
||||
UM()->admin_forms( array(
|
||||
'class' => 'um-form-profile-settings um-top-label',
|
||||
'prefix_id' => 'form',
|
||||
'fields' => array(
|
||||
array(
|
||||
'id' => '_um_profile_metafields',
|
||||
'type' => 'multi_selects',
|
||||
'label' => __( 'Field(s) to show in user meta', 'ultimate-member' ),
|
||||
'value' => $_um_search_fields,
|
||||
'options' => $user_fields,
|
||||
'add_text' => __( 'Add New Field', 'ultimate-member' ),
|
||||
'show_default_number' => 1,
|
||||
)
|
||||
)
|
||||
) )->render_form(); ?>
|
||||
|
||||
<div class="um-admin-clear"></div>
|
||||
</div>
|
||||
@@ -0,0 +1,88 @@
|
||||
<div class="um-admin-metabox">
|
||||
|
||||
<?php
|
||||
foreach ( UM()->roles()->get_roles( __( 'Default', 'ultimate-member' ) ) as $key => $value ) {
|
||||
if ( ! empty( UM()->query()->get_meta_value( '_um_register_role', $key ) ) )
|
||||
$register_role = UM()->query()->get_meta_value( '_um_register_role', $key );
|
||||
}
|
||||
|
||||
UM()->admin_forms( array(
|
||||
'class' => 'um-form-register-customize um-top-label',
|
||||
'prefix_id' => 'form',
|
||||
'fields' => array(
|
||||
array(
|
||||
'id' => '_um_register_use_globals',
|
||||
'type' => 'select',
|
||||
'label' => __( 'Apply custom settings to this form', 'ultimate-member' ),
|
||||
'tooltip' => __( 'Switch to yes if you want to customize this form settings, styling & appearance', 'ultimate-member' ),
|
||||
'value' => UM()->query()->get_meta_value( '_um_register_use_globals', null, 0 ),
|
||||
'options' => array(
|
||||
0 => __( 'No', 'ultimate-member' ),
|
||||
1 => __( 'Yes', 'ultimate-member' ),
|
||||
),
|
||||
),
|
||||
array(
|
||||
'id' => '_um_register_role',
|
||||
'type' => 'select',
|
||||
'label' => __( 'Assign role to form', 'ultimate-member' ),
|
||||
'value' => ! empty( $register_role ) ? $register_role : 0,
|
||||
'options' => UM()->roles()->get_roles( __( 'Default', 'ultimate-member' ) ),
|
||||
'conditional' => array( '_um_register_use_globals', '=', 1 )
|
||||
),
|
||||
array(
|
||||
'id' => '_um_register_template',
|
||||
'type' => 'select',
|
||||
'label' => __( 'Template', 'ultimate-member' ),
|
||||
'value' => UM()->query()->get_meta_value( '_um_register_template', null, um_get_option( 'register_template' ) ),
|
||||
'options' => UM()->shortcodes()->get_templates( 'register' ),
|
||||
'conditional' => array( '_um_register_use_globals', '=', 1 )
|
||||
),
|
||||
array(
|
||||
'id' => '_um_register_max_width',
|
||||
'type' => 'text',
|
||||
'label' => __( 'Max. Width (px)', 'ultimate-member' ),
|
||||
'tooltip' => __( 'The maximum width of shortcode in pixels e.g. 600px', 'ultimate-member' ),
|
||||
'value' => UM()->query()->get_meta_value('_um_register_max_width', null, um_get_option( 'register_max_width' ) ),
|
||||
'conditional' => array( '_um_register_use_globals', '=', 1 )
|
||||
),
|
||||
array(
|
||||
'id' => '_um_register_icons',
|
||||
'type' => 'select',
|
||||
'label' => __( 'Field Icons', 'ultimate-member' ),
|
||||
'tooltip' => __( 'Whether to show field icons and where to show them relative to the field', 'ultimate-member' ),
|
||||
'value' => UM()->query()->get_meta_value( '_um_register_icons', null, um_get_option( 'register_icons' ) ) ,
|
||||
'options' => array(
|
||||
'field' => __( 'Show inside text field', 'ultimate-member' ),
|
||||
'label' => __( 'Show with label', 'ultimate-member' ),
|
||||
'off' => __( 'Turn off', 'ultimate-member' )
|
||||
),
|
||||
'conditional' => array( '_um_register_use_globals', '=', 1 )
|
||||
),
|
||||
array(
|
||||
'id' => '_um_register_primary_btn_word',
|
||||
'type' => 'text',
|
||||
'label' => __( 'Primary Button Text', 'ultimate-member' ),
|
||||
'tooltip' => __( 'Customize the button text', 'ultimate-member' ),
|
||||
'value' => UM()->query()->get_meta_value( '_um_register_primary_btn_word', null, um_get_option( 'register_primary_btn_word' ) ),
|
||||
'conditional' => array( '_um_register_use_globals', '=', 1 )
|
||||
),
|
||||
array(
|
||||
'id' => '_um_register_secondary_btn',
|
||||
'type' => 'checkbox',
|
||||
'label' => __( 'Show Secondary Button', 'ultimate-member' ),
|
||||
'value' => UM()->query()->get_meta_value( '_um_register_secondary_btn', null, 1 ),
|
||||
'conditional' => array( '_um_register_use_globals', '=', 1 )
|
||||
),
|
||||
array(
|
||||
'id' => '_um_register_secondary_btn_word',
|
||||
'type' => 'text',
|
||||
'label' => __( 'Primary Button Text', 'ultimate-member' ),
|
||||
'tooltip' => __( 'Customize the button text', 'ultimate-member' ),
|
||||
'value' => UM()->query()->get_meta_value( '_um_register_secondary_btn_word', null, um_get_option( 'register_secondary_btn_word' ) ),
|
||||
'conditional' => array( '_um_register_secondary_btn', '=', 1 )
|
||||
)
|
||||
)
|
||||
) )->render_form(); ?>
|
||||
|
||||
<div class="um-admin-clear"></div>
|
||||
</div>
|
||||
@@ -0,0 +1,5 @@
|
||||
<div class="um-admin-metabox">
|
||||
|
||||
<p><?php echo UM()->shortcodes()->get_shortcode( get_the_ID() ); ?></p>
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,20 @@
|
||||
<div id="UM_edit_field" style="display:none">
|
||||
|
||||
<form action="" method="post" class="um_add_field">
|
||||
|
||||
<div class="um-admin-modal-head">
|
||||
<h3><?php _e('Edit Field','ultimate-member'); ?></h3>
|
||||
</div>
|
||||
|
||||
<div class="um-admin-modal-body um-admin-metabox">
|
||||
|
||||
</div>
|
||||
|
||||
<div class="um-admin-modal-foot">
|
||||
<input type="submit" value="<?php _e('Update','ultimate-member'); ?>" class="button-primary" />
|
||||
<a href="#" data-action="UM_remove_modal" class="button"><?php _e('Cancel','ultimate-member'); ?></a>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,20 @@
|
||||
<div id="UM_edit_row" style="display:none">
|
||||
|
||||
<form action="" method="post" class="um_add_field">
|
||||
|
||||
<div class="um-admin-modal-head">
|
||||
<h3><?php _e('Edit Row Settings','ultimate-member'); ?></h3>
|
||||
</div>
|
||||
|
||||
<div class="um-admin-modal-body um-admin-metabox">
|
||||
|
||||
</div>
|
||||
|
||||
<div class="um-admin-modal-foot">
|
||||
<input type="submit" value="<?php _e('Update','ultimate-member'); ?>" class="button-primary" />
|
||||
<a href="#" data-action="UM_remove_modal" class="button"><?php _e('Cancel','ultimate-member'); ?></a>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,15 @@
|
||||
<div id="UM_preview_form" style="display:none">
|
||||
|
||||
<div class="um-admin-modal-head">
|
||||
<h3><?php _e('Live Form Preview','ultimate-member'); ?></h3>
|
||||
</div>
|
||||
|
||||
<div class="um-admin-modal-body">
|
||||
|
||||
</div>
|
||||
|
||||
<div class="um-admin-modal-foot">
|
||||
<a href="#" class="button-primary" data-action="UM_remove_modal"><?php _e('Continue editing','ultimate-member'); ?></a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,20 @@
|
||||
<div id="UM_add_divider" style="display:none">
|
||||
|
||||
<form action="" method="post" class="um_add_field">
|
||||
|
||||
<div class="um-admin-modal-head">
|
||||
<h3><?php _e('Add a New Divider','ultimate-member'); ?></h3>
|
||||
</div>
|
||||
|
||||
<div class="um-admin-modal-body um-admin-metabox">
|
||||
|
||||
</div>
|
||||
|
||||
<div class="um-admin-modal-foot">
|
||||
<input type="submit" value="<?php _e('Add','ultimate-member'); ?>" class="button-primary" />
|
||||
<a href="#" data-action="UM_remove_modal" class="button"><?php _e('Cancel','ultimate-member'); ?></a>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,20 @@
|
||||
<div id="UM_add_field" style="display:none">
|
||||
|
||||
<form action="" method="post" class="um_add_field">
|
||||
|
||||
<div class="um-admin-modal-head">
|
||||
<h3><?php _e('Add a New Field','ultimate-member'); ?></h3>
|
||||
</div>
|
||||
|
||||
<div class="um-admin-modal-body um-admin-metabox">
|
||||
|
||||
</div>
|
||||
|
||||
<div class="um-admin-modal-foot">
|
||||
<input type="submit" value="<?php _e('Add','ultimate-member'); ?>" class="button-primary" />
|
||||
<a href="#" data-modal="UM_fields" class="button"><?php _e('Cancel','ultimate-member'); ?></a>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,20 @@
|
||||
<div id="UM_add_group" style="display:none">
|
||||
|
||||
<form action="" method="post" class="um_add_field">
|
||||
|
||||
<div class="um-admin-modal-head">
|
||||
<h3><?php _e('Add a New Field Group','ultimate-member'); ?></h3>
|
||||
</div>
|
||||
|
||||
<div class="um-admin-modal-body um-admin-metabox">
|
||||
|
||||
</div>
|
||||
|
||||
<div class="um-admin-modal-foot">
|
||||
<input type="submit" value="<?php _e('Add','ultimate-member'); ?>" class="button-primary" />
|
||||
<a href="#" data-action="UM_remove_modal" class="button"><?php _e('Cancel','ultimate-member'); ?></a>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,15 @@
|
||||
<div id="UM_preview_registration" style="display:none">
|
||||
|
||||
<div class="um-admin-modal-head">
|
||||
<h3><?php _e('Review Registration Details','ultimate-member'); ?></h3>
|
||||
</div>
|
||||
|
||||
<div class="um-admin-modal-body">
|
||||
|
||||
</div>
|
||||
|
||||
<div class="um-admin-modal-foot">
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,11 @@
|
||||
<div id="UM_fields" style="display:none">
|
||||
|
||||
<div class="um-admin-modal-head">
|
||||
<h3><?php _e('Fields Manager','ultimate-member'); ?></h3>
|
||||
</div>
|
||||
|
||||
<div class="um-admin-modal-body">
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,16 @@
|
||||
<div id="UM_fonticons" style="display:none">
|
||||
|
||||
<div class="um-admin-modal-head">
|
||||
<h3><?php printf(__('Choose from %s available icons','ultimate-member'), count( UM()->fonticons()->all ) ); ?></h3>
|
||||
</div>
|
||||
|
||||
<div class="um-admin-modal-body">
|
||||
|
||||
</div>
|
||||
|
||||
<div class="um-admin-modal-foot">
|
||||
<a href="#" class="button-primary um-admin-modal-back" data-code="">Finish</a>
|
||||
<a href="#" class="button um-admin-modal-back um-admin-modal-cancel">Cancel</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,64 @@
|
||||
<div class="um-admin-metabox">
|
||||
<?php $role = $object['data'];
|
||||
|
||||
UM()->admin_forms( array(
|
||||
'class' => 'um-role-admin um-half-column',
|
||||
'prefix_id' => 'role',
|
||||
'fields' => array(
|
||||
array(
|
||||
'id' => '_um_can_access_wpadmin',
|
||||
'type' => 'checkbox',
|
||||
'name' => '_um_can_access_wpadmin',
|
||||
'label' => __( 'Can access wp-admin?', 'ultimate-member' ),
|
||||
'tooltip' => __( 'The core admin role must always have access to wp-admin / WordPress backend', 'ultimate-member' ),
|
||||
'value' => ! empty( $role['_um_can_access_wpadmin'] ) ? $role['_um_can_access_wpadmin'] : 0,
|
||||
),
|
||||
array(
|
||||
'id' => '_um_can_not_see_adminbar',
|
||||
'type' => 'checkbox',
|
||||
'name' => '_um_can_not_see_adminbar',
|
||||
'label' => __( 'Force hiding adminbar in frontend?', 'ultimate-member' ),
|
||||
'tooltip' => __( 'Show/hide the adminbar on frontend', 'ultimate-member' ),
|
||||
'value' => ! empty( $role['_um_can_not_see_adminbar'] ) ? $role['_um_can_not_see_adminbar'] : 0,
|
||||
),
|
||||
array(
|
||||
'id' => '_um_can_edit_everyone',
|
||||
'type' => 'checkbox',
|
||||
'name' => '_um_can_edit_everyone',
|
||||
'label' => __( 'Can edit other member accounts?', 'ultimate-member' ),
|
||||
'tooltip' => __( 'Allow this role to edit accounts of other members', 'ultimate-member' ),
|
||||
'value' => ! empty( $role['_um_can_edit_everyone'] ) ? $role['_um_can_edit_everyone'] : 0,
|
||||
),
|
||||
array(
|
||||
'id' => '_um_can_edit_roles',
|
||||
'type' => 'select',
|
||||
'name' => '_um_can_edit_roles',
|
||||
'label' => __( 'Can edit these user roles only', 'ultimate-member' ),
|
||||
'tooltip' => __( 'Which roles that role can edit, choose none to allow role to edit all member roles', 'ultimate-member' ),
|
||||
'options' => UM()->roles()->get_roles(),
|
||||
'multi' => true,
|
||||
'value' => ! empty( $role['_um_can_edit_roles'] ) ? $role['_um_can_edit_roles'] : array(),
|
||||
'conditional' => array( '_um_can_edit_everyone', '=', '1' )
|
||||
),
|
||||
array(
|
||||
'id' => '_um_can_delete_everyone',
|
||||
'type' => 'checkbox',
|
||||
'name' => '_um_can_delete_everyone',
|
||||
'label' => __( 'Can delete other member accounts?', 'ultimate-member' ),
|
||||
'tooltip' => __( 'Allow this role to edit accounts of other members', 'ultimate-member' ),
|
||||
'value' => ! empty( $role['_um_can_delete_everyone'] ) ? $role['_um_can_delete_everyone'] : 0,
|
||||
),
|
||||
array(
|
||||
'id' => '_um_can_delete_roles',
|
||||
'type' => 'select',
|
||||
'name' => '_um_can_delete_roles',
|
||||
'label' => __( 'Can delete these user roles only', 'ultimate-member' ),
|
||||
'tooltip' => __( 'Which roles that role can edit, choose none to allow role to edit all member roles', 'ultimate-member' ),
|
||||
'options' => UM()->roles()->get_roles(),
|
||||
'multi' => true,
|
||||
'value' => ! empty( $role['_um_can_delete_roles'] ) ? $role['_um_can_delete_roles'] : array(),
|
||||
'conditional' => array( '_um_can_delete_everyone', '=', '1' )
|
||||
)
|
||||
)
|
||||
) )->render_form(); ?>
|
||||
</div>
|
||||
@@ -0,0 +1,33 @@
|
||||
<div class="um-admin-metabox">
|
||||
|
||||
<?php $role = $object['data'];
|
||||
|
||||
UM()->admin_forms( array(
|
||||
'class' => 'um-role-delete um-half-column',
|
||||
'prefix_id' => 'role',
|
||||
'fields' => array(
|
||||
array(
|
||||
'id' => '_um_after_delete',
|
||||
'type' => 'select',
|
||||
'name' => '_um_after_delete',
|
||||
'label' => __( 'Action to be taken after account is deleted', 'ultimate-member' ),
|
||||
'tooltip' => __( 'Select what happens when a user with this role deletes their own account', 'ultimate-member' ),
|
||||
'value' => ! empty( $role['_um_after_delete'] ) ? $role['_um_after_delete'] : array(),
|
||||
'options' => array(
|
||||
'redirect_home' => __( 'Go to Homepage', 'ultimate-member' ),
|
||||
'redirect_url' => __( 'Go to Custom URL', 'ultimate-member' ),
|
||||
)
|
||||
),
|
||||
array(
|
||||
'id' => '_um_delete_redirect_url',
|
||||
'type' => 'text',
|
||||
'name' => '_um_delete_redirect_url',
|
||||
'label' => __( 'Set Custom Redirect URL', 'ultimate-member' ),
|
||||
'tooltip' => __( 'Set a url to redirect this user role to after they delete account', 'ultimate-member' ),
|
||||
'value' => ! empty( $role['_um_delete_redirect_url'] ) ? $role['_um_delete_redirect_url'] : '',
|
||||
'conditional' => array( '_um_after_delete', '=', 'redirect_url' )
|
||||
)
|
||||
)
|
||||
) )->render_form(); ?>
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,26 @@
|
||||
<div class="um-admin-metabox">
|
||||
<?php $role = $object['data'];
|
||||
|
||||
UM()->admin_forms( array(
|
||||
'class' => 'um-role-general um-half-column',
|
||||
'prefix_id' => 'role',
|
||||
'fields' => array(
|
||||
array(
|
||||
'id' => '_um_can_edit_profile',
|
||||
'type' => 'checkbox',
|
||||
'name' => '_um_can_edit_profile',
|
||||
'label' => __( 'Can edit their profile?', 'ultimate-member' ),
|
||||
'tooltip' => __( 'Can this role edit his own profile?', 'ultimate-member' ),
|
||||
'value' => ! empty( $role['_um_can_edit_profile'] ) ? $role['_um_can_edit_profile'] : 0,
|
||||
),
|
||||
array(
|
||||
'id' => '_um_can_delete_profile',
|
||||
'type' => 'checkbox',
|
||||
'name' => '_um_can_delete_profile',
|
||||
'label' => __( 'Can delete their account?', 'ultimate-member' ),
|
||||
'tooltip' => __( 'Allow this role to delete their account and end their membership on your site', 'ultimate-member' ),
|
||||
'value' => ! empty( $role['_um_can_delete_profile'] ) ? $role['_um_can_delete_profile'] : 0,
|
||||
)
|
||||
)
|
||||
) )->render_form(); ?>
|
||||
</div>
|
||||
@@ -0,0 +1,29 @@
|
||||
<div class="um-admin-metabox">
|
||||
|
||||
<?php $role = $object['data'];
|
||||
|
||||
UM()->admin_forms( array(
|
||||
'class' => 'um-role-home um-half-column',
|
||||
'prefix_id' => 'role',
|
||||
'fields' => array(
|
||||
array(
|
||||
'id' => '_um_default_homepage',
|
||||
'type' => 'checkbox',
|
||||
'name' => '_um_default_homepage',
|
||||
'label' => __( 'Can view default homepage?', 'ultimate-member' ),
|
||||
'tooltip' => __( 'Allow this user role to view your site\'s homepage', 'ultimate-member' ),
|
||||
'value' => ! empty( $role['_um_default_homepage'] ) ? $role['_um_default_homepage'] : 0,
|
||||
),
|
||||
array(
|
||||
'id' => '_um_redirect_homepage',
|
||||
'type' => 'text',
|
||||
'name' => '_um_redirect_homepage',
|
||||
'label' => __( 'Custom Homepage Redirect', 'ultimate-member' ),
|
||||
'tooltip' => __( 'Set a url to redirect this user role to if they try to view your site\'s homepage', 'ultimate-member' ),
|
||||
'value' => ! empty( $role['_um_redirect_homepage'] ) ? $role['_um_redirect_homepage'] : '',
|
||||
'conditional' => array( '_um_default_homepage', '=', '0' )
|
||||
)
|
||||
)
|
||||
) )->render_form(); ?>
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,35 @@
|
||||
<div class="um-admin-metabox">
|
||||
|
||||
<?php $role = $object['data'];
|
||||
|
||||
UM()->admin_forms( array(
|
||||
'class' => 'um-role-login um-half-column',
|
||||
'prefix_id' => 'role',
|
||||
'fields' => array(
|
||||
array(
|
||||
'id' => '_um_after_login',
|
||||
'type' => 'select',
|
||||
'name' => '_um_after_login',
|
||||
'label' => __( 'Action to be taken after login', 'ultimate-member' ),
|
||||
'tooltip' => __( 'Select what happens when a user with this role logins to your site', 'ultimate-member' ),
|
||||
'value' => ! empty( $role['_um_after_login'] ) ? $role['_um_after_login'] : array(),
|
||||
'options' => array(
|
||||
'redirect_profile' => __( 'Redirect to profile', 'ultimate-member' ),
|
||||
'redirect_url' => __( 'Redirect to URL', 'ultimate-member' ),
|
||||
'refresh' => __( 'Refresh active page', 'ultimate-member' ),
|
||||
'redirect_admin' => __( 'Redirect to WordPress Admin', 'ultimate-member' )
|
||||
)
|
||||
),
|
||||
array(
|
||||
'id' => '_um_login_redirect_url',
|
||||
'type' => 'text',
|
||||
'name' => '_um_login_redirect_url',
|
||||
'label' => __( 'Set Custom Redirect URL', 'ultimate-member' ),
|
||||
'tooltip' => __( 'Set a url to redirect this user role to after they login with their account', 'ultimate-member' ),
|
||||
'value' => ! empty( $role['_um_login_redirect_url'] ) ? $role['_um_login_redirect_url'] : '',
|
||||
'conditional' => array( '_um_after_login', '=', 'redirect_url' )
|
||||
)
|
||||
)
|
||||
) )->render_form(); ?>
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,33 @@
|
||||
<div class="um-admin-metabox">
|
||||
|
||||
<?php $role = $object['data'];
|
||||
|
||||
UM()->admin_forms( array(
|
||||
'class' => 'um-role-logout um-half-column',
|
||||
'prefix_id' => 'role',
|
||||
'fields' => array(
|
||||
array(
|
||||
'id' => '_um_after_logout',
|
||||
'type' => 'select',
|
||||
'name' => '_um_after_logout',
|
||||
'label' => __( 'Action to be taken after logout', 'ultimate-member' ),
|
||||
'tooltip' => __( 'Select what happens when a user with this role logouts of your site', 'ultimate-member' ),
|
||||
'value' => ! empty( $role['_um_after_logout'] ) ? $role['_um_after_logout'] : array(),
|
||||
'options' => array(
|
||||
'redirect_home' => __( 'Go to Homepage', 'ultimate-member' ),
|
||||
'redirect_url' => __( 'Go to Custom URL', 'ultimate-member' ),
|
||||
)
|
||||
),
|
||||
array(
|
||||
'id' => '_um_logout_redirect_url',
|
||||
'type' => 'text',
|
||||
'name' => '_um_logout_redirect_url',
|
||||
'label' => __( 'Set Custom Redirect URL', 'ultimate-member' ),
|
||||
'tooltip' => __( 'Set a url to redirect this user role to after they logout from site', 'ultimate-member' ),
|
||||
'value' => ! empty( $role['_um_logout_redirect_url'] ) ? $role['_um_logout_redirect_url'] : '',
|
||||
'conditional' => array( '_um_after_logout', '=', 'redirect_url' )
|
||||
)
|
||||
)
|
||||
) )->render_form(); ?>
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,46 @@
|
||||
<div class="um-admin-metabox">
|
||||
<?php $role = $object['data'];
|
||||
|
||||
UM()->admin_forms( array(
|
||||
'class' => 'um-role-profile um-half-column',
|
||||
'prefix_id' => 'role',
|
||||
'fields' => array(
|
||||
array(
|
||||
'id' => '_um_can_view_all',
|
||||
'type' => 'checkbox',
|
||||
'name' => '_um_can_view_all',
|
||||
'label' => __( 'Can view other member profiles?', 'ultimate-member' ),
|
||||
'tooltip' => __( 'Can this role view all member profiles?', 'ultimate-member' ),
|
||||
'value' => ! empty( $role['_um_can_view_all'] ) ? $role['_um_can_view_all'] : 0,
|
||||
),
|
||||
array(
|
||||
'id' => '_um_can_view_roles',
|
||||
'type' => 'select',
|
||||
'name' => '_um_can_view_roles',
|
||||
'label' => __( 'Can view these user roles only', 'ultimate-member' ),
|
||||
'tooltip' => __( 'Which roles that role can view, choose none to allow role to view all member roles', 'ultimate-member' ),
|
||||
'options' => UM()->roles()->get_roles(),
|
||||
'multi' => true,
|
||||
'value' => ! empty( $role['_um_can_view_roles'] ) ? $role['_um_can_view_roles'] : array(),
|
||||
'conditional' => array( '_um_can_view_all', '=', '1' )
|
||||
),
|
||||
array(
|
||||
'id' => '_um_can_make_private_profile',
|
||||
'type' => 'checkbox',
|
||||
'name' => '_um_can_make_private_profile',
|
||||
'label' => __( 'Can make their profile private?', 'ultimate-member' ),
|
||||
'tooltip' => __( 'Can this role make their profile private?', 'ultimate-member' ),
|
||||
'value' => ! empty( $role['_um_can_make_private_profile'] ) ? $role['_um_can_make_private_profile'] : 0,
|
||||
),
|
||||
array(
|
||||
'id' => '_um_can_access_private_profile',
|
||||
'type' => 'checkbox',
|
||||
'name' => '_um_can_access_private_profile',
|
||||
'label' => __( 'Can view/access private profiles?', 'ultimate-member' ),
|
||||
'tooltip' => __( 'Can this role view private profiles?', 'ultimate-member' ),
|
||||
'value' => ! empty( $role['_um_can_access_private_profile'] ) ? $role['_um_can_access_private_profile'] : 0,
|
||||
)
|
||||
)
|
||||
) )->render_form(); ?>
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
?>
|
||||
|
||||
<div class="submitbox" id="submitpost">
|
||||
<div id="major-publishing-actions">
|
||||
<input type="submit" value="<?php echo ! empty( $_GET['id'] ) ? __( 'Update Role', 'ultimate-member' ) : __( 'Create Role', 'ultimate-member' ) ?>" class="button-primary" id="create_role" name="create_role">
|
||||
<input type="button" class="cancel_popup button" value="<?php _e( 'Cancel', 'ultimate-member' ) ?>" onclick="window.location = '<?php echo add_query_arg( array( 'page' => 'um_roles' ), admin_url( 'admin.php' ) ) ?>';" />
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,121 @@
|
||||
<div class="um-admin-metabox">
|
||||
<?php $role = $object['data'];
|
||||
|
||||
UM()->admin_forms( array(
|
||||
'class' => 'um-role-register um-half-column',
|
||||
'prefix_id' => 'role',
|
||||
'fields' => array(
|
||||
array(
|
||||
'id' => '_um_status',
|
||||
'type' => 'select',
|
||||
'name' => '_um_status',
|
||||
'label' => __( 'Registration Status', 'ultimate-member' ),
|
||||
'tooltip' => __( 'Select the status you would like this user role to have after they register on your site', 'ultimate-member' ),
|
||||
'value' => ! empty( $role['_um_status'] ) ? $role['_um_status'] : array(),
|
||||
'options' => array(
|
||||
'approved' => __( 'Auto Approve', 'ultimate-member' ),
|
||||
'checkmail' => __( 'Require Email Activation', 'ultimate-member' ),
|
||||
'pending' => __( 'Require Admin Review', 'ultimate-member' )
|
||||
),
|
||||
),
|
||||
array(
|
||||
'id' => '_um_auto_approve_act',
|
||||
'type' => 'select',
|
||||
'name' => '_um_auto_approve_act',
|
||||
'label' => __( 'Action to be taken after registration', 'ultimate-member' ),
|
||||
'tooltip' => __( 'Select what action is taken after a person registers on your site. Depending on the status you can redirect them to their profile, a custom url or show a custom message', 'ultimate-member' ),
|
||||
'value' => ! empty( $role['_um_auto_approve_act'] ) ? $role['_um_auto_approve_act'] : array(),
|
||||
'options' => array(
|
||||
'redirect_profile' => __( 'Redirect to profile', 'ultimate-member' ),
|
||||
'redirect_url' => __( 'Redirect to URL', 'ultimate-member' ),
|
||||
),
|
||||
'conditional' => array( '_um_status', '=', 'approved' )
|
||||
),
|
||||
array(
|
||||
'id' => '_um_auto_approve_url',
|
||||
'type' => 'text',
|
||||
'name' => '_um_auto_approve_url',
|
||||
'label' => __( 'Set Custom Redirect URL', 'ultimate-member' ),
|
||||
'value' => ! empty( $role['_um_auto_approve_url'] ) ? $role['_um_auto_approve_url'] : '',
|
||||
'conditional' => array( '_um_auto_approve_act', '=', 'redirect_url' )
|
||||
),
|
||||
array(
|
||||
'id' => '_um_login_email_activate',
|
||||
'type' => 'checkbox',
|
||||
'name' => '_um_login_email_activate',
|
||||
'label' => __( 'Login user after validating the activation link?', 'ultimate-member' ),
|
||||
'tooltip' => __( 'Login the user after validating the activation link', 'ultimate-member' ),
|
||||
'value' => ! empty( $role['_um_login_email_activate'] ) ? $role['_um_login_email_activate'] : 0,
|
||||
'conditional' => array( '_um_status', '=', 'checkmail' )
|
||||
),
|
||||
array(
|
||||
'id' => '_um_checkmail_action',
|
||||
'type' => 'select',
|
||||
'name' => '_um_checkmail_action',
|
||||
'label' => __( 'Action to be taken after registration', 'ultimate-member' ),
|
||||
'tooltip' => __( 'Select what action is taken after a person registers on your site. Depending on the status you can redirect them to their profile, a custom url or show a custom message', 'ultimate-member' ),
|
||||
'value' => ! empty( $role['_um_checkmail_action'] ) ? $role['_um_checkmail_action'] : array(),
|
||||
'options' => array(
|
||||
'show_message' => __( 'Show custom message', 'ultimate-member' ),
|
||||
'redirect_url' => __( 'Redirect to URL', 'ultimate-member' ),
|
||||
),
|
||||
'conditional' => array( '_um_status', '=', 'checkmail' )
|
||||
),
|
||||
array(
|
||||
'id' => '_um_checkmail_message',
|
||||
'type' => 'textarea',
|
||||
'name' => '_um_checkmail_message',
|
||||
'label' => __( 'Personalize the custom message', 'ultimate-member' ),
|
||||
'value' => ! empty( $role['_um_checkmail_message'] ) ? $role['_um_checkmail_message'] : '',
|
||||
'conditional' => array( '_um_checkmail_action', '=', 'show_message' )
|
||||
),
|
||||
array(
|
||||
'id' => '_um_checkmail_url',
|
||||
'type' => 'text',
|
||||
'name' => '_um_checkmail_url',
|
||||
'label' => __( 'Set Custom Redirect URL', 'ultimate-member' ),
|
||||
'value' => ! empty( $role['_um_checkmail_url'] ) ? $role['_um_checkmail_url'] : '',
|
||||
'conditional' => array( '_um_checkmail_action', '=', 'redirect_url' )
|
||||
),
|
||||
array(
|
||||
'id' => '_um_url_email_activate',
|
||||
'type' => 'text',
|
||||
'name' => '_um_url_email_activate',
|
||||
'label' => __( 'URL redirect after e-mail activation', 'ultimate-member' ),
|
||||
'tooltip' => __( 'If you want users to go to a specific page other than login page after e-mail activation, enter the URL here.', 'ultimate-member' ),
|
||||
'value' => ! empty( $role['_um_url_email_activate'] ) ? $role['_um_url_email_activate'] : '',
|
||||
'conditional' => array( '_um_status', '=', 'checkmail' ),
|
||||
),
|
||||
array(
|
||||
'id' => '_um_pending_action',
|
||||
'type' => 'select',
|
||||
'name' => '_um_pending_action',
|
||||
'label' => __( 'Action to be taken after registration', 'ultimate-member' ),
|
||||
'tooltip' => __( 'Select what action is taken after a person registers on your site. Depending on the status you can redirect them to their profile, a custom url or show a custom message', 'ultimate-member' ),
|
||||
'value' => ! empty( $role['_um_pending_action'] ) ? $role['_um_pending_action'] : array(),
|
||||
'options' => array(
|
||||
'show_message' => __( 'Show custom message', 'ultimate-member' ),
|
||||
'redirect_url' => __( 'Redirect to URL', 'ultimate-member' ),
|
||||
),
|
||||
'conditional' => array( '_um_status', '=', 'pending' )
|
||||
),
|
||||
array(
|
||||
'id' => '_um_pending_message',
|
||||
'type' => 'textarea',
|
||||
'name' => '_um_pending_message',
|
||||
'label' => __( 'Personalize the custom message', 'ultimate-member' ),
|
||||
'value' => ! empty( $role['_um_pending_message'] ) ? $role['_um_pending_message'] : '',
|
||||
'conditional' => array( '_um_pending_action', '=', 'show_message' )
|
||||
),
|
||||
array(
|
||||
'id' => '_um_pending_url',
|
||||
'type' => 'text',
|
||||
'name' => '_um_pending_url',
|
||||
'label' => __( 'Set Custom Redirect URL', 'ultimate-member' ),
|
||||
'conditional' => array( '_um_pending_action', '=', 'redirect_url' ),
|
||||
'value' => ! empty( $role['_um_pending_url'] ) ? $role['_um_pending_url'] : '',
|
||||
),
|
||||
)
|
||||
) )->render_form(); ?>
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,139 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
}
|
||||
|
||||
wp_enqueue_script( 'postbox' );
|
||||
wp_enqueue_media ();
|
||||
|
||||
do_action( 'um_roles_add_meta_boxes', 'um_role_meta', '' );
|
||||
do_action( 'um_roles_add_meta_boxes_um_role_meta' , '' );
|
||||
|
||||
$data = array();
|
||||
$option = array();
|
||||
global $wp_roles;
|
||||
|
||||
if ( ! empty( $_GET['id'] ) ) {
|
||||
$data = get_option( "um_role_{$_GET['id']}_meta" );
|
||||
|
||||
if ( empty( $data['_um_is_custom'] ) )
|
||||
$data['name'] = $wp_roles->roles[ $_GET['id'] ]['name'];
|
||||
}
|
||||
|
||||
|
||||
if ( ! empty( $_POST['role'] ) ) {
|
||||
|
||||
$data = $_POST['role'];
|
||||
|
||||
$id = '';
|
||||
$redirect = '';
|
||||
$error = '';
|
||||
|
||||
if ( empty( $data['name'] ) ) {
|
||||
|
||||
$error .= __( 'Title is empty!', 'ultimate-member' ) . '<br />';
|
||||
|
||||
} else {
|
||||
|
||||
if ( 'add' == $_GET['tab'] ) {
|
||||
$id = sanitize_title( $data['name'] );
|
||||
$redirect = add_query_arg( array( 'page'=>'um_roles', 'tab'=>'edit', 'id'=>$id, 'msg'=>'a' ), admin_url( 'admin.php' ) );
|
||||
} elseif ( 'edit' == $_GET['tab'] && ! empty( $_GET['id'] ) ) {
|
||||
$id = $_GET['id'];
|
||||
$redirect = add_query_arg( array( 'page' => 'um_roles', 'tab'=>'edit', 'id'=>$id, 'msg'=>'u' ), admin_url( 'admin.php' ) );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$all_roles = array_keys( get_editable_roles() );
|
||||
if ( 'add' == $_GET['tab'] ) {
|
||||
if ( in_array( 'um_' . $id, $all_roles ) )
|
||||
$error .= __( 'Role already exists!', 'ultimate-member' ) . '<br />';
|
||||
}
|
||||
|
||||
if ( '' == $error ) {
|
||||
|
||||
if ( 'add' == $_GET['tab'] ) {
|
||||
$roles = get_option( 'um_roles' );
|
||||
$roles[] = $id;
|
||||
|
||||
update_option( 'um_roles', $roles );
|
||||
}
|
||||
|
||||
$role_meta = $data;
|
||||
unset( $role_meta['id'] );
|
||||
|
||||
update_option( "um_role_{$id}_meta", $role_meta );
|
||||
|
||||
um_js_redirect( $redirect );
|
||||
}
|
||||
}
|
||||
|
||||
global $current_screen;
|
||||
$screen_id = $current_screen->id; ?>
|
||||
|
||||
<script type="text/javascript">
|
||||
jQuery( document ).ready( function() {
|
||||
postboxes.add_postbox_toggles( '<?php echo $screen_id; ?>' );
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class="wrap">
|
||||
<h2>
|
||||
<?php echo ( 'add' == $_GET['tab'] ) ? __( 'Add New Role', 'ultimate-member' ) : __( 'Edit Role', 'ultimate-member' ) ?>
|
||||
<?php if ( 'edit' == $_GET['tab'] ) { ?>
|
||||
<a class="add-new-h2" href="<?php echo add_query_arg( array( 'page' => 'um_roles', 'tab' => 'add' ), admin_url( 'admin.php' ) ) ?>"><?php _e( 'Add New', 'ultimate-member' ) ?></a>
|
||||
<?php } ?>
|
||||
</h2>
|
||||
|
||||
<?php if ( ! empty( $_GET['msg'] ) ) {
|
||||
switch( $_GET['msg'] ) {
|
||||
case 'a':
|
||||
echo '<div id="message" class="updated fade"><p>' . __( 'User Role <strong>Added</strong> Successfully.', 'ultimate-member' ) . '</p></div>';
|
||||
break;
|
||||
case 'u':
|
||||
echo '<div id="message" class="updated fade"><p>' . __( 'User Role <strong>Updated</strong> Successfully.', 'ultimate-member' ) . '</p></div>';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! empty( $error ) ) { ?>
|
||||
<div id="message" class="error fade">
|
||||
<p><?php echo $error ?></p>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<form id="um_edit_role" action="" method="post">
|
||||
<input type="hidden" name="role[id]" value="<?php echo isset( $_GET['id'] ) ? $_GET['id'] : '' ?>" />
|
||||
<?php if ( 'add' == $_GET['tab'] ) { ?>
|
||||
<input type="hidden" name="role[_um_is_custom]" value="1" />
|
||||
<?php } else { ?>
|
||||
<input type="hidden" name="role[_um_is_custom]" value="<?php echo ! empty( $data['_um_is_custom'] ) ? 1 : 0 ?>" />
|
||||
<?php } ?>
|
||||
<?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?>
|
||||
<div id="poststuff">
|
||||
<div id="post-body" class="metabox-holder columns-2">
|
||||
<div id="post-body-content">
|
||||
<div id="titlediv">
|
||||
<div id="titlewrap">
|
||||
<?php if ( 'add' == $_GET['tab'] ) { ?>
|
||||
<label for="title" class="screen-reader-text"><?php _e( 'Title', 'ultimate-member' ) ?></label>
|
||||
<span>UM </span><input type="text" name="role[name]" placeholder="<?php _e( 'Enter Title Here', 'ultimate-member' ) ?>" id="title" value="<?php echo isset( $data['name'] ) ? $data['name'] : '' ?>" />
|
||||
<?php } else { ?>
|
||||
<input type="hidden" name="role[name]" value="<?php echo isset( $data['name'] ) ? $data['name'] : '' ?>" />
|
||||
<span style="float: left;width:100%;"><?php if ( ! empty( $data['_um_is_custom'] ) ) { ?>UM <?php } ?><?php echo isset( $data['name'] ) ? $data['name'] : '' ?></span>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="postbox-container-1" class="postbox-container">
|
||||
<?php do_meta_boxes( 'um_role_meta', 'side', array( 'data' => $data, 'option' => $option ) ); ?>
|
||||
</div>
|
||||
<div id="postbox-container-2" class="postbox-container">
|
||||
<?php do_meta_boxes( 'um_role_meta', 'normal', array( 'data' => $data, 'option' => $option ) ); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@@ -0,0 +1,36 @@
|
||||
<div class="um-admin-metabox">
|
||||
<?php
|
||||
$role = $object['data'];
|
||||
$role_capabilities = ! empty( $role['wp_capabilities'] ) ? array_keys( $role['wp_capabilities'] ) : array();
|
||||
|
||||
if ( ! empty( $_GET['id'] ) ) {
|
||||
$role = get_role( $_GET['id'] );
|
||||
}
|
||||
|
||||
$all_caps = array();
|
||||
foreach ( get_editable_roles() as $role_info ) {
|
||||
if ( ! empty( $role_info['capabilities'] ) )
|
||||
$all_caps = array_merge( $all_caps, $role_info['capabilities'] );
|
||||
}
|
||||
|
||||
$fields = array();
|
||||
foreach ( array_keys( $all_caps ) as $cap ) {
|
||||
$fields[$cap] = $cap;
|
||||
}
|
||||
|
||||
UM()->admin_forms( array(
|
||||
'class' => 'um-role-wp-capabilities',
|
||||
'prefix_id' => 'role',
|
||||
'fields' => array(
|
||||
array(
|
||||
'id' => 'wp_capabilities',
|
||||
'type' => 'multi_checkbox',
|
||||
'name' => 'wp_capabilities',
|
||||
'options' => $fields,
|
||||
'value' => ! empty( $role_capabilities ) ? $role_capabilities : array(),
|
||||
'columns' => 3,
|
||||
'without_label' => true,
|
||||
)
|
||||
)
|
||||
) )->render_form(); ?>
|
||||
</div>
|
||||
@@ -0,0 +1,69 @@
|
||||
<?php include_once UM()->admin()->templates_path . 'welcome/about_header.php'; ?>
|
||||
|
||||
<div class="changelog">
|
||||
<h3>Create beautiful community websites with WordPress!</h3>
|
||||
<div class="feature-section">
|
||||
|
||||
<p>We'd like to thank you for installing Ultimate Member and we hope you enjoy using the plugin on your site. We created Ultimate Member with the aim of building a lightweight and powerful plugin that makes it extremely easy to make community and membership sites with WordPress.</p>
|
||||
|
||||
<p>We have big plans for Ultimate Member and we hope you will join us on our journey to creating the most popular community/membership plugin. The plugin has been built to be extremely easy to use but if you run into any issues you can search our <a href="http://docs.ultimatemember.com/" target="_blank">documentation</a> and if you can’t find an answer to your issue in our docs, then you can create a topic on the <a href="https://wordpress.org/support/plugin/ultimate-member" target="_blank">support forum</a>. We also have an official <a href="https://github.com/ultimatemember/ultimatemember" target="_blank">GitHub repository</a> where you can contribute directly to the plugin.</p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="changelog">
|
||||
|
||||
<h3>Key Features</h3>
|
||||
|
||||
<div class="feature-section under-the-hood three-col">
|
||||
|
||||
<div class="col">
|
||||
<h4>Front-end Registration & Login</h4>
|
||||
<p>Create unlimited, custom frontend registration & login forms easily with our drag-and-drop form builder.</p>
|
||||
</div>
|
||||
|
||||
<div class="col">
|
||||
<h4>User Profiles</h4>
|
||||
<p>Instant front-end user profiles that look beautiful. Allow users to view/edit profile from frontend, view each other's profile and more.</p>
|
||||
</div>
|
||||
|
||||
<div class="col">
|
||||
<h4>User Roles</h4>
|
||||
<p>Create unlimited, custom <a href="<?php echo admin_url('edit.php?post_type=um_role'); ?>">user roles</a> and set up permissions for each user role easily.</p>
|
||||
</div>
|
||||
|
||||
<div class="col">
|
||||
<h4>Profile Fields</h4>
|
||||
<p>Create unlimited profile fields from image and file upload to ratings, checkboxes, and more, plus support for <strong><em>conditional fields</em></strong></p>
|
||||
</div>
|
||||
|
||||
<div class="col">
|
||||
<h4>Member Directories</h4>
|
||||
<p>Create member directories with our <a href="<?php echo admin_url('edit.php?post_type=um_directory'); ?>">directory creator</a> and make them show the member levels you want.</p>
|
||||
</div>
|
||||
|
||||
<div class="col">
|
||||
<h4>Content Restriction</h4>
|
||||
<p>Global and individual (per page/post) content restriction settings have been built to give you flexibility on what content should be visible, and who exactly can see it.</p>
|
||||
</div>
|
||||
|
||||
<div class="col">
|
||||
<h4>Conditional Menus</h4>
|
||||
<p> Show different menu links to logged in users, logged out users, and individual member levels with our conditional menu feature.</p>
|
||||
</div>
|
||||
|
||||
<div class="col">
|
||||
<h4>Mobile Adaptive</h4>
|
||||
<p>Ultimate Member has been built with a mobile adaptive approach meaning the front-end features have a different layout depending on the device size.</p>
|
||||
</div>
|
||||
|
||||
<div class="col">
|
||||
<h4>Advanced Form Builder</h4>
|
||||
<p>Use our advanced drag and drop form builder to easily create unique registration, login and profiles with multiple-column support.</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<?php include_once UM()->admin()->templates_path . 'welcome/about_footer.php'; ?>
|
||||
@@ -0,0 +1,8 @@
|
||||
|
||||
<div class="return-to-dashboard">
|
||||
|
||||
<a href="<?php echo admin_url('admin.php?page=ultimatemember'); ?>">Go to Plugin Dashboard →</a>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||