Skip to content

Commit

Permalink
avoid potential infinite recursion when evaluating post counts; revis…
Browse files Browse the repository at this point in the history
…ed icon alignment
  • Loading branch information
itthinx committed Nov 27, 2024
1 parent de457f9 commit 8e7eaeb
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
= 3.3.1 =
* WordPress 6.7 compatible.
* Adds fixes for "Translation loading for the ... domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. ..." PHP notices raised as of WordPress 6.7.0 in certain scenarios when translations are requested before the init or the after_setup_theme action have fired.
* Avoids a potential infinite recursion when evaluating post counts.

= 3.3.0 =
* WordPress 6.7 compatible.
Expand Down
3 changes: 3 additions & 0 deletions lib/access/class-groups-post-access.php
Original file line number Diff line number Diff line change
Expand Up @@ -938,6 +938,8 @@ public static function groups_deleted_group( $group_id ) {
* @see Groups_Post_Access::purge_count_posts_cached()
*/
public static function wp_count_posts( $counts, $type, $perm ) {
// @since 3.3.1 remove temporarily to avoid potential infinite recursion https://github.com/itthinx/groups/pull/160
remove_filter( 'wp_count_posts', array( __CLASS__, 'wp_count_posts' ), 10 );
if ( !empty( $type ) && is_string( $type ) && self::handles_post_type( $type ) ) {
$sub_group = Groups_Cache::get_group( '' );
// @since 2.20.0 cached per post type gathering counts per subgroup
Expand Down Expand Up @@ -987,6 +989,7 @@ public static function wp_count_posts( $counts, $type, $perm ) {
Groups_Cache::set( self::COUNT_POSTS . '_' . $type, $type_counts, self::CACHE_GROUP );
}
}
add_filter( 'wp_count_posts', array( __CLASS__, 'wp_count_posts' ), 10, 3 ); // @since 3.3.1 reestablish filter for next use
return $counts;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/admin/class-groups-admin-post-columns.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public static function admin_init() {
public static function columns( $column_headers ) {
$column_headers[self::GROUPS] = sprintf(
'<span title="%s">%s</span>' .
' <span style="float: unset; font-size: inherit; vertical-align: middle; line-height: inherit; font-weight: normal;" class="dashicons dashicons-lock"></span>',
' <span style="float: unset; font-size: inherit; line-height: inherit; font-weight: normal;" class="dashicons dashicons-lock"></span>',
esc_attr__( 'One or more groups granting access to entries.', 'groups' ),
esc_html_x( 'Groups', 'Column header', 'groups' )
);
Expand Down

0 comments on commit 8e7eaeb

Please sign in to comment.