Skip to content

Commit 97043dc

Browse files
committed
Use more resilient method for checking whether user has a role on portfolio site.
The 'wp_' prefix is not reliable. See cuny-academic-commons/commons-in-a-box#544.
1 parent 91a9eb8 commit 97043dc

1 file changed

Lines changed: 1 addition & 4 deletions

File tree

lib/group-funcs.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2415,10 +2415,7 @@ function openlab_bp_group_site_pages( $mobile = false ) {
24152415
// Check to see if the user has a role on the portfolio site.
24162416
$site_id = openlab_get_site_id_by_group_id( $group_id );
24172417
if ( $site_id ) {
2418-
$user_role = get_user_meta( bp_loggedin_user_id(), 'wp_' . $site_id . '_capabilities', true );
2419-
if ( ! empty( $user_role ) && is_array( $user_role ) ) {
2420-
$show_dashboard_link = true;
2421-
}
2418+
$show_dashboard_link = current_user_can_for_site( $site_id, 'read' );
24222419
}
24232420
}
24242421

0 commit comments

Comments
 (0)