Skip to content

Commit

Permalink
Merge pull request #863 from publishpress/release-v2.9.0
Browse files Browse the repository at this point in the history
Release v2.9.0
  • Loading branch information
olatechpro authored Jul 31, 2023
2 parents 52ee23f + f825a7f commit a10d7fc
Show file tree
Hide file tree
Showing 33 changed files with 3,879 additions and 19,773 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.8.1
* Version: 2.9.0
* Author: PublishPress
* Author URI: https://publishpress.com/
* Text Domain: capsman-enhanced
Expand Down Expand Up @@ -44,7 +44,7 @@
}

if (!defined('CAPSMAN_VERSION')) {
define('CAPSMAN_VERSION', '2.8.1');
define('CAPSMAN_VERSION', '2.9.0');
define('CAPSMAN_ENH_VERSION', CAPSMAN_VERSION);
define('PUBLISHPRESS_CAPS_VERSION', CAPSMAN_VERSION);
}
Expand Down
19 changes: 19 additions & 0 deletions classes/pp-capabilities-installer.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ public static function runUpgradeTasks($currentVersions)
if (version_compare($currentVersions, '2.8.0', '<')) {
self::addPluginCapabilities();
}
if (version_compare($currentVersions, '2.9.0', '<')) {
self::addFrontendFeaturesCapabilities();
}

/**
* @param string $previousVersion
Expand Down Expand Up @@ -74,4 +77,20 @@ private static function addPluginCapabilities()
}
}

private static function addFrontendFeaturesCapabilities()
{

$eligible_roles = ['administrator', 'editor'];

/**
* Add frontend features capabilities to admin and editor roles
*/
foreach ($eligible_roles as $eligible_role) {
$role = get_role($eligible_role);
if (!$role->has_cap('manage_capabilities_frontend_features')) {
$role->add_cap('manage_capabilities_frontend_features');
}
}
}

}
Loading

0 comments on commit a10d7fc

Please sign in to comment.