function searchAutoUser() { $q = strtolower(JRequest::getVar('q', '')); $itemId = AwdwallHelperUser::getComItemId(); //$itemId=$_REQUEST['Itemid']; $query = 'SELECT * FROM #__users WHERE name LIKE "%' . $q . '%" OR username LIKE "%'. $q .'%"'; $db =& JFactory::getDBO(); $db->setQuery($query); $items = $db->loadObjectList(); $strSearch = ''; foreach ($items as $item) { if (strpos(strtolower($item->name), $q) !== false || strpos(strtolower($item->username), $q) !== false) { $avatar=AwdwallHelperUser::getBigAvatar40($item->id); $url = JRoute::_('index.php?option=com_awdwall&view=awdwall&layout=mywall&wuid=' . $item->id . '&Itemid=' . $itemId, false); $displayName = AwdwallHelperUser::getDisplayName($item->id); $strSearch .= "<a href='{$url}'><div style='width:248px'><div style='float:left;width:45px;'><img src='{$avatar}' alt='{$displayName}' title='{$displayName}' height='40' width='40' class='awdpostavatar' /></div><div style='float:left;width:200px; padding-left:3px; padding-top:10px;'>{$displayName}</div></div>|{$url}\n"; } } // search in group $query = 'SELECT * FROM #__awd_groups WHERE title LIKE "%' . $q . '%" OR description LIKE "%'. $q .'%"'; $db =& JFactory::getDBO(); $db->setQuery($query); $items = $db->loadObjectList(); foreach ($items as $item) { if (strpos(strtolower($item->title), $q) !== false || strpos(strtolower($item->description), $q) !== false) { //$avatar = AwdwallHelperUser::getGrpImg($item->image, $item->id); $avatar=AwdwallHelperUser::getBigGrpImg40($item->image, $item->id); $url = JRoute::_('index.php?option=com_awdwall&task=viewgroup&groupid=' . $item->id . '&Itemid=' . $itemId, false); $displayName = $item->title; $strSearch .= "<a href='{$url}'><div style='width:248px'><div style='float:left;width:45px;'><img src='{$avatar}' alt='{$displayName}' title='{$displayName}' border='0' /></div><div style='float:left;width:200px; padding-left:3px; padding-top:10px;'>{$displayName}</div></div>|{$url}\n"; } } echo $strSearch; exit; }