You are here

function drupalchat_change_guest_name in DrupalChat 7

1 string reference to 'drupalchat_change_guest_name'
drupalchat_menu in ./drupalchat.module
Implements hook_menu().

File

./drupalchat.module, line 1485
Module code for DrupalChat.

Code

function drupalchat_change_guest_name() {
  global $user;
  if ($user->uid == 0 && isset($_POST) && isset($_POST['drupalchat_guest_new_name']) && variable_get('drupalchat_anon_change_name', 1) == 1) {
    $new_name = check_plain(variable_get('drupalchat_anon_prefix', 'Guest') . " " . $_POST['drupalchat_guest_new_name']);
    $_SESSION['drupalchat_guest_name'] = $new_name;
    setrawcookie('drupalchat_guest_name', rawurlencode($new_name), time() + 60 * 60 * 24 * 365);
    drupal_json_output(array());
  }
  else {
    drupal_access_denied();
  }
}