This commit is contained in:
Daniel Maya 2022-09-20 16:05:27 +02:00
parent 9e90c8da07
commit 9b79ea7912
2 changed files with 14 additions and 7 deletions

View File

@ -99,10 +99,16 @@ if (is_ajax()) {
if ($get_user_profile_group === true) { if ($get_user_profile_group === true) {
$id_user = get_parameter('id_user'); $id_user = get_parameter('id_user');
$user_is_admin = users_is_admin();
$user_profiles = []; $user_profiles = [];
if ($user_is_admin === false) {
$group_um = users_get_groups_UM($config['id_user']);
}
// User profiles. // User profiles.
if (users_is_admin()) { if ($user_is_admin || $id_user == $config['id_user'] || isset($group_um[0])) {
$user_profiles = db_get_all_rows_field_filter( $user_profiles = db_get_all_rows_field_filter(
'tusuario_perfil', 'tusuario_perfil',
'id_usuario', 'id_usuario',
@ -625,7 +631,7 @@ foreach ($info as $user_id => $user_info) {
'SELECT * FROM tusuario_perfil where id_usuario LIKE "'.$user_id.'" LIMIT 5' 'SELECT * FROM tusuario_perfil where id_usuario LIKE "'.$user_id.'" LIMIT 5'
); );
} else { } else {
$user_profiles_aux = users_get_user_profile($user_id); $user_profiles_aux = users_get_user_profile($user_id, 'LIMIT 5');
$user_profiles = []; $user_profiles = [];
foreach ($group_um as $key => $value) { foreach ($group_um as $key => $value) {
if (isset($user_profiles_aux[$key]) === true) { if (isset($user_profiles_aux[$key]) === true) {
@ -911,7 +917,7 @@ echo '</div>';
enterprise_hook('close_meta_frame'); enterprise_hook('close_meta_frame');
?>; ?>
<script type="text/javascript"> <script type="text/javascript">
function showGroups(id_user) { function showGroups(id_user) {
if ($(`#hidden-show_groups_${id_user}`).val() === '-1') { if ($(`#hidden-show_groups_${id_user}`).val() === '-1') {
@ -951,4 +957,4 @@ enterprise_hook('close_meta_frame');
} }
} }
</script>; </script>

View File

@ -838,13 +838,14 @@ function users_has_profile_without_UM($id_user, $id_groups)
} }
function users_get_user_profile($id_user) function users_get_user_profile($id_user, $limit='')
{ {
$sql = sprintf( $sql = sprintf(
"SELECT * FROM tusuario_perfil "SELECT * FROM tusuario_perfil
INNER JOIN tperfil ON tperfil.id_perfil = tusuario_perfil.id_perfil INNER JOIN tperfil ON tperfil.id_perfil = tusuario_perfil.id_perfil
WHERE tusuario_perfil.id_usuario like '%s'", WHERE tusuario_perfil.id_usuario like '%s' %s",
$id_user $id_user,
$limit
); );
$aux = db_get_all_rows_sql($sql); $aux = db_get_all_rows_sql($sql);