Skip to content

Commit f06ba48

Browse files
committed
Remove duplicate code & reuse has_bcc_role_with_full_content_access function
1 parent 5ff4555 commit f06ba48

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

plugins/bcc-login/includes/class-bcc-login-visibility.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ function filter_pre_get_posts( $query ) {
569569
$user_groups = $this->get_current_user_groups();
570570

571571
// Filter posts which user should have access to - except when user has full content access
572-
if (empty($user_groups) || count(array_intersect($this->_settings->full_content_access_groups, $user_groups)) == 0) {
572+
if (empty($user_groups) || !$this->has_bcc_role_with_full_content_access()) {
573573
$group_rules = array();
574574

575575
// Use case when no group filters have been set
@@ -724,7 +724,7 @@ public function get_filtering_groups_list() {
724724
return json_encode(array());
725725
}
726726

727-
if (count(array_intersect($this->_settings->full_content_access_groups, $user_groups)) > 0) {
727+
if ($this->has_bcc_role_with_full_content_access()) {
728728
// Show all site groups for full content access users
729729
return json_encode($roles_tag_groups);
730730
}
@@ -829,7 +829,7 @@ function on_render_block( $block_content, $block ) {
829829

830830
// Filter blocks which user should have access to
831831
//- users with "full access" will still not be able to see blocks they are not in a group for (even if they can see the post)
832-
if (count(array_intersect($block_groups, $user_groups)) == 0) //&& count(array_intersect($this->_settings->full_content_access_groups, $user_groups)) == 0
832+
if (count(array_intersect($block_groups, $user_groups)) == 0) //&& !$this->has_bcc_role_with_full_content_access()
833833
{
834834
return '';
835835
}

0 commit comments

Comments
 (0)