You are here

function nodejs_remove_user_from_channel in Node.js integration 8

Same name and namespace in other branches
  1. 6 nodejs.module \nodejs_remove_user_from_channel()
  2. 7 nodejs.module \nodejs_remove_user_from_channel()

Remove a user from a channel.

Parameters

mixed $uid:

mixed $channel:

Return value

boolean

File

./nodejs.module, line 595

Code

function nodejs_remove_user_from_channel($uid, $channel) {

  // Http request went ok. Process Node.js server response.
  if ($node_response = nodejs_get_nodejs()
    ->removeUserFromChannel($uid, $channel)) {
    if ($node_response->status == 'success') {
      return TRUE;
    }
    else {
      $params = array(
        '%uid' => $uid,
        '%channel' => $channel,
        '%error' => $node_response->error,
      );
      \Drupal::logger('nodejs')
        ->error(t('Error removing user with uid: %uid from channel %channel on the Node.js server. Server response: %error', $params));
      return FALSE;
    }
  }
  else {
    return FALSE;
  }
}