FreiChat related discussions
chat only groups id

and 'can do only see the chat groups by id group?
my version is 9.6

and 'can do only see the chat groups by id group? my version is 9.6

if you are using Joomla, you can restrict the chat to only certain groups by simply mentioning the group id in the backend.

if you are using Joomla, you can restrict the chat to only certain groups by simply mentioning the group id in the backend.

my use phpbb

in which 'section I find this option ??

my use phpbb in which 'section I find this option ??

You will have edit the query in the freichat/server/drivers/Phpbb3.php

Do you have knowledge in SQL & PHP ?

You will have edit the query in the freichat/server/drivers/Phpbb3.php Do you have knowledge in SQL & PHP ?

this and 'my file
What should I change?
I can give an example thanks

My file

<?php

require 'base.php';

class Phpbb extends driver_base {

public function __construct($db) {
    //parent::__construct();
    $this->db = $db;
    $this->is_avatar = true;
}

//------------------------------------------------------------------------------
public function getDBdata($session_id, $first) {

    $query = "SELECT s.username,j.session_user_id
                  FROM " . DBprefix . "sessions as j
                  LEFT JOIN " . DBprefix . "users as s ON s.user_id=j.session_user_id
                  WHERE j.session_id=? LIMIT 1";

        $res_obj = $this->db->prepare($query);                       
        $res_obj->execute( array($session_id) );// var_dump($res_obj);
        $res = $res_obj->fetchAll();

    if ($res == null) {
            $this->freichat_debug("Incorrect Query :  " . $query . " \n session id:  ". $session_id ."\n PDO error: ".print_r($this->db->errorInfo(),true));
    }

    foreach ($res as $result) {
        if (isset($result['username'])) { //To avoid undefined index error. Because empty results were shown sometimes
            if ($result['session_user_id'] == 1) {
                $_SESSION[$this->uid . 'is_guest'] = 1;
            } else {
                $_SESSION[$this->uid . 'is_guest'] = 0;
            }
            if ($_SESSION[$this->uid . 'is_guest'] == 0) { //To check if the result from query is a guest or not
                $_SESSION[$this->uid . 'usr_name'] = $result['username'];
                $_SESSION[$this->uid . 'usr_ses_id'] = $result['session_user_id'];
            } else if ($_SESSION[$this->uid . 'is_guest'] == 1) { //When user loggs out his session has to be updated back to old session(the session made before he logged in)
                $_SESSION[$this->uid . 'usr_name'] = $_SESSION[$this->uid . 'gst_nam'];
                $_SESSION[$this->uid . 'usr_ses_id'] = $_SESSION[$this->uid . 'gst_ses_id'];
            } else {
                $this->freichat_debug("Incorrect query wriiten for phpBB (51)");
            }
        }
    }
}

//------------------------------------------------------------------------------
public function avatar_url($res) {

    $root_path = str_replace($this->to_freichat_path, "", $this->url);

    $avatar_url = $root_path."download/file.php?avatar=".$res[$this->avatar_field_name];

    return $avatar_url;
}

//------------------------------------------------------------------------------
public function getList() {

    $user_list = null;

    if ($this->show_name == 'guest') {
        $user_list = $this->get_guests();
    } else if ($this->show_name == 'user') {
        $user_list = $this->get_users();
    } else {
        $this->freichat_debug('USER parameters for show_name are wrong.');
    }
    return $user_list;
}

//------------------------------------------------------------------------------
public function get_guests() {

    $query = "SELECT DISTINCT f.status_mesg,f.username,f.session_id,f.status,f.guest,p.user_avatar as avatar,f.in_room
               FROM frei_session AS f
               LEFT JOIN ".DBprefix."users as p on p.user_id = f.session_id
              WHERE f.time>" . $this->online_time2 . "
               AND f.session_id<>" . $_SESSION[$this->uid . 'usr_ses_id'] . "
               AND f.status<>2
               AND f.status<>0";

//echo $query;

    $list = $this->db->query($query)->fetchAll();
    return $list;
}

//------------------------------------------------------------------------------
public function get_users() {

    $query = "SELECT DISTINCT f.status_mesg,f.username,f.session_id,f.status,f.guest,p.user_avatar as avatar,f.in_room
               FROM frei_session AS f
               LEFT JOIN ".DBprefix."users as p on p.user_id = f.session_id
              WHERE f.time>" . $this->online_time2 . "
               AND f.session_id<>" . $_SESSION[$this->uid . 'usr_ses_id'] . "
               AND f.status<>2
               AND f.status<>0
               AND f.guest=0";

    $list = $this->db->query($query)->fetchAll();

    return $list;
}

//------------------------------------------------------------------------------

public function x_config() {
       /* $sql = 'SELECT config_name,config_value FROM '.$this->db_prefix.'config';

        $result = $this->db->query($sql)->fetchAll();

        return $result;*/
    return false;
}

//------------------------------------------------------------------------------
public function load_driver() {

    //define("DBprefix", $this->db_prefix);
    $session_id = $this->options['id'];
    $custom_mesg = $this->options['custom_mesg'];
    $first = $this->options['first'];

// 1. Connect The DB
// DONE
// 2. Basic Build the blocks
$this->createFreiChatXsession();
// 3. Get Required Data from client DB
$this->getDBdata($session_id, $first);
$this->check_ban();
// 4. Insert user data in FreiChatX Table Or Recreate Him if necessary
$this->createFreiChatXdb();
// 5. Update user data in FreiChatX Table
$this->updateFreiChatXdb($first, $custom_mesg);
// 6. Delete user data in FreiChatX Table
$this->deleteFreiChatXdb();
// 7. Get Appropriate UserData from FreiChatX Table
if ($this->usr_list_wanted == true) {
$result = $this->getList();
return $result;
}
// 8. Send The final Data back
return true;
}

this and &#039;my file What should I change? I can give an example thanks My file &amp;lt;?php require &#039;base.php&#039;; class Phpbb extends driver_base { public function __construct($db) { //parent::__construct(); $this-&amp;gt;db = $db; $this-&amp;gt;is_avatar = true; } //------------------------------------------------------------------------------ public function getDBdata($session_id, $first) { $query = &quot;SELECT s.username,j.session_user_id FROM &quot; . DBprefix . &quot;sessions as j LEFT JOIN &quot; . DBprefix . &quot;users as s ON s.user_id=j.session_user_id WHERE j.session_id=? LIMIT 1&quot;; $res_obj = $this-&amp;gt;db-&amp;gt;prepare($query); $res_obj-&amp;gt;execute( array($session_id) );// var_dump($res_obj); $res = $res_obj-&amp;gt;fetchAll(); if ($res == null) { $this-&amp;gt;freichat_debug(&quot;Incorrect Query : &quot; . $query . &quot; \n session id: &quot;. $session_id .&quot;\n PDO error: &quot;.print_r($this-&amp;gt;db-&amp;gt;errorInfo(),true)); } foreach ($res as $result) { if (isset($result[&#039;username&#039;])) { //To avoid undefined index error. Because empty results were shown sometimes if ($result[&#039;session_user_id&#039;] == 1) { $_SESSION[$this-&amp;gt;uid . &#039;is_guest&#039;] = 1; } else { $_SESSION[$this-&amp;gt;uid . &#039;is_guest&#039;] = 0; } if ($_SESSION[$this-&amp;gt;uid . &#039;is_guest&#039;] == 0) { //To check if the result from query is a guest or not $_SESSION[$this-&amp;gt;uid . &#039;usr_name&#039;] = $result[&#039;username&#039;]; $_SESSION[$this-&amp;gt;uid . &#039;usr_ses_id&#039;] = $result[&#039;session_user_id&#039;]; } else if ($_SESSION[$this-&amp;gt;uid . &#039;is_guest&#039;] == 1) { //When user loggs out his session has to be updated back to old session(the session made before he logged in) $_SESSION[$this-&amp;gt;uid . &#039;usr_name&#039;] = $_SESSION[$this-&amp;gt;uid . &#039;gst_nam&#039;]; $_SESSION[$this-&amp;gt;uid . &#039;usr_ses_id&#039;] = $_SESSION[$this-&amp;gt;uid . &#039;gst_ses_id&#039;]; } else { $this-&amp;gt;freichat_debug(&quot;Incorrect query wriiten for phpBB (51)&quot;); } } } } //------------------------------------------------------------------------------ public function avatar_url($res) { $root_path = str_replace($this-&amp;gt;to_freichat_path, &quot;&quot;, $this-&amp;gt;url); $avatar_url = $root_path.&quot;download/file.php?avatar=&quot;.$res[$this-&amp;gt;avatar_field_name]; return $avatar_url; } //------------------------------------------------------------------------------ public function getList() { $user_list = null; if ($this-&amp;gt;show_name == &#039;guest&#039;) { $user_list = $this-&amp;gt;get_guests(); } else if ($this-&amp;gt;show_name == &#039;user&#039;) { $user_list = $this-&amp;gt;get_users(); } else { $this-&amp;gt;freichat_debug(&#039;USER parameters for show_name are wrong.&#039;); } return $user_list; } //------------------------------------------------------------------------------ public function get_guests() { $query = &quot;SELECT DISTINCT f.status_mesg,f.username,f.session_id,f.status,f.guest,p.user_avatar as avatar,f.in_room FROM frei_session AS f LEFT JOIN &quot;.DBprefix.&quot;users as p on p.user_id = f.session_id WHERE f.time&amp;gt;&quot; . $this-&amp;gt;online_time2 . &quot; AND f.session_id&amp;lt;&amp;gt;&quot; . $_SESSION[$this-&amp;gt;uid . &#039;usr_ses_id&#039;] . &quot; AND f.status&amp;lt;&amp;gt;2 AND f.status&amp;lt;&amp;gt;0&quot;; //echo $query; $list = $this-&amp;gt;db-&amp;gt;query($query)-&amp;gt;fetchAll(); return $list; } //------------------------------------------------------------------------------ public function get_users() { $query = &quot;SELECT DISTINCT f.status_mesg,f.username,f.session_id,f.status,f.guest,p.user_avatar as avatar,f.in_room FROM frei_session AS f LEFT JOIN &quot;.DBprefix.&quot;users as p on p.user_id = f.session_id WHERE f.time&amp;gt;&quot; . $this-&amp;gt;online_time2 . &quot; AND f.session_id&amp;lt;&amp;gt;&quot; . $_SESSION[$this-&amp;gt;uid . &#039;usr_ses_id&#039;] . &quot; AND f.status&amp;lt;&amp;gt;2 AND f.status&amp;lt;&amp;gt;0 AND f.guest=0&quot;; $list = $this-&amp;gt;db-&amp;gt;query($query)-&amp;gt;fetchAll(); return $list; } //------------------------------------------------------------------------------ public function x_config() { /* $sql = &#039;SELECT config_name,config_value FROM &#039;.$this-&amp;gt;db_prefix.&#039;config&#039;; $result = $this-&amp;gt;db-&amp;gt;query($sql)-&amp;gt;fetchAll(); return $result;*/ return false; } //------------------------------------------------------------------------------ public function load_driver() { //define(&quot;DBprefix&quot;, $this-&amp;gt;db_prefix); $session_id = $this-&amp;gt;options[&#039;id&#039;]; $custom_mesg = $this-&amp;gt;options[&#039;custom_mesg&#039;]; $first = $this-&amp;gt;options[&#039;first&#039;]; // 1. Connect The DB // DONE // 2. Basic Build the blocks $this-&amp;gt;createFreiChatXsession(); // 3. Get Required Data from client DB $this-&amp;gt;getDBdata($session_id, $first); $this-&amp;gt;check_ban(); // 4. Insert user data in FreiChatX Table Or Recreate Him if necessary $this-&amp;gt;createFreiChatXdb(); // 5. Update user data in FreiChatX Table $this-&amp;gt;updateFreiChatXdb($first, $custom_mesg); // 6. Delete user data in FreiChatX Table $this-&amp;gt;deleteFreiChatXdb(); // 7. Get Appropriate UserData from FreiChatX Table if ($this-&amp;gt;usr_list_wanted == true) { $result = $this-&amp;gt;getList(); return $result; } // 8. Send The final Data back return true; }

example
my database (name) my_carzio2groups
id global_moderators id number 4
id administrators id number 5

example my database (name) my_carzio2groups id global_moderators id number 4 id administrators id number 5

Hi,

You need to change the queries in get_guests(), get_users(), get_buddies() .

For reference, you can look at the method get_users_by_group() in
server/drivers/Joomla.php

Please let us know if you want more information or have any problems .

Hi, You need to change the queries in get_guests(), get_users(), get_buddies() . For reference, you can look at the method get_users_by_group() in server/drivers/Joomla.php Please let us know if you want more information or have any problems .
199
7
0
live preview
enter atleast 10 characters
WARNING: You mentioned %MENTIONS%, but they cannot see this message and will not be notified
Saving...
Saved
With selected deselect posts show selected posts
All posts under this topic will be deleted ?
Pending draft ... Click to resume editing
Discard draft