Skip to content

Commit

Permalink
Merge pull request #927 from publishpress/release-v2.10.1
Browse files Browse the repository at this point in the history
Release v2.10.1
  • Loading branch information
olatechpro authored Oct 23, 2023
2 parents d78fafc + 3fa07e4 commit f9e05b8
Show file tree
Hide file tree
Showing 29 changed files with 855 additions and 532 deletions.
4 changes: 2 additions & 2 deletions capsman-enhanced.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: PublishPress Capabilities
* Plugin URI: https://publishpress.com/capability-manager/
* Description: Manage WordPress role definitions, per-site or network-wide. Organizes post capabilities by post type and operation.
* Version: 2.10.0
* Version: 2.10.1
* Author: PublishPress
* Author URI: https://publishpress.com/
* Text Domain: capsman-enhanced
Expand Down Expand Up @@ -69,7 +69,7 @@
add_action('plugins_loaded', function () {

if (!defined('CAPSMAN_VERSION')) {
define('CAPSMAN_VERSION', '2.10.0');
define('CAPSMAN_VERSION', '2.10.1');
define('CAPSMAN_ENH_VERSION', CAPSMAN_VERSION);
define('PUBLISHPRESS_CAPS_VERSION', CAPSMAN_VERSION);
}
Expand Down
54 changes: 7 additions & 47 deletions common/css/admin.css
Original file line number Diff line number Diff line change
Expand Up @@ -476,22 +476,10 @@ table#akmin tr td input[type=checkbox] {
border-bottom: none;
}

#pp-capability-menu-wrapper table td,
#pp-capability-menu-wrapper table th {
padding: 10px;
padding-bottom: 10px;
font-size: 13px;
line-height: 20px;
}

#pp-capability-menu-wrapper table td h4.ppc-menu-row-section {
margin-bottom: 0;
}

#pp-capability-menu-wrapper table td {
padding: 9px;
}

#pp-capability-menu-wrapper tbody tr:last-of-type td {
border-bottom: none;
}
Expand All @@ -501,16 +489,8 @@ table#akmin tr td input[type=checkbox] {
}


table#akmin .pp-capability-menus-select .restrict-column {
min-width: 90px;
text-align: center;
display: table-cell !important;
clear: none !important;
}


table#akmin .pp-capability-menus-select .restrict-column + .menu-column.ppc-menu-item:not(.frontend-features) {
width: 100%;
.pp-capability-menus-select .restrict-column {
width: 10px;
}

.pp-capability-menus .menu-item-link {
Expand Down Expand Up @@ -546,7 +526,6 @@ table#akmin .pp-capability-menus-select .restrict-column + .menu-column.ppc-menu
.pp-capability-menus .check-all-menu-link,
.pp-capability-menus .check-all-menu-link:active {
color: #555;
margin-left: -48px;
}

.pp-capability-menus .menu-item-link.restricted,
Expand Down Expand Up @@ -612,21 +591,10 @@ margin-bottom: 10px !important;
margin-bottom: 10px !important;
}

body.capabilities_page_pp-capabilities-nav-menus .pp-capability-menus-select .restrict-column,
body.toplevel_page_pp-capabilities-nav-menus .pp-capability-menus-select .restrict-column {
width: 70px !important;
}

.pp-capability-menus-wrapper .features-section-header {
padding-left: 10px !important;
}


body.capabilities_page_pp-capabilities-admin-features .pp-capability-menus-select .restrict-column,
body.toplevel_page_pp-capabilities-admin-features .pp-capability-menus-select .restrict-column {
width: 70px !important;
}

.pp-column-right.capabilities-sidebar .button.button-primary {
color: #2271b1;
border-color: #2271b1;
Expand Down Expand Up @@ -845,11 +813,6 @@ div.ppc-editor-features-classic-toggle {

/* ====================================================== Nav Menu Restriction */

body.capabilities_page_pp-capabilities-nav-menus .pp-capability-menus-select .restrict-column,
body.toplevel_page_pp-capabilities-nav-menus .pp-capability-menus-select .restrict-column {
width: 70px !important;
}

.capabilities_page_pp-capabilities-nav-menus input.ppc-nav-menu-submit {
margin-bottom: 10px !important;
}
Expand Down Expand Up @@ -1169,6 +1132,11 @@ tr.opened .ppc-nav-menu-expand svg {
display: none !important;
}

ul.pp-capabilities-description {
list-style: circle !important;
margin-left: 12px;
}

.frontend-features-form.simple-form .field-row th {
width: 155px;
padding-right: 0;
Expand Down Expand Up @@ -1416,10 +1384,6 @@ tr.opened .ppc-nav-menu-expand svg {
border-bottom: 1px solid #c3c4c7 !important;
}

.pp-capability-menus-wrapper.frontend-features .content-title-column {
margin-left: -48px;
}

.custom-items-table {
border-top: 1px solid #c3c4c7 !important;
border-left: none !important;
Expand All @@ -1438,10 +1402,6 @@ tr.opened .ppc-nav-menu-expand svg {
padding-left: 25px;
}

body.capabilities_page_pp-capabilities-frontend-features .pp-capability-menus-select .restrict-column {
width: 99px !important;
}

.hidden-element {
display: none !important;
}
Expand Down
2 changes: 1 addition & 1 deletion common/js/admin.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ jQuery(document).ready( function($) {
$('a.neg-type-caps').attr('title',cmeAdmin.typeCapsNegationCaption);
//$('td.cap-unreg').attr('title',cmeAdmin.typeCapUnregistered);
$('a.normal-cap').attr('title',cmeAdmin.switchableCaption);
$('span.cap-x:not([class*="pp-cap-key"])').attr('title',cmeAdmin.capNegated);
$('span.cap-x:not([class*="pp-cap-key"])').html(cmeAdmin.capNegated);
$('table.cme-checklist input[class!="cme-check-all"]').not(':disabled').attr('title',cmeAdmin.chkCaption);

if ($('.ppc-checkboxes-documentation-link').length > 0) {
Expand Down
2 changes: 1 addition & 1 deletion common/js/admin.js

Large diffs are not rendered by default.

99 changes: 75 additions & 24 deletions common/js/profile.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,33 @@
jQuery(function ($) {

/**
* "Advanced Custom Fields: Extended" plugin changes
* profile UI completely removing the #profile-page selector.
*/
var acf_modified_ui = false;
var profile_wrapper_div = '';
var fields_parent_selector = 'form';
if ($('#profile-page').length > 0) {
profile_wrapper_div = '#profile-page';
} else {
profile_wrapper_div = '.wrap';
}

if ($('div[class*="acf-column"]').length > 0) {
acf_modified_ui = true;
fields_parent_selector = 'form div[class*="acf-column-"]';
}

//we need to add class to headers without class
$('#profile-page form :header').each(function () {
$(profile_wrapper_div + ' form :header').each(function () {
if (!$(this).attr("class")) {
var new_header_class = cleanUpStrings($(this).text(), '-');
$(this).addClass(new_header_class);
}
});

//we need to add class to table tr without class
$('#profile-page form tr').each(function () {
$(profile_wrapper_div + ' form tr').each(function () {
if (!$(this).attr("class")) {
var find_first_title = $(this).find('th').text();
var find_second_title = $(this).find('label').text();
Expand All @@ -36,7 +54,7 @@ jQuery(function ($) {
if (window.location.href.indexOf("ppc_profile_element") > -1 && Number(getUrlParameter('ppc_profile_element')) === 1) {

//add spinner
$('#profile-page').after('<div class="ppc-profile-fullpage-loader"></div>');
$(profile_wrapper_div).after('<div class="ppc-profile-fullpage-loader"></div>');
//get all page elements
var element_label_title = '',
element_th_title = '',
Expand All @@ -47,21 +65,39 @@ jQuery(function ($) {
child_this = '';

//add profile page title
single_element = '#profile-page .wp-heading-inline';
single_element = profile_wrapper_div + ' .wp-heading-inline';
page_elements[cleanUpStrings(single_element)] =
{
'label': ppCapabilitiesProfileData.profile_page_title,
'elements': single_element,
'element_type': 'header'
};

// add acf nickname and permalink field
if (acf_modified_ui) {
single_element = profile_wrapper_div + ' #titlediv #titlewrap input';
page_elements[cleanUpStrings(single_element)] =
{
'label': ucWords($(single_element).attr('name')),
'elements': single_element,
'element_type': 'header'
};
single_element = profile_wrapper_div + ' #titlediv #edit-slug-box';
page_elements[cleanUpStrings(single_element)] =
{
'label': ucWords($(single_element + ' strong').html()),
'elements': single_element,
'element_type': 'header'
};
}

//loop through all profile form parents
$('#profile-page form').children().each(function () {
$(profile_wrapper_div + ' ' + fields_parent_selector).children().each(function () {
parent_this = $(this);
//Make direct entry for page headers
if (parent_this.is("h1,h2,h3,h4,h5,h6")) {
//we already added class to all headers for efficiency
single_element = '#profile-page .' + cleanTextWhiteSpace(parent_this.attr("class"), '.');
single_element = profile_wrapper_div + ' .' + cleanTextWhiteSpace(parent_this.attr("class"), '.');
element_label = $(single_element).html();
//add header element
page_elements[cleanUpStrings(single_element)] =
Expand All @@ -76,7 +112,7 @@ jQuery(function ($) {
child_this = $(this);
single_element = cleanTextWhiteSpace(child_this.attr("class"), '.');
if (single_element) {
single_element = '#profile-page .' + single_element;
single_element = profile_wrapper_div + ' .' + single_element;
element_th_title = $(single_element).find('th').text();
element_label_title = $(single_element).find('label').text();
if (element_th_title) {
Expand All @@ -87,26 +123,30 @@ jQuery(function ($) {
element_label = single_element;
}
element_label = element_label.trim();
//add table tr element
page_elements[cleanUpStrings(single_element)] =
{
'label': element_label,
'elements': single_element,
'element_type': 'field'
};
if (element_label !== '' && typeof element_label !== 'undefined') {
//add table tr element
page_elements[cleanUpStrings(single_element)] =
{
'label': element_label,
'elements': single_element,
'element_type': 'field'
};
}
}
});
} else if (parent_this.is("div")) {
//process parent div
single_element = '#profile-page .' + cleanTextWhiteSpace(parent_this.attr("class"), '.');
single_element = profile_wrapper_div + ' .' + cleanTextWhiteSpace(parent_this.attr("class"), '.');
element_label = parent_this.find(':header').html();
//add whole div element
page_elements[cleanUpStrings(single_element)] =
{
'label': element_label,
'elements': single_element,
'element_type': 'section'
};
if (element_label !== '' && typeof element_label !== 'undefined') {
//add whole div element
page_elements[cleanUpStrings(single_element)] =
{
'label': element_label,
'elements': single_element,
'element_type': 'section'
};
}
/**
* We have two problems
* 1. Rank math is adding new tr via javascript
Expand All @@ -126,7 +166,7 @@ jQuery(function ($) {
* of a better solution
*/
if (single_element.indexOf('rank-math-metabox-wrap') >= 0) {
single_element = '#profile-page tr.user-url-wrap + tr';
single_element = profile_wrapper_div + ' tr.user-url-wrap + tr';
element_label = ppCapabilitiesProfileData.rankmath_title;//we can't find the title as it's loading after this function
page_elements[cleanUpStrings(single_element)] =
{
Expand All @@ -139,7 +179,7 @@ jQuery(function ($) {
});

//add update profile button
single_element = '#profile-page input[name=submit]';
single_element = profile_wrapper_div + ' input[name=submit]';
element_label = $(single_element).val();
page_elements[cleanUpStrings(single_element)] =
{
Expand Down Expand Up @@ -219,6 +259,17 @@ jQuery(function ($) {
string = string.replace(/\W/g, '');
return string;
}

/**
* PHP equivalet of ucword
* @param {*} str
* @returns
*/
function ucWords(str) {
return str.split(' ').map(function(word) {
return word.charAt(0).toUpperCase() + word.slice(1);
}).join(' ');
}

/**
* The below codes only apply to multi role edit and
Expand Down
Loading

0 comments on commit f9e05b8

Please sign in to comment.