You are here

function nodejs_add_user_to_channel in Node.js integration 7

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

Add a user to a channel.

Parameters

mixed $uid:

mixed $channel:

Return value

boolean

2 calls to nodejs_add_user_to_channel()
nodejs_add_user_to_channel_form_submit in ./nodejs.module
Form submit callback - add a user to a channel on the Node.js server.
nodejs_subscribe_insert in nodejs_subscribe/nodejs_subscribe.module
Create subscription to a node for a given user.

File

./nodejs.module, line 754

Code

function nodejs_add_user_to_channel($uid, $channel) {

  // Http request went ok. Process Node.js server response.
  if ($node_response = Nodejs::addUserToChannel($uid, $channel)) {
    if ($node_response->status == 'success') {
      return TRUE;
    }
    else {
      $params = array(
        '%uid' => $uid,
        '%channel' => $channel,
        '%error' => $node_response->error,
      );
      watchdog('nodejs', 'Error adding user with uid: %uid to channel %channel on the Node.js server. Server response: %error', $params);
      return FALSE;
    }
  }
  else {
    return FALSE;
  }
}