Help
Ask questions about how to do or fix things in Arrowchat
User avatar
zoldos
Customer
 
Posts: 4
Joined: 15 Sep 2022, 10:42

 

by zoldos 11 Jul 2023, 06:13

I'm using Ubuntu 20.04 with a strictly nginx server. After some research, I'm to understand that I need the re-write codes stored in Arrowchat's .htaccess file converted to nginx directives. Can anyone assist? I tried several times and always failed since I'm already using a var in the directive to re-write my site which apparently can't be used twice, but there may be a workaround.

Thoughts or ideas are most appreciated!
User avatar
Jason
Customer
 
Posts: 2330
Joined: 12 Dec 2009, 16:06

 

by Jason 11 Jul 2023, 06:56

What’s the issue you’re having? It’s not common to have issues with nginx.
User avatar
zoldos
Customer
 
Posts: 4
Joined: 15 Sep 2022, 10:42

 

by zoldos 16 Jul 2023, 15:39

What’s the issue you’re having? It’s not common to have issues with nginx.
My apologies, I didn't get a notification of this reply.

Basically, I'm running a nginx only Ubuntu 20.04/PHP 8.2.8 server with Apache turned off. I needed to add some back end nginx directives so my Xenforo 2.2 forum would re-write correctly. But this also means that .htaccess can't be used (I'm assuming). Arrowchat 4 seems to use .htaccess, so I was trying to figure out how to get it to work by adding more nginx directives. But with, or without .htaccess, it doesn't seem to work at all, user side. I even turned Apache back on and restored the .htaccess files.

It installs perfectly, and I can access the admin panel without issue. Very strange!

Any ideas?
User avatar
Jason
Customer
 
Posts: 2330
Joined: 12 Dec 2009, 16:06

 

by Jason 16 Jul 2023, 17:33

What part isn't working?

ArrowChat doesn't actually require an htaccess file to run; it only makes things more user friendly.
User avatar
zoldos
Customer
 
Posts: 4
Joined: 15 Sep 2022, 10:42

 

by zoldos 17 Jul 2023, 10:57

What part isn't working?

ArrowChat doesn't actually require an htaccess file to run; it only makes things more user friendly.
The install process works, the Arrowchat admin is perfect, and I added the code to my Xenforo "PAGE.CONTAINER" template. But when I load my forum, it doesn't show up. It is set to member's only, and everyone chats with everyone. But I simply don't see the chat bubble.

I'll install it again and see about enabling errors and inspect it, etc.

I'll get back to you. Thanks!
User avatar
Jason
Customer
 
Posts: 2330
Joined: 12 Dec 2009, 16:06

 

by Jason 17 Jul 2023, 11:38

That's probably because you are using non-standard sessions in Xenoforo, perhaps Memcached.

If you are using memcached with XenForo, here is the get_user_id() function:
Code: Select all
    function get_user_id()
    {
        global $db;
        
        $userid = NULL;
        
        $m = new Memcached();
        $m->addServer('127.0.0.1', 11211);

        if (!empty($_COOKIE['xf_session']))
        {   
            $session = $m->get('xf_session_' . $_COOKIE['xf_session']);
            
            if (!empty($session))
            {
                $data = unserialize($session[0]);
                $data = unserialize($data);
                $userid = $data['user_id'];
                
                if (!empty($userid))
                {
                    $result = $db->execute("
                        SELECT is_banned, user_state
                        FROM " . TABLE_PREFIX . DB_USERTABLE . "
                        WHERE " . DB_USERTABLE_USERID . " = '" . $userid . "'
                    ");
                    
                    if ($row = $db->fetch_array($result))
                    {
                        if ($row['is_banned'] == 1 OR $row['user_state'] == 'email_confirm' OR $row['user_state'] == 'moderated' OR $data['isIpBanned']['result'] == true)
                        {
                            $userid = NULL;
                        }
                    }
                }
            }
        }

        return $userid;
    }
You just need to replace this with your get_user_id() function in the includes/integration.php file.
User avatar
zoldos
Customer
 
Posts: 4
Joined: 15 Sep 2022, 10:42

 

by zoldos 18 Jul 2023, 12:52

Ah! Fixed! I was caching sessions. I removed that from my Xenforo config, and the chat came right up. Thank you very much!!! I've been having this issue for literally months.

:)
User avatar
zaja
Free
 
Posts: 1
Joined: 29 Sep 2023, 23:56

 

by zaja 30 Sep 2023, 10:03

The same issue on nginx server, the chat icon appears only if I turn off Redis cashing in the xenforo config file:
Code: Select all
$config['cache']['enabled'] = false;
$config['cache']['sessions'] = false;
$config['cache']['provider'] = 'SV\RedisCache\Redis';
Any workarounds to leave Redis caching enabled and chat that work?
Thanks