diff --git a/admin/functions-cap-groups.php b/admin/functions-cap-groups.php index 4d29f86..d5c1c68 100644 --- a/admin/functions-cap-groups.php +++ b/admin/functions-cap-groups.php @@ -213,7 +213,7 @@ function members_register_cap_groups() { if ( members_cap_group_exists( 'all' ) ) { // Set up an empty caps array and get the `all` group object. - $caps = array(); + $caps = array(); $_group = members_get_cap_group( 'all' ); // Get the caps from every registered group. @@ -226,6 +226,19 @@ function members_register_cap_groups() { // Assign all caps to the `all` group. $_group->caps = array_unique( $caps ); } + + // Check if the `custom` group is registered and there's possibly other non-default groups. + if ( has_action( 'members_register_cap_groups' ) && members_cap_group_exists( 'custom' ) ) { + + // Get the custom group object. + $custom = members_cap_group_factory()->groups[ 'custom' ]; + + // Unset the custom group object. + unset( members_cap_group_factory()->groups[ 'custom' ] ); + + // Move the custom group object to the end. + members_cap_group_factory()->groups[ 'custom' ] = $custom; + } } /** diff --git a/changelog.md b/changelog.md index 2ee6c63..ea421ec 100644 --- a/changelog.md +++ b/changelog.md @@ -1,6 +1,6 @@ # Change Log -## [1.0.3] - 2015-9-28 +## [1.0.3] - 2015-10-01 ### Added @@ -13,6 +13,7 @@ * Make sure custom caps (post types, taxonomies, etc.) that aren't stored get saved when editing a role. * Make sure the "All" capability group actually lists all caps from all groups. * Use the `$user` variable instead of `$author` variable in `members_list_users()`. +* "Custom" cap group should always be added last. ## [1.0.2] - 2015-09-15