You Are Here: Home » How-To » Programming

How To Disable PHP AJAX-Chat For Guest Or Unregistered Users?

By Debjit on February 3rd, 2014 
Advertisement

PHP AJAX-Chat is a cool standalone PHP based chat application framework that lets anyone add a chat functionality on their website for visitors.

We can go on writing way too many things about how good this chat library is and how it does its job very well, however in this article we will limit ourselves to the point of the title here, that is how can we disable Guest users or unregistered users from logging into chat rooms on AJAX-Chat.

You might need to disable Chat for guests for many reasons such as you want the chat to be monitored strictly among community members or may be promote healthy discussions among members. The reason we wrote this tutorial is we were integrating PHP AJAX-Chat with the Question2Answer platform and wanted only registered users to be able to login to the Chatrooms.  So here is how you do it:

Open the config.php file located inside the lib directory of AJAX-Chat and browse to around line number 120

All you need to do is set all the following three parameters to false

$config['allowGuestLogins'] = false;

$config['allowGuestWrite'] = false;

$config['allowGuestUserName'] = false;

Now save the file and reload the chat page. You should no longer be able to login without entering your user details or as a Guest user. Screenshot of the code snippet can be found below:

Disable Guest Logins in PHP AJAX-Chat

Disable Guest Logins in PHP AJAX-Chat

Advertisement







How To Disable PHP AJAX-Chat For Guest Or Unregistered Users? was originally published on Digitizor.com on February 1, 2014 - 5:51 am (Indian Standard Time)