mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-06-05 15:09:37 +09:00
- fixed field's privacy settings on the profile page when view mode;
- fixed "Edit" button visibility in the member directory grid;
This commit is contained in:
@@ -2211,7 +2211,7 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) {
|
|||||||
$dropdown_actions = $this->build_user_actions_list( $user_id );
|
$dropdown_actions = $this->build_user_actions_list( $user_id );
|
||||||
|
|
||||||
$actions = array();
|
$actions = array();
|
||||||
$can_edit = UM()->roles()->um_current_user_can( 'edit', $user_id ) || UM()->roles()->um_user_can( 'can_edit_everyone' );
|
$can_edit = UM()->roles()->um_current_user_can( 'edit', $user_id );
|
||||||
|
|
||||||
// Replace hook 'um_members_just_after_name'
|
// Replace hook 'um_members_just_after_name'
|
||||||
ob_start();
|
ob_start();
|
||||||
|
|||||||
@@ -428,8 +428,12 @@ function um_submit_form_errors_hook_( $args ) {
|
|||||||
|
|
||||||
if ( ! empty( $fields ) ) {
|
if ( ! empty( $fields ) ) {
|
||||||
|
|
||||||
|
$can_edit = false;
|
||||||
$current_user_roles = [];
|
$current_user_roles = [];
|
||||||
if ( is_user_logged_in() ) {
|
if ( is_user_logged_in() ) {
|
||||||
|
|
||||||
|
$can_edit = UM()->roles()->um_current_user_can( 'edit', $args['user_id'] );
|
||||||
|
|
||||||
um_fetch_user( get_current_user_id() );
|
um_fetch_user( get_current_user_id() );
|
||||||
$current_user_roles = um_user( 'roles' );
|
$current_user_roles = um_user( 'roles' );
|
||||||
um_reset_user();
|
um_reset_user();
|
||||||
@@ -458,7 +462,7 @@ function um_submit_form_errors_hook_( $args ) {
|
|||||||
case '-1': // Only visible to profile owner and admins
|
case '-1': // Only visible to profile owner and admins
|
||||||
if ( ! is_user_logged_in() ) {
|
if ( ! is_user_logged_in() ) {
|
||||||
$can_view = false;
|
$can_view = false;
|
||||||
} elseif ( $args['user_id'] != get_current_user_id() && ! UM()->roles()->um_user_can( 'can_edit_everyone' ) ) {
|
} elseif ( $args['user_id'] != get_current_user_id() && ! $can_edit ) {
|
||||||
$can_view = false;
|
$can_view = false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -1514,8 +1514,12 @@ function um_can_view_field( $data ) {
|
|||||||
|
|
||||||
if ( isset( $data['public'] ) && UM()->fields()->set_mode != 'register' ) {
|
if ( isset( $data['public'] ) && UM()->fields()->set_mode != 'register' ) {
|
||||||
|
|
||||||
|
$can_edit = false;
|
||||||
$current_user_roles = [];
|
$current_user_roles = [];
|
||||||
if ( is_user_logged_in() ) {
|
if ( is_user_logged_in() ) {
|
||||||
|
|
||||||
|
$can_edit = UM()->roles()->um_current_user_can( 'edit', um_user( 'ID' ) );
|
||||||
|
|
||||||
$previous_user = um_user( 'ID' );
|
$previous_user = um_user( 'ID' );
|
||||||
um_fetch_user( get_current_user_id() );
|
um_fetch_user( get_current_user_id() );
|
||||||
|
|
||||||
@@ -1534,7 +1538,7 @@ function um_can_view_field( $data ) {
|
|||||||
case '-1': // Only visible to profile owner and users who can edit other member accounts
|
case '-1': // Only visible to profile owner and users who can edit other member accounts
|
||||||
if ( ! is_user_logged_in() ) {
|
if ( ! is_user_logged_in() ) {
|
||||||
$can_view = false;
|
$can_view = false;
|
||||||
} elseif ( ! um_is_user_himself() && ! UM()->roles()->um_user_can( 'can_edit_everyone' ) ) {
|
} elseif ( ! um_is_user_himself() && ! $can_edit ) {
|
||||||
$can_view = false;
|
$can_view = false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user