get($id); $userSettings = RocketChat::getUserChatSettings($id); if (!$userSettings['chat_login']) { $result = RocketChat::createChatUser($user); } if (!RocketChat::checkUserInChannel($user, $post['channelId'])) { //логиним, чтобы получить ИД в чате RocketChat::loginUser($user->id); //добавляем в канал RocketChat::addUserToChannel($user, $post['channelId']); } } }