phpfreechat - default channels and title not loaded (not writing to phpfreechat table in db)
| Project: | phpfreechat |
| Version: | 5.x-1.0-rc4 |
| Component: | Code |
| Category: | bug report |
| Priority: | critical |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
I'm running Drupal 5.7 with phpfreechat 1.1.
phpfreechat is supposed to save some crucial pieces of data in a MySQL table called phpfreechat. The INSERT code is called from within a nodeapi hook function. It's either never getting called or it's failing silently because nothing is being saved to the MySQL table. I've changed and saved the phpfreechat settings and there have been lots of chats on my site, but the table remains empty.
And, not surprisingly, the phpfreechat features that depend on the data in the table are failing:
- Default channels are ignored. When you try to set them you get an error that a parameter is missing.
- Default titles are ignored - you get the default phpfreechat title rather than what you specify or the title of the node, which is what's supposed to happen.
- phpfreechat blocks don't display properly because they depend on the node id (nid) from the database for identification, and the field does not exist.
I'm not familiar enough with Drupal modules in general or phpfreechat code in particular to take this any further, but I'm pretty sure I've identified the source of a range of problems that's reported in half a dozen different bug reports. Could someone take a look at this, please?

#1
Could someone please answer?
#2
I found where the data is stored. It's in the variables table. I don't know why it creates a table called phpfreechat and then doesn't use it.
Still, there are these two problems - default channels (though saved) aren't loaded), and block info isn't displayed (blocks are empty).
#3
The problem of blocks not displaying is posted in another bug report:
http://drupal.org/node/205091
So I'll restrict this one to the problem of default channels and titles being ignored. I don't know whether this is related to the phpfreechat table being empty because I haven't yet figured out what it's supposed to be used for - maybe it's just for the MySQL container?
I wish the module author would respond, and at least explain how things are supposed to work. That would help me find the bugs myself.
#4
Okay - not all the information is stored in the variables table. The node info - the stuff that's supposed to be in the phpfreechat table - is not stored. This empty table is a bug.
I wish someone would either fix this, or describe a bit of the module structure so I can fix it. I'm a strong PHP programmer, but haven't written any Drupal modules. (I have written themes, and know the basics about hooking, etc.).
#5
I found and fixed this bug. The function phpfreechat_nodedata in phpfreechat.module has a variable name specified incorrectly (two components are flipped). Change this:
function phpfreechat_nodedata($type) {if (variable_get('phpfreechat_nodeapi_'.$type, 'never') == 'pernode' ||
variable_get('phpfreechat_nodeapi_'.$type.'_custom', '') == true) {
return true;
}
}
to
function phpfreechat_nodedata($type) {if (variable_get('phpfreechat_nodeapi_'.$type, 'never') == 'pernode' ||
variable_get('phpfreechat_nodeapi_custom_'.$type, '') == true) {
return true;
}
}
Then, if you have enabled node-specific data, the phpfreechat table will be created.
The defaults still don't work, but the node-specific channels and title will load. I haven't found what causes the bug in ignored defaults.
#6
I fixed the problem with the default channels. The code is here:
http://drupal.org/node/187468
#8
Thanks permutations for your effort.
Fixed.
#10
I have a version of the phpFreeChat module on my Web site that fixes many different bugs. I just updated it today. If owahab makes me a module maintainer here on Drupal, I'll integrate the changes here and stop posting them separately:
http://permutations.com/drupal/phpfreechat.php
owahab - please stop deleting this link. It is not helpful to the community.
#11
I just uploaded a new version (http://permutations.com/drupal/phpfreechat.php).
I backed out setting the default timeout to 35000 in the module. It's not working because the "negative number" error is still happening after clearing the cache (/rehash). The timeout needs to be changed to avoid disconnects, and the easiest way to do this is to change it directly in pfcglobalconfig.class.php. phpFreeChat has an integer check in there, and Drupal's form API doesn't have an integer type. I tried to identify the integer strings and change them and it worked in a test file, but not in the module.
pfcglobalconfig.class.php is in the phpFreeChat src directory (it's not a module file).
To change the default timeout, find this variable assignment and change the 20000 to 35000:
var $timeout = 35000;To get rid of the negative number error, comment out this code in pfcglobalconfig.class.php:
/*$numerical_positive_params = $this->_params_type["positivenumeric"];
foreach( $numerical_positive_params as $npp )
{
if (!is_int($this->$npp) || $this->$npp < 0)
$this->errors[] = _pfc("'%s' parameter must be a positive number", $npp);
}
*/
#12
Automatically closed -- issue fixed for two weeks with no activity.