function drupalchat_status in DrupalChat 7.2
Same name and namespace in other branches
- 6.2 drupalchat.module \drupalchat_status()
- 6 drupalchat.module \drupalchat_status()
- 7 drupalchat.module \drupalchat_status()
Alter status via ajax
1 string reference to 'drupalchat_status'
- drupalchat_menu in ./
drupalchat.module - Implements hook_menu().
File
- ./
drupalchat.module, line 710 - Module code for DrupalChat.
Code
function drupalchat_status() {
global $user;
// TODO Please review the conversion of this statement to the D7 database API syntax.
/* db_query("UPDATE {drupalchat_users} SET status = %d WHERE uid = %d", check_plain($_POST['status']), $user->uid) */
if ($user->uid > 0) {
db_update('drupalchat_users')
->fields(array(
'status' => check_plain($_POST['status']),
))
->condition('uid', $user->uid)
->execute();
}
else {
db_update('drupalchat_users')
->fields(array(
'status' => check_plain($_POST['status']),
))
->condition('uid', $user->uid)
->condition('session', _drupalchat_get_sid())
->execute();
}
drupal_json_output(array());
}