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?

Comments

permutations’s picture

Priority: Normal » Critical

Could someone please answer?

permutations’s picture

Title: phpfreechat module is not saving its data - causing a variety of problems » phpfreechat - not loading default channels, not displaying block info

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).

permutations’s picture

Title: phpfreechat - not loading default channels, not displaying block info » phpfreechat - default channels and title not loaded

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.

permutations’s picture

Title: phpfreechat - default channels and title not loaded » phpfreechat - default channels and title not loaded (not writing to phpfreechat table in db)

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.).

permutations’s picture

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.

permutations’s picture

I fixed the problem with the default channels. The code is here:

http://drupal.org/node/187468

permutations’s picture

I fixed all the bugs in the phpfreechat module (a few more than are listed above), updated the module version to 5.x-1.1, and posted the full package on my Web site.

I emailed the original author of the module about creating a new download, but he never answered me. There were too many changes to track of as individual patches.

owahab’s picture

Status: Active » Fixed

Thanks permutations for your effort.
Fixed.

permutations’s picture

There's a new version with two additional fixes on my Web site (along with many other fixes).

permutations’s picture

permutations’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.