Skip to content

Commit

Permalink
Merge pull request #190 from dparker1005/fix-pbc-conflict-for-user-fi…
Browse files Browse the repository at this point in the history
…elds

Always use the user's real levels in the admin
  • Loading branch information
andrewlimaza authored Sep 19, 2024
2 parents fe750aa + e4ada55 commit aa9de9c
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions pmpro-approvals.php
Original file line number Diff line number Diff line change
Expand Up @@ -574,16 +574,9 @@ public static function pmpro_has_membership_level( $haslevel, $user_id, $levels
return $haslevel;
}

// Only check this inside admin of WordPress.
if ( is_admin() && function_exists( 'get_current_screen' ) ) {

// Ignore if on the edit user screen. This will allow admins/users to update custom fields.
$current_screen = get_current_screen();

if ( !empty( $current_screen ) && ( $current_screen->base == 'user-edit' || $current_screen->base == 'profile' ) ) {
return $haslevel;
}

// Show the real levels in the admin.
if ( is_admin() ) {
return $haslevel;
}

//no user, skip
Expand All @@ -597,7 +590,7 @@ public static function pmpro_has_membership_level( $haslevel, $user_id, $levels
}

// If the current user doesn't have a level, bail.
if ( ! pmpro_hasMembershipLevel() ) {
if ( ! pmpro_hasMembershipLevel( null, $user_id ) ) {
return $haslevel;
}

Expand Down

0 comments on commit aa9de9c

Please sign in to comment.