Skip to content

#10: implement support for protecting posts with category-based recursive restriction#12

Open
michaeltech wants to merge 5 commits intoFloAppsLtd:masterfrom
michaeltech:feature/10-posts-restriction
Open

#10: implement support for protecting posts with category-based recursive restriction#12
michaeltech wants to merge 5 commits intoFloAppsLtd:masterfrom
michaeltech:feature/10-posts-restriction

Conversation

@michaeltech
Copy link
Copy Markdown

  • extend protection logic to support posts
  • implement recursive restriction via categories and subcategories
  • keep feature optional via filter (no UI changes)
  • align behavior with existing page protection

…rsive restriction

- extend protection logic to support posts
- implement recursive restriction via categories and subcategories
- keep feature optional via filter (no UI changes)
- align behavior with existing page protection
@tjnurmin tjnurmin requested a review from jrajamaki April 22, 2026 12:36
Comment thread includes/extranet.php
Comment thread includes/extranet.php Outdated
if ( $term instanceof WP_Term && ! is_wp_error( $term ) ) {
$all[] = (int) $term->term_id;
}
$children = get_term_children( $root_id, 'category' );
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@michaeltech - rather than looping over children one by one, would it possible to fetch them in single query to prevent N+1 queries?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@michaeltech - after further research, this isn't actually N+1 query problem because of WP's own caching mechanism. These changes could be reverted, sorry for trouble.

Comment thread includes/extranet.php Outdated
Comment thread README.md Outdated
Comment thread README.md
@michaeltech michaeltech force-pushed the feature/10-posts-restriction branch from 27ce995 to 49a2c3a Compare April 28, 2026 14:45
@michaeltech
Copy link
Copy Markdown
Author

Thank you for your feedback.
I have updated the codebase based on the feedback and pushed the latest changes.
Could you review it again?

Comment thread includes/extranet.php
if ( ! is_array( $not_in ) ) {
$not_in = array();
}
$existing_not_in = array_map( 'intval', $not_in );
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@michaeltech - there could separate function for this piece of code, since there's another almost identical logic in floauth_get_extranet_restricted_category_term_ids function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants