diff --git a/main/inc/lib/social.lib.php b/main/inc/lib/social.lib.php index 648646e4fe..4a0c5e5673 100755 --- a/main/inc/lib/social.lib.php +++ b/main/inc/lib/social.lib.php @@ -188,8 +188,12 @@ class SocialManager extends UserManager { $sql.=' AND relation_type='.$id_group; } if (isset($search_name) && is_string($search_name)===true) { - $sql.=' AND friend_user_id IN (SELECT user_id FROM '.$tbl_my_user.' WHERE '.(api_is_western_name_order() ? 'concat(firstName, lastName)' : 'concat(lastName, firstName)').' like concat("%","'.Database::escape_string($search_name).'","%"));'; + $search_name = trim($search_name); + $search_name = str_replace(' ', '', $search_name); + //$sql.=' AND friend_user_id IN (SELECT user_id FROM '.$tbl_my_user.' WHERE '.(api_is_western_name_order() ? 'concat(firstName, lastName)' : 'concat(lastName, firstName)').' like concat("%","'.Database::escape_string($search_name).'","%"));'; + $sql.=' AND friend_user_id IN (SELECT user_id FROM '.$tbl_my_user.' WHERE firstName LIKE "%'.Database::escape_string($search_name).'%" OR lastName LIKE "%'.Database::escape_string($search_name).'%" OR '.(api_is_western_name_order() ? 'concat(firstName, lastName)' : 'concat(lastName, firstName)').' like concat("%","'.Database::escape_string($search_name).'","%") ) '; } + $res=Database::query($sql,__FILE__,__LINE__); while ($row=Database::fetch_array($res,'ASSOC')) { if ($load_extra_info == true) { @@ -649,10 +653,11 @@ class SocialManager extends UserManager { * @param bool show profile or not (show or hide the user image/information) * */ - public static function show_social_menu($show = '',$group_id = 0, $user_id = 0, $show_full_profile = false) { + public static function show_social_menu($show = '', $group_id = 0, $user_id = 0, $show_full_profile = false) { $img_array = UserManager::get_user_picture_path_by_id($user_id,'web',true,true); - $big_image = UserManager::get_picture_user($user_id, $img_array['file'],'',USER_IMAGE_SIZE_BIG); + $big_image = UserManager::get_picture_user($user_id, $img_array['file'],'', USER_IMAGE_SIZE_BIG); + $big_image = $big_image['file'].$big_image['dir']; $show_groups = array('groups', 'group_messages', 'messages_list', 'group_add', 'mygroups', 'group_edit', 'member_list', 'invite_friends', 'waiting_list'); $show_messages = array('messages', 'messages_inbox', 'messages_outbox', 'messages_compose'); @@ -668,7 +673,28 @@ class SocialManager extends UserManager { } echo '
'; + + + + + //--- User image + echo '
'; + echo ''; + echo '
'; + + + if ($show != 'shared_profile') { echo '
'; @@ -713,20 +739,7 @@ class SocialManager extends UserManager { if ($show == 'shared_profile') { - //--- User image - echo '
'; - echo ''; - echo '
'; + if ($user_id != intval(api_get_user_id())) { $user_info = api_get_user_info($user_id);