ichord / At.js

Add Github like mentions autocomplete to your application.
http://ichord.github.com/At.js
MIT License
5.3k stars 668 forks source link

vbulletin member autocomplete @mention #590

Open mizah54 opened 3 years ago

mizah54 commented 3 years ago

http://ichord.github.io/At.js/

How can I do the following vbulletin user search code with at.js? How should the application be to show textarea as @exampleuser $ .ajax ({ type: "POST", url: 'ajax.php?do =usersearch',

I tried it as it did not happen

if ($_POST['do'] == 'usersearch') { $vbulletin->input->clean_array_gpc('p', array('fragment' => TYPE_STR));

$vbulletin->GPC['fragment'] = convert_urlencoded_unicode($vbulletin->GPC['fragment']);

if ($vbulletin->GPC['fragment'] != '' AND strlen($vbulletin->GPC['fragment']) >= 3)
{
    $fragment = htmlspecialchars_uni($vbulletin->GPC['fragment']);
}
else
{
    $fragment = '';
}

$xml = new vB_AJAX_XML_Builder($vbulletin, 'text/xml');
$xml->add_group('users');

if ($fragment != '')
{
    $users = $db->query_read_slave("
        SELECT userid, username FROM " . TABLE_PREFIX . "user
        WHERE username LIKE('" . $db->escape_string_like($fragment) . "%')
        ORDER BY username
        LIMIT 15
    ");
    while ($user = $db->fetch_array($users))
    {
        $xml->add_tag('user', $user['username'], array('userid' => $user['userid']));
    }
}

$xml->close_group();
$xml->print_xml();

}