Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multi language categories - category page #25

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion authorizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -1579,6 +1579,21 @@ public function restrict_access( $wp ) {

}

// Check to see if the requested category is public. If so, show it.
$current_category_name = property_exists( $wp, 'query_vars' ) && array_key_exists( 'category_name', $wp->query_vars ) && strlen( $wp->query_vars['category_name'] ) > 0 ? $wp->query_vars['category_name'] : '';
if ($current_category_name) {
$current_category_name_array = explode( '/', $current_category_name );
$current_category_name = end($current_category_name_array);
if ( in_array( 'cat_' . $current_category_name, $auth_settings['access_public_pages'] ) ) {
if ( $auth_settings['access_public_warning'] === 'no_warning' ) {
update_option( 'auth_settings_advanced_public_notice', false );
} else {
update_option( 'auth_settings_advanced_public_notice', true );
}
return $wp;
}
}

// User is denied access, so show them the error message. Render as JSON
// if this is a REST API call; otherwise, show the error message via
// wp_die() (rendered html), or redirect to the login URL.
Expand Down Expand Up @@ -3608,7 +3623,12 @@ function print_multiselect_auth_access_public_pages( $args = '' ) {
</optgroup>
<?php endforeach; ?>
<optgroup label="<?php _e( 'Categories', 'authorizer' ); ?>">
<?php foreach ( get_categories() as $category ) : ?>

<?php global $sitepress;
remove_filter('terms_clauses', array($sitepress, 'terms_clauses'));
$options = get_categories("hide_empty=0");
add_filter('terms_clauses', array($sitepress, 'terms_clauses'));
foreach ( $options as $category ) : ?>
<option value="<?php echo 'cat_' . $category->slug; ?>" <?php echo in_array( 'cat_' . $category->slug, $auth_settings_option ) ? 'selected="selected"' : ''; ?>><?php echo $category->name; ?></option>
<?php endforeach; ?>
</optgroup>
Expand Down