Skip to content

Commit

Permalink
Grant Calendar, Overview and Boards screens access to editors and aut…
Browse files Browse the repository at this point in the history
…hors #1640
  • Loading branch information
olatechpro committed May 27, 2024
1 parent 9441fa0 commit 2d4073f
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
10 changes: 10 additions & 0 deletions modules/calendar/calendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,16 @@ public function action_admin_submenu()
*/
public function install()
{

$viewCapability = $this->getViewCapability();
$eligible_roles = ['administrator', 'editor', 'author'];

foreach ($eligible_roles as $eligible_role) {
$role = get_role($eligible_role);
if (is_object($role) && !$role->has_cap($viewCapability)) {
$role->add_cap($viewCapability);
}
}
}

/**
Expand Down
9 changes: 9 additions & 0 deletions modules/content-board/content-board.php
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,15 @@ public function print_configure_view()
*/
public function install()
{
$viewCapability = $this->getViewCapability();
$eligible_roles = ['administrator', 'editor', 'author'];

foreach ($eligible_roles as $eligible_role) {
$role = get_role($eligible_role);
if (is_object($role) && !$role->has_cap($viewCapability)) {
$role->add_cap($viewCapability);
}
}
}

/**
Expand Down
9 changes: 9 additions & 0 deletions modules/content-overview/content-overview.php
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,15 @@ public function print_configure_view()
*/
public function install()
{
$viewCapability = $this->getViewCapability();
$eligible_roles = ['administrator', 'editor', 'author'];

foreach ($eligible_roles as $eligible_role) {
$role = get_role($eligible_role);
if (is_object($role) && !$role->has_cap($viewCapability)) {
$role->add_cap($viewCapability);
}
}
}

/**
Expand Down

0 comments on commit 2d4073f

Please sign in to comment.