Hi, so I found out why my chatrooms werent working. In my setup, I want certain user/roles to have a their own chatroom auto-created on registration...

hook_user($op, &$edit, &$account, $category = NULL) {
if ($op == 'insert') {
if (($edit['user_roles'] == 4) || ($edit['user_roles'] == 5)) {
$node->title = $account->name;
$node->type = "chatroom";
$node->uid = $account->uid;
$node->status = 0;
node_save($node);
}}

This code creates the chatroom fine, and initially they appear to work, but messages dont update.

However, looking at the default value inserted into the chatroom mysql table, I assume they aren't functional default values:

select * from chatroom;
+-----+-----------+-----------+--------------------+----------------+----------+---------------------------------+-----------------+-------------------+-----------+
| nid | poll_freq | idle_freq | kicked_out_message | banned_message | module | previous_messages_display_count | profile_picture | imagecache_preset | max_users |
+-----+-----------+-----------+--------------------+----------------+----------+---------------------------------+-----------------+-------------------+-----------+
| 139 | 1000 | 60000 | NULL | NULL | chatroom | 20 | 0 | | 0 |
| 144 | 1 | 60 | | | chatroom | 20 | 0 | 0 | 0 |
+-----+-----------+-----------+--------------------+----------------+----------+---------------------------------+-----------------+-------------------+-----------+

In this example, node 139 is autocreated by my php and 144 is created from the admin menu. 139 doesnt appear to update, 144 does.

I've posted this to help others, and perhaps suggest a change to the default values in the next major code role. The immediate solution for me was just add into the hook code:

$node->poll_freq = 1;
$node->idle_freq = 60;

:)

Comments

Anonymous’s picture

Status: Active » Fixed

thanks for the report, i've committed a fix here:

http://drupal.org/cvs?commit=393094

Status: Fixed » Closed (fixed)

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