Hi,
This issue is for creating a new Drupal 7 port.
Although phpFreeChat is old, it is still a great tool to setup up a chatbox (or more) without the need to know all the in's and out's of Drupal.
If you like to do more tweaking or heavily rely on security and other great things, try DrupalChat it is way better.
In the attachment is the latest version of my progress. This version is not inline with the dev version, please review both and choose wise.
If you have any questions read post #49 or feel free to contact me: https://www.drupal.org/user/592104/contact
Comments
Comment #1
igorik commented1. try it with 1.3 and you will see if it will be work for you, for me it worked, there was no problem with prototype.
2. than look at the changes between 1.3 and 1.4 (there is 1.5 already) and try find and fix problems and to run it with 1.5 phpfreechat.
3. send the patch here (or whole module) instead zip with with running 6.x version with 1.5 phpfreechat
4. Based on this work, try to create 7.x module
hope it helps for you
Comment #2
Ole Martin commentedSomeone who knows what time this will be ready for Drupal 7. This chat-modul was the best. Know I have too use "drupalchat" bu thar is a payment-solution.
Comment #3
igorik commenteddepends on current activity it seems that it will be not ready in close months...
there is no info about somebody who would take the activity for creating d7 port
btw there is already phpfreechat 2.05
Comment #4
permutations commentedLooks like the last update to this module was the one I uploaded, so it worked with Drupal 6.x.
I'm now updating the site that uses phpfreechat to Drupal 7.x, so I'm going to do a Drupal 7.x update very soon.
Comment #5
permutations commentedComing soon... (I'm updating the site that uses phpfreechat to Drupal 7, so I'll do the port.)
Comment #6
igorik commentedPermutations, this would be soooo awesome to have D7 port.
Looking forward to this, you made my day! :)
Good luck!
Igorik
Comment #7
igorik commentedany progress?
Comment #8
sumeetjaggi commentedI am also looking for a D7 port for this module. If the process is still not initiated please let me know, I would like to take up the porting of this module to D7.
Comment #9
igorik commentedSumeet, this would be great! I think (based on no communication here) that the process wasn't started.
Comment #10
Leeteq commentedComment #11
permutations commentedSorry for disappearing. I've been really sick. Before I can work on this, I need to migrate my site from Drupal 5.3 to Drupal 7. I'm working on that now. Once I'm done, getting PhpFreeChat to work on the site will be urgent, so I will be working on this.
Comment #12
permutations commentedI am very actively working on a Drupal 7 port, so you may want to hold off on this. I'm going to have something very soon - days at most.
Could someone please tell me what that dev file is? I downloaded it, and it looks to be identical to the 6.x-1.1 file I uploaded in 2009. If not, what is the difference?
Comment #13
permutations commentedI'm working on a direct port of the Drupal 6 module (will work with phpFreeChat 1.7, as the Drupal 6 module did), and it's very close to working - a few more days or a week.
Comment #14
permutations commentedNow I've got it as far as "Chat loading, please wait" (but it's hanging).
So many things changed in Drupal 7 - pointless things, pointless name changes, hundreds of them. And not all the changes are documented. This is very difficult. I don't think I could have done it at all if I'd tried earlier. The changes aren't in the Drupal docs. They're in the comments from users.
I don't know why the people who run Drupal have no consideration at all for the people who use it - zero concern for backward compatibility. I use a lot of software, and it doesn't have to be this hard.
Comment #15
tessa bakker@permutations, it's just the beginning of step 4 ;) http://sixrevisions.com/web-development/drupal-learning-curve/
Comment #16
permutations commentedHaha. Thanks - I needed a laugh.
I'm a bit at a loss at this point because I have no more error messages. It just hangs when it loads. You want to take a look? I have a site where I maintain all the Drupal modules for phpFreeChat. You can download the latest 6.x version here, too. I haven't uploaded it here yet because I've been working on 7.x rather than learning Git.
http://permutations.com/drupal/
Comment #17
permutations commentedI'm pretty sure I figured out what the problem is with the alpha of the Drupal 7 port I uploaded. I did some debugging and discovered a path issue - it's not finding certain files. I'm pretty sure once this is resolved, it will be good to go. (I've fixed a few more things beyond what's in the file I uploaded.)
I'm still struggling with health issues so I haven't been able to work on this every day, but I'm feeling okay today and plan to work on it. Hopefully I will be able to resolve the problem this weekend.
Comment #18
permutations commentedI uploaded a new version of the Drupal 7 port to my Web site. Forgive me, but I didn't change the filename. Only one person had downloaded it. It's here:
http://permutations.com/drupal/
I've fixed all kinds of small things in the Drupal 7 port - path errors, other stuff. But it still doesn't load. It gets stuck on "Chat loading, please wait..."
It's a really big pain that phpFreeChat does not put out any useful error messages.
There's also a newer version of the Drupal 6 port on the above site. See the readme.txt file for a list of changes. The Drupal 6 port is still working fine. I just updated it to work with phpFreeChat 1.7 (tiny tweak of a parameter) and fixed some small things. There's a working demo here:
http://www.permutations.com/drup/chatbox
Ha - I know that's working, but when I tried it on my development computer just now, I got "Chat loading, please wait". But it worked fine in a different browser - no worries. Maybe I just need to clear my cache and the Drupal 7 port will work (not).
I'm not going to be able to spend a lot more time on this for a while after this weekend because I have other work that is pressing.
Comment #19
permutations commentedI sent an email to the author of phpFreeChat asking for his help, because the problem seems to be within phpFreeChat, and I don't know how to even look for it.
Comment #20
permutations commentedI haven't heard back from the author of phpFreeChat, but I woke up this morning remembering that there can be a conflict with jQuery. I googled jQuery and Drupal 7, and sure enough, it's new feature. Woo hoo. I'm fairly certain there's a conflict and this is what's preventing it from loading.
I'm not a jQuery expert but I'm looking at workarounds. It may not be fixable.
Comment #21
permutations commentedI'm abandoning the Drupal 7 port project.
phpFreeChat is no longer under active development. There is a Version 2.1 that potentially resolves the jQuery conflict problem in Drupal 7 and higher, but the developer stopped work on it about 2 years ago, and it has very few features. If I pursued the Drupal 7 port, it would be with phpFreeChat 2, but there aren't enough features to make it worthwhile. Also, I don't want to invest any more time into integrating software that is no longer supported. So the Drupal 6 port of phpFreeChat is the last one.
I discovered a bug in the Drupal 6 module last night. When users log out of Drupal, they're not logged out of the chatbox and should be. It's only working because people are timed out after logging off Drupal, but this is messy. I need to figure out how to issue a /quit command programmatically. I have an idea how to do it, but haven't tried it yet.
I'm still prefer to focus more on working code right now than learning Git, so the latest files are on my own Web site:
http://permutations.com/drupal/index.html
I will post this update on the front page, too.
Comment #22
permutations commentedI seem to be talking to myself here. Very few people are still using this module, but I need it, so I'm doing this. For anyone who cares...
I was all "given up" on the Drupal 7 port, but it's back on. I was moving updates I'd made from the Drupal 7 port back into the Drupal 6 port (I did a lot of code clean-up) when I noticed that a small change I made in the Drupal 7 port would cause the Drupal 6 port to hang in exactly the same way ("Chat loading... Please wait"). I can turn it on and off very reliably by just this one thing. So I no longer think this is a jQuery issue. I think it has to do with the very complicated code in handler.php. I couldn't see logically why this separate file was even needed, but it very much is. The chat cannot be created from within the module or it hangs. It has to be created there, and to be created there, all kinds of stuff has to be bootstrapped.
The current sticking point is the new database API in Drupal 7. I have translated database calls throughout the module, but Drupal 7 isn't liking how I translated the call in handler.php.
Comment #23
permutations commentedI fixed all the bugs in handler.php and it still hangs - "Chat loading... Please wait".
The Drupal 6 and Drupal 7 ports are now perfectly in sync - line for line, with function changes as required. It's a direct port, and it works on Drupal 6 but not on Drupal 7. The only reason I can think of is jQuery, which is a much bigger part of the UI in Drupal 7. phpFreeChat 2.x was rewritten to eliminate conflicts, but it has far fewer features and development stopped in 2013. Someone with a deeper understanding of jQuery than I have may be able to get it to load, but I'm done. I can't spend more time on this.
You can get the files from my Web site - I have no time to learn Git to upload them here:
http://permutations.com/drupal/index.html
Warning: I have uploaded new versions of both the Drupal 6 and Drupal 7 modules just now, and I didn't change the version numbers. Only a few people had downloaded them.
Comment #24
tessa bakkerHolly **** It works!
@permutations, if you can give me access to the project as a co-maintainer, I can upload the code into git.
As you can see some code did change for the better and don't mind the @todo's .. they are just todo's
The problem that the chat didn't load was the params for the ajax request, it had the wrong path.
Comment #25
permutations commentedIt works???? !!!!!
Please tell me exactly what you changed in what file. Oh - you uploaded something...
I don't have the ability to make anyone a maintainer.
Also, I'd rather you tell me how to do it than you did it. I did a lot of work on this project, and I'd sort of like to be the uploader.
Comment #26
permutations commentedYou sent the full set of files. Please tell me exactly what you changed. What file, what line?
I would prefer a patch file than to have you upload it as your own project!
Thanks.
Comment #27
permutations commentedI'm doing a file compare, and you did not make the change (whatever it was) in the latest version of the files.
Could you PLEASE tell me just what you changed?? I have spent hundreds of unpaid hours on this project, and I'd really like to know.
Thank you.
Comment #28
tessa bakkerYou can use the latest version of phpFreeChat 1.x en put the folder right into the module folder.
If I was you, I would work on the todo's, it will make your code stronger and easier to maintain.
If you need more help, please setup a 7.x-1.x-dev branch. Sending patches is a lot easier.
Comment #29
permutations commentedOh, you didn't change one thing. You changed many things.
I wish I'd known you were doing this in parallel. I'd have stayed in bed. I've been really sick, and not just with the flu.
Now I feel incredibly discouraged and like I've wasted a lot of time for nothing.
Whoever is the head maintainer or whatever they call themselves can give you access. I have only the lowliest type of access. Then please take over the project.
Comment #30
tessa bakkerLook at phpfreechat.inc r.325 and 326.
You will need the rest of the code or else a node won't save any data into the database.
Comment #31
permutations commentedTessa, while you're fixing stuff...
In hook_user_logout, the user needs to be logged out of the chat. I haven't been able to figure out how to do that. You probably can. The same bug exists in the Drupal 6 version.
Please just take over this project. It is really unpleasant to discover I've been wasting my time. Why were you working on this independently rather than with me??
Comment #32
tessa bakkerOh no, not at all.
I did some clean up before I debugged the problem.
There were to many error's and I needed to be sure that they weren't the problem.
Also I did start after reading your post #21 so I didn't expect any progress on your side.
Sorry for the trouble.
Comment #33
permutations commentedPlease contact the other maintainers about being put on the project. I'm not going to do any more work on it.
Comment #34
permutations commentedI hope you can fix the lack-of-logout bug. It's a problem in both the Drupal 6 and Drupal 7 modules.
Try owahab for getting access. I think that's the person I spoke to. It was a long time ago so I don't remember. I was not given broad enough permissions to make you a maintainer myself.
Comment #35
permutations commentedYour version is not working at all for me. I got this error message:
Error
Error message
PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1: SELECT nid, phpfreechat_enabled, phpfreechat_title, phpfreechat_channels FROM {phpfreechat} WHERE nid IN(); Array ( ) in phpfreechat_node_load() (line 183 of /home/websitename/www/sites/all/modules/phpfreechat/phpfreechat.module).
The website encountered an unexpected error. Please try again later.
Comment #36
permutations commentedRe message 21... I still wish we had been working together. I've been posting very frequent messages about my progress, and it would be hard not to know that I've been uploading new versions to my own Web site. You've been working on this for a long time, and with a much older version of the code - I can tell by looking at your files.
I have been longing for help. If we'd been working together, it would be done already. It's so disappointing how this turned out.
I hope that you do follow through and post a working version of the Drupal 7 port.
Comment #37
permutations commentedTo be clear... I will be putting no more work into the Drupal 7 port. Tessa Bakker has taken over this project.
At some point, I'll learn Git and upload the updated Drupal 6 version that is currently hosted on my own Web site.
Comment #38
permutations commentedOne other note... I'm still working on the Drupal 6 module, fixing some things that were broken (like the Blocks code), because it's the version I'm going to be using on my own site. If no one has taken over the Drupal 6 module by the time I'm satisfied with all the changes and ready to post the update here, I'll do that. Otherwise, I'll just leave it on my own Web site. I'm going to continue to work on this regardless of what anyone else does because I know the code very well and the module is working very well and I need it for my own site (which is the only reason I'm doing this at all).
I have been updating the files on my own Web site fairly frequently, though I haven't been changing the version number because almost no one is downloading it. If that changes, I'll be more careful about that. But you will be able to tell if something has changed because the file dates will have changed. Also, I keep the README.txt file updated.
http://permutations.com/drupal/index.html
Comment #39
permutations commentedI am satisfied with Drupal 6.x-1.2 and will upload it here after I finish some other things and have time to learn Git. In the meantime, you can download it from my Web site here:
http://permutations.com/drupal/phpfreechat6.php
These are the changes (from the README.txt file):
Version 6.x-1.2
---------------
Removed t() functions from phpfreechat.install to comply with later versions of Drupal 6.x (tested on Drupal 6.34).
Minor change in phpfreechat.inc and parameters.txt for compatibility with phpFreeChat 1.7 (prior version had been tested with phpFreeChat 1.2).
Updated the INSTALL.txt instructions to clarify and update some details.
Reformatted all files to comply with Drupal formatting standards.
Chatbox options were not displaying on the "Add content" form when they should have been. Now they are.
The block options were not previously working. Now they are. You can configure blocks showing who is chatting across all rooms, or in up to two specific rooms (configurable).
You can try out the chatbox live here: http://permutations.com/drup/
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I also just updated my direct port of v6.x-1.2 to Drupal 7. You can download it here:
http://permutations.com/drupal/phpfreechat7.php
These are the known problems (from the README.txt file):
Version 7.x-1.0
---------------
Version 6.x-1.2 of the module has been updated to work with Drupal 7.x. This is a direct port, but it is not working. Know problems:
* When you try to launch the chat, you get the phpFreeChat message, "Chat loading... Please wait" forever (it hangs). Since this is such a direct port from 6.x-1.2 (which works) and Drupal 7 makes much greater use of jQuery, I suspect a conflict with phpFreeChat, which uses the jQuery library ProtoType.js. I don't know enough about jQuery to know how to fix this (or if it's fixable). Version 2.x of phpFreeChat was meant to solve this compatibility problem, but development was halted in 2013 when it still only had very basic functionality. phpFreeChat 1.7 has a far better feature set.
* If you create a new content type called "chatbox" and use the per-node settings that let you set the title and channels at the time the node is created, there is an error. This is the code that was fixed in 6.x-1.2 and it works fine there, but there is something different about how node objects are identified. The problem line is identified in the code (hook_form_alter).
* When the user logs out of drupal, s/he also should be logged out of the chatbox, but is not. I don't know how to issue a /quit command programmatically to phpFreeChat, so this remains a TODO. Users eventually time out so it's not fatal, but it's inconvenient. It has been a problem in every version of the module (Drupal 5 and Drupal 6).
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I was hopeful when Tessa said she had gotten the chatbox to work on Drupal 7, but her code doesn't even load for me - there are database errors. My version doesn't throw any errors - it's a problem on the phpFreeChat side. I could be wrong, but I really do think that it's a jQuery incompatibility. If it's fixable, someone with more knowledge of jQuery than I possess will have to do it. Tessa thought there was a path problem, but the lines of code she mentioned were not the problem. I'm very familiar with that part of the code. The files are all being found at this point.
My versions of the Drupal 6 and Drupal 7 modules are in very close sync because I worked on them together. When I found a problem in one, I fixed it in both. It is a very direct port, and it works very well in Drupal 6. This seems like a bad sign to me for a working Drupal 7 version. I hope someone proves me wrong.
I will upload these files (or at least the Drupal 6 version) to this Web site at some point, but I don't have time to learn Git now. I have many other pressing things to do. I hope the work I've done is useful to someone besides myself. I've sure put in a lot of time!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* If you find any PROBLEMS with the Drupal 6 port (v6.x-1.2), please let me know and I'll fix them. This is the version I'll be using on my own site, and I want to know about any bugs so I can fix them.
* If you find any SOLUTIONS to the Drupal 7 port (v7.x-1.0-alpha), please let me know how you did it! After all the time I've spent on this, if someone is able to get the code I just uploaded to actually finish loading the chatbox, I'd be very curious how.
Comment #40
igorik commentedthis discussion is not very clear :)
However, thank you to all for your work on this, for your big effort.
@Tessa Bakker, can you please ask to be a new maintainer and to create new branch?
thank you
Igor
Comment #41
permutations commentedI'm going to upload my files today, so I will create the new tag (for the Drupal 6 version) and the new branch for Drupal 7. I already have Git set up on my computer.
I think it would be useful for people to pull from my latest Drupal 7 version since it's bug-free and very close to working.
Comment #42
permutations commentedThe author of phpFreeChat answered my email this afternoon, and we're working together on the Drupal 7 port issue. That's why I haven't uploaded the files to the site yet. But I will.
He said he is no longer responding to most people's messages about phpFreeChat (which, unfortunately, is dying due to lack of funds), but he remembered that I'd made some contributions to the project so he's offered to help, which is very kind.
Comment #43
permutations commentedI created a new tag for 6.x-1.2 and a new branch and tag for 7.x-1.0-dev, and uploaded the latest code. See the CHANGELOG.txt files for details.
Comment #44
tessa bakkerHi permutations,
Here are some settings you could try, i use them in my dev setup:
I get the chatbox loaded and it works, but images aren't loaded, something with a relative path is misconfigured.
Maybe you can get the images work?
Comment #45
permutations commentedThe paths are all correct - that's not it. If they weren't correct, phpFreeChat wouldn't even begin to load.
You say your fork works, but that was not my experience when I downloaded and tried it. There was a MySQL error - it wouldn't even run.
I just uploaded 7.x-1.0-dev. Could you please pull that and see if you can get that current version of the module to load the chatbox, instead of working on your own fork? I would welcome help on this, and really wish you could put down the fork and work with me instead of in competition.
Thanks.
Comment #46
permutations commentedThe update of 6.x-1.x was my first Git upload, and I messed it up twice before I got it right, so the original 6.x-1.2 files are now called 6.x-1.4.
At first I thought Drupal didn't insert version info in 6.x-1.4, but it did.
Comment #47
permutations commentedGit problems resolved.
Comment #48
tessa bakkerDo you have xdebug turned on and did you look into firebug? There could be a required file or Ajax request that fails. Also be sure that you have set all dev options active in php.ini.
Another thing is dat phpFreeChat place all its settings in it's own caching folder. If you clear the cache in Drupal it won't be removed correctly. So you have to delete it manual.
If everything above won't work, that your code still won't work and you have to fix the paths, settings and debug the hell out of it. And remember, D7 isn't D6.
Comment #49
tessa bakkerHi,
Here is a new port for D7 and almost ready to call it BETA :D
What is changed:
* Libraries module support (no messed up settings)
* JS module support (high performance)
* Status page gives you feedback
* removal of handler.php, this is not the way to go, replaced by menu callback
* And many other small fixes
If you have any problems, delete the files in the folder 'sites/[your site]/files/data/private/cache' and clear the drupal cache 'drush cc all'.
There are many todo's left, i will try to fix them next weekend.
Comment #50
tessa bakkerComment #51
permutations commentedTessa, is there any way to convince you to work with me on the current uploaded code rather than working on your own fork? It's not useful to have two people doing parallel development. If you are given maintainer rights, what will you do - just throw out my work? This behavior is actually a violation of Drupal best practices for module maintenance. We're supposed to be working together, not in competition.
It would be really helpful if you looked at my code - the current code in the repository - rather than continuing to work on your fork. As you know, there are only 3 files with most of the important code - .module, .inc, and .install. Maybe you'll be able to find and fix the loading problem. If you submit a patch with the fix, I will gladly incorporate it with credit to you. That would be very helpful, but what you're currently doing is not helpful.
Next week I'll be working with the author of phpFreeChat on the two chat-related open issues. These are listed in CHANGELOG.txt.
Comment #52
permutations commentedTessa, I produced the first usable version of this module 6 years ago for Drupal 5. When Drupal 6 came out, I ported the module successfully to work with Drupal 6. I'm now working on a Drupal 7 port. This is not an unsupported module as you claimed in your request to be a maintainer. You're trying to take over a supported project. That's not right, and it's not how things are supposed to be done here. Please work with me rather than against me.
I welcome help - that's what open source is all about. Please look at my code and submit a patch if you can fix the problem. That would be very helpful - we could get this project done much faster if you worked with me. But your working on a competing version is not helpful, and not very friendly, either.
Comment #53
tessa bakkerYour code doesn't work and your code contains so many problems that I tried it once, it failed, so I changed it all.
That's the beauty of Open Source with a GPL license.
You can accept my help and learn from it or choose your own way and stick with your code.
And if you want to discuss any other thing except for the problem itself in this issue 'a port for D7' send me a e-mail, but don't spam in the issues.
Thanks :)
Comment #54
igorik commentedTessa, thank you very much for your effort!
It sounds amazing - Libraries module support, JS module support, menu callback, these are great performance addons.
@Permutations, IMHO it could be great to cooperate with others to have one - the best module. If you will find that in Tessa module is missing something good from your module, you can add it there. So far it looks for me that Tessa performance changes (libraries, callback, etc) are more close to D7 philosophy then simply rewrite module from D6 version.
Looking forward to test it! Thank you to both of you for your work on this module.
Igor
Comment #55
tessa bakkerHi all,
I'm very curious how you use the phpfreechat nodes. Do you create a node as a server with multiple chatrooms (channels).
Or is every node a seperate chatroom (channel) in one server.
I could make both options an option, but It has some consequense for the Block integration or maybe Views..
Please let me know.
Comment #56
igorik commentedAbout using phpfreechat nodes - I used in on D6 2 years ago so I am not sure, but I used only one phpfreechat page, so there was everything connected with phpfreechat.
However, I have no preference about this.
While there could be a view with list of the chatrooms (and with number of visitors in each of this chatroom), it would be amazing feature.
Comment #57
tessa bakker@igorik, Thanks for your response.
I think we can safely say, that one node = one channel. This way we can read all users on the server or in one node (chat room) with ease. Also the setup will be very clean for new phpfreechat users.
In the upcoming "release", the config is a lot cleaner and you can use the chatbox as a real field in any view mode.
I believe this module must be very easy for even a beginner or advanced enough for the more experienced user.
Comment #58
permutations commentedIronically, I'm probably the only person here who is using this module on an important production Web site. My Web site is mentioned in multiple books, and I've been interviewed about it by the BBC, PBS, and other news outlets. I am invested in this module because it's a critical part of my site.
The last version of Tessa's code I tried did not even load. This newest version is even worse. It requires that I install an additional module (I don't see this as a plus). And there are many errors. When I go to the Configuration page, I get this error:
Notice: Undefined index: server_script_url in phpfreechat_settings_form() (line 504 of /home/mysite/www/www/sites/all/modules/phpfreechat/includes/phpfreechat.admin.inc).
I try to save a default Chatbox title and room, and get these errors:
Notice: Undefined index: server_script_url in phpfreechat_settings_form() (line 504 of /home/mysite/www/www/sites/all/modules/phpfreechat/includes/phpfreechat.admin.inc).
Notice: Undefined index: server_script_url in phpfreechat_settings_form() (line 504 of /home/mysite/www/www/sites/all/modules/phpfreechat/includes/phpfreechat.admin.inc).
I create a new content type for chatbox, and get this error:
PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1: SELECT nid, phpfreechat_enabled, phpfreechat_title, phpfreechat_channels FROM {phpfreechat} WHERE nid IN(); Array ( ) in phpfreechat_node_load() (line 222 of /home/mysite/www/www/sites/all/modules/phpfreechat/phpfreechat.module).
>>>>>> And now my site is frozen and the only way I can get it back is to manually delete the phpFreeChat module files from the server. <<<<<<<
-----------------
IGORIK - DO NOT PASS JUDGMENT ON SOMEONE'S CODE BEFORE YOU HAVE TRIED TO RUN IT.
I wouldn't even upload code that is as buggy as Tessa's code.
You people are putting me in a very difficult position because I truly *NEED* this module. I wish another programmer would work with me on the Drupal 7 port I uploaded and see if we can, together, get it to work. Tessa talks a good game, but HER CODE DOES NOT COME CLOSE TO WORKING. RUN IT!!!!!!!!
Run hers and run mine, and see which one you want to go with - judge that way.
Comment #59
tessa bakker@permutations, I'm sorry to hear that you got stuck again.
For me, this port is just a hobby to learn some new things. I'm not programming to make this module profitable, but to make this module great, without any security problems or bad Drupal hacks.
To answer all your questions and to take away your worries:
Installing 'Libraries' is a big plus, coding will become a lot easier. If you upgrade this module in the near future, you won't be worring about overwriting the library.
The settings form isn't ready yet. My code is still alpha and not ready to use on a production site.
But if you use it in a new clean D7 environment, it should work out of the box without any custom settings.
The PDOException is already fixed in the upcoming release.
If you see a WSOD, use 'drush cc all' and remove the files in the 'cache' folders to fix it. The hook_flush_cache has a few problems that I'm aware of. I hope to fix this asap.
Thank you for helping me with testing the code and sending feedback.
Comment #60
permutations commentedTessa, what version of phpFreeChat are you using (the third party software)? Are you using phpFreeChat 1.7 (or any 1.x version), or phpFreeChat 2.x?
I installed the module on a test site that is a clean installation of Drupal 7 with almost nothing else on it.
Comment #61
permutations commentedTessa, I am starting to suspect that you are writing a module for the never-completed phpFreeChat 2.x. The Libraries API is for plug-ins. phpFreeChat 1.7 - the feature-complete version - is not a plug-in. The 2.x rewrite is, but it was never finished and is not feature-complete. This project was abandoned 2 years ago, and is just a skeleton of a chatbox with no icons, no options, and no many-other-things. phpFreeChat 2.x has so few features that it does not warrant a Drupal module - just about any other chatbox would be a better choice. I would not use it on my site. If you are writing a module for phpFreeChat 2.x, I think you are wasting your time. phpFreeChat 1.7 is the mature chatbox with the great feature set.
I've said many times that I believe the reason my D7 module hangs when the chatbox starts to load is because there is a jQuery conflict with Drupal 7. The chatbox is known to hang during loading when the theme conflicts, and Drupal 7 uses jQuery much more extensively - even in the most vanilla themes. I'm almost certain that's why my port doesn't load. igorik may not like straight ports, but the fact that the Drupal 6 version works perfectly, as demonstrated here:
http://permutations.com/drup/
...and the Drupal 7 version - a direct port - hangs on load, strongly suggests that the enhanced use of jQuery in Drupal 7 is causing a conflict. It is for these reasons that I've said this module probably can't be ported to Drupal 7 unless someone with very good jQuery skills and knowledge of its enhanced use in Drupal 7 can resolve the conflict.
The reason phpFreeChat 2.x was written was to resolve these kinds of conflicts. There would be no loading problem with phpFreeChat 2.x. But it's not a good enough chat program to actually put into use. I thought about changing my module to use that version, but when I tried it out, I saw that the feature set was so thin that it wasn't worth doing.
Please confirm the version of phpFreeChat that you've been using with your fork of the module.
Comment #62
permutations commentedP.S. If you've been testing other versions of the chatbox, you will have to clear your cache to get the Drupal 6 version to load.
Comment #63
tessa bakkerIt will only work with version 1.7, please look at the code and check the status page for any errors or warning with your installation. I'll be uploading a new and better version in a day or two.
Comment #64
permutations commentedIf your fork is written for phpFreeChat 1.7, then I can't account for the level of problems I encounter with it. It causes my test site to completely freeze, and I certainly can't launch a chatbox. After I install the module, I am taking the minimum steps necessary - setting permissions and creating a content type that contains a chatbox. Even these basics don't work, so I don't understand your claim that you've been able to launch a chatbox. When you said you had a working version of the Drupal 7 module I was ready to go with your version, but as far as I can tell, what you have is very far from working, and I'm not sure that repeatedly testing such buggy code is a good use of my time.
Please list the exact steps you take after installing your fork that allow you to launch a chatbox.
Comment #65
permutations commentedI found the problem!!!! The chatbox is loading on Drupal 7. It was not a jQuery conflict - it was something else.
I will upload a release version - WORKING CODE - tonight. I just need to make things pretty.
I will also install it on a test site so you can SEE THAT IT WORKS, for real (not just saying), in living color. PROOF. Woo hoo - we have a port!!
Comment #66
permutations commentedA demonstration site with a working version of the phpFreeChat module ported to Drupal 7 can be found here:
http://drup7.permutations.com/
I'm looking at a couple of other things, and then I'll upload it. I like to only upload code when it's as clean as possible. I don't want to waste anyone's time.
Comment #67
permutations commentedI solved a problem that's been really bothering me on my own site. I figured out how to programmatically issue a phpFreeChat /quit command, so that when a user logs out of Drupal s/he is also logged out of the chat. If this is not done, the user stays logged into the chat in an unreachable way until timed out. So if the user logs out then logs back in from another computer, s/he may not be able to access the chat - will get an error message saying "name already in use". I raised the timeout parameter on my site quite a bit because people like to hang out in the chatbox all day, so it could take a long time to time out of the chat. Finally this is fixed.
I will be fixing this in the Drupal 6 module as well.
It's 2am and I need to go to sleep. I have clients in the morning. I still want to look at a few other things before I upload the code, but you can see a WORKING version of the Drupal 7 port on a test site here:
http://drup7.permutations.com
Try logging out then logging back in and accessing the chatbox. It works! It even works if you aren't in the chatbox when you log out.
Comment #68
permutations commentedTessa asked:
> I'm very curious how you use the phpfreechat nodes. Do you create a node as a
server with multiple chatrooms.
> Or is every node a seperate chatroom in one server.
> I could make both options an option, but It has some consequense for the
Block integration or maybe Views..
You said you were working on this as a hobby for yourself, so maybe you still want to know this. On my site, there is one chatbox with multiple chatrooms (channels). Two chatrooms are created by default, and users create other channels themselves for special purposes. Plus there are private channels for private conversations. One node, many channels.
I changed the blocks so there are 3 options:
1. Who is chatting in any chatroom.
2. Who is chatting in chatroom1 (specified in the block configuration).
3. Who is chatting in chatroom2 (specified in the block configuration).
On my site, I do not want the content of the conversation displayed in a block. It is only useful for people to see that there are others in the chatrooms, and which rooms. The blocks are working in the Drupal 6 version and you can see a demonstration here:
http://permutations.com/drup/
If you create several accounts and log into the chatbox simultaneously from multiple browsers, you can see how the blocks list who is where. You may have to refresh the page.
The block code is not yet working in the Drupal 7 port, and there are a couple of other small things that aren't working quite right, as well. The problems are all small - the module is usable, as the demo page shows.
http://drup7.permutations.com
I will continue to work on it and resolve the remaining problems, but I will make the working code available while I do. I want to upload it as a beta, rather than an alpha - coded "yellow" rather than "red". I hope I'll be able to figure out how to do that in Git.
Comment #69
permutations commentedI uploaded a new version of the Drupal 6 port (6.x-1.5) that quits the chatbox when you log out of Drupal.
I also uploaded new version of the Drupal 7 port (7.x-1.0-rc1). The chatbox is now fully operational, and this version, too, quits the chatbox when you log out of Drupal.
Additional details on both versions are in the CHANGELOG.txt files.
Since we now have a working Drupal 7 port, I will mark this issue closed.
Comment #70
permutations commentedWorking Drupal 7 port is available for download.
Comment #71
igorik commentedWhy to close this issue so fast? Without reviews from others?
And while Tessa would like to help and she will add new version with a lot of improvements, or just the improvements as a patch, there is no sense to close this issue.
I think this is really strange behaviour what you are doing here Permutations - you want to so much to be only one who is working on this module, and to defeat any others - but this is not open source behaviour.
While Tessa will come with new ideas, new features, we could help her at most, and the winners will be everybody who will be using this module, because it can be better and better, with new improvments.
Comment #72
permutations commentedMy intent is not to stop feedback or input from others. Anyone can open an issue, and I've always invited input from others. When I struggle with problems, I openly ask for help from others. I only closed this particular issue because it is for a FORK. Tessa wanted to take over maintenance of this module because she said it was unsupported (and requested to be a maintainer on this basis). This is not the case.
I uploaded the working Drupal 7 port as a release candidate because there are two minor open issues. See the CHANGELOG.txt file for details. If Tessa would like to help me with these open issues, I would be very grateful. I am also grateful for any testing she or anyone does. But it would be better to address these issues in a separate issue thread. This one is full of acrimony and controversy, and the issue it opened is now closed.
Comment #73
tessa bakkerHi permutations,
Here is a report of 7.x-1.0-rc2 (file: phpfreechat.module) it contains blockers to go stable:
* Security issues (https://www.drupal.org/writing-secure-code)
* Coding standards (https://www.drupal.org/coding-standards)
phpfreechat_menu()
* phpfreechat.module:30 & phpfreechat.module:42
** permission 'admin phpfreechat' is missing in hook_permissions()
* phpfreechat.module:26 phpfreechat_menu()
** menu item should be 'node/%node/nuke' in this way 'page argument' can be array(1)
phpfreechat_nodedata()
* phpfreechat.module:88
** else isn't needed because of the first return a return FALSE is sufficient
phpfreechat_form_alter()
* phpfreechat.module:99
** global $user isn't used and can be removed
* phpfreechat.module:107
** if statement can be moved to hook_form_FORM_ID_alter() > phpfreechat_form_node_type_form_alter()
phpfreechat_prepare_params()
* phpfreechat.module:584
** use $account instead of $target, $account and $user are known user objects
* phpfreechat.module:585
** global $user isn't used and can be removed
* phpfreechat.module:605
** check_plain is missing, XSS is possible
* phpfreechat.module:610
** check_plain is missing, XSS is possible
* phpfreechat.module:613
** check_plain is missing, XSS is possible
* phpfreechat.module:619
** check_plain is missing, XSS is possible
* phpfreechat.module:623
** check_plain is missing, XSS is possible
* phpfreechat.module:628
** check_plain is missing, XSS is possible
* phpfreechat.module:631
** check_plain is missing, XSS is possible
phpfreechat_room()
* phpfreechat.module:657
** global $base_url isn't used and can be removed
* phpfreechat.module:671 / 672
** $params is defined but never used this makes the code run slower than needed
* phpfreechat.module:709
** $user->uid == 0 can be replaced with user_is_anonymous()
* phpfreechat.module:713
** drupal_set_message returns a 'success' message, but status 'warning' or 'error' is more appropriate
* phpfreechat.module:722
** NEVER end a php file with '?>' this can make your Drupal installation crash (WSOD)
This is only the phpfreechat.module, if the issues above are fixed I can review other files.
If you needs tools for a quick review, use 'coder' with the sub module 'coder_review'.
I hope it helps to get you to a stable version.
Comment #74
tessa bakkerBtw, I really like the idea of what you did with the 'auto logout'-fix aka _phpfreechat_quit()
Comment #75
permutations commentedThank you very much for your feedback! I will look at your notes in detail, and fix what needs to be fixed.
This afternoon I discovered at least part of the problem in the block code - why it isn't displaying the list of users. It's not solved yet, but it's closer.
Comment #76
tessa bakkerAfter looking at the settings, your _phpfreechat_quit() function isn't needed at all.
Try the following combination of settings and it works perfect.
Timeout = 4000 (something more than 2 times the Refresh Delay)
Quit On Closedwindow = True
Comment #77
permutations commentedTessa, the "quit on closed window" setting isn't a solution for two reasons:
(1) People sometimes log out without closing the window, and
(2) It doesn't work reliably. From the phpFreeChat documentation:
Setting this to true will send a /quit command when the user closes his/her window. However:
* It doesn't work on Firefox.
* On IE and Konqueror/Safari, reloading the window (F5) will generate the same event as closing the window which can be annoying.
Thus the default value is false.
Also, on my live site, the Timeout value is set to 300000. With lower values, users are timed out too frequently for the way this chatbox is used.
Comment #78
permutations commentedTessa, I'm looking at that long list you posted. Apparently it's output from coder? It's generally very trivial stuff. Things like declaring $user or $base_url as a global but not using it are not optimal, but they're not going to "affect stability" as you claim. I'd rather spend time on fixing the important stuff - getting those two last features to work - but I'll go through the list and make the tweaks.
I can't run coder because I don't have command line access on my server. Well, haven't had. I can request it.
Comment #79
permutations commentedSpeaking of coding standards... The Drupal API ought to use assertions to check for and deal with bad input - especially since they change the input required in functions from version to version without changing the names of the function. That was why my block code wasn't working, and I had no errors or warnings.
Comment #80
permutations commentedTessa wrote:
-----------------
phpfreechat_menu()
* phpfreechat.module:30 & phpfreechat.module:42
** permission 'admin phpfreechat' is missing in hook_permissions()
-----------------
FIXED. (hook_permission, not hook_permissionS)
Tessa wrote:
-----------------
* phpfreechat.module:26 phpfreechat_menu()
** menu item should be 'node/%node/nuke' in this way 'page argument' can be array(1)
-----------------
IT'S WORKING FINE AS-IS. THERE'S AN EXAMPLE THAT LOOKS EXACTLY LIKE HOW THIS IS CODED ON THE API PAGE RIGHT BEFORE THE COMMENTS:
https://api.drupal.org/api/drupal/modules%21system%21system.api.php/func...
Tessa wrote:
-----------------
phpfreechat_nodedata()
* phpfreechat.module:88
** else isn't needed because of the first return a return FALSE is sufficient
-----------------
INCORRECT. THIS IS A CUSTOM FUNCTION, AND I'M VERY FAMILIAR WITH HOW IT'S CALLED AND USED WITHIN THE MODULE. IT NEEDS TO RETURN TRUE OR FALSE.
Tessa wrote:
-----------------
phpfreechat_form_alter()
* phpfreechat.module:99
** global $user isn't used and can be removed
DONE.
Tessa wrote:
-----------------
phpfreechat_form_alter()
* phpfreechat.module:107
** if statement can be moved to hook_form_FORM_ID_alter() > phpfreechat_form_node_type_form_alter()
???? (1) THERE IS NO HOOK BY THAT NAME LISTED IN THE DRUPAL 7 API. (2) IT HAS WORKED CORRECTLY WITHIN THIS FUNCTION SINCE DRUPAL 4.
Tessa wrote:
-----------------
phpfreechat_prepare_params()
* phpfreechat.module:584
** use $account instead of $target, $account and $user are known user objects
????
(1) STATEMENT DOESN'T MAKE SENSE.
(2) NEITHER $account NOR $target ARE DRUPAL GLOBALS: https://api.drupal.org/api/drupal/globals/7
(3) HAS WORKED FINE SINCE DRUPAL 4
Tessa wrote:
-----------------
phpfreechat_prepare_params()
* phpfreechat.module:585
** global $user isn't used and can be removed
DONE.
Tessa wrote:
-----------------
* phpfreechat.module:605
** check_plain is missing, XSS is possible
* phpfreechat.module:610
** check_plain is missing, XSS is possible
* phpfreechat.module:613
** check_plain is missing, XSS is possible
* phpfreechat.module:619
** check_plain is missing, XSS is possible
* phpfreechat.module:623
** check_plain is missing, XSS is possible
* phpfreechat.module:628
** check_plain is missing, XSS is possible
* phpfreechat.module:631
** check_plain is missing, XSS is possible
DONE.
Tessa wrote:
-----------------
phpfreechat_room()
* phpfreechat.module:657 <<========== WRONG MODULE & LINE #
phpfreechat_room()
** global $base_url isn't used and can be removed
DONE.
Tessa wrote:
-----------------
* phpfreechat.module:671 / 672 <<========== WRONG MODULE & LINE #
** $params is defined but never used this makes the code run slower than needed
REMOVED.
Tessa wrote:
-----------------
* phpfreechat.module:709 <<========== WRONG MODULE & LINE #
** $user->uid == 0 can be replaced with user_is_anonymous()
THAT DOESN'T ADD CLARITY (GIVEN THE CONTEXT), AND IT WOULD MAKE THE CODE RUN A LITTLE SLOWER.
elseif ($user->uid == 0) {
$output .= t('Please !login to chat', array('!login' => l('login', 'user/login')));
}
Tessa wrote:
-----------------
* phpfreechat.module:713 <<========== WRONG MODULE & LINE #
** drupal_set_message returns a 'success' message, but status 'warning' or 'error' is more appropriate
FIXED
* phpfreechat.module:722
** NEVER end a php file with '?>' this can make your Drupal installation crash (WSOD)
IT DOESN'T CAUSE CRASHES. IT DOES CAUSE PROBLEMS WITH COLOR CODING IN THE EDITOR. I KNOW IT'S AGAINST THEIR STANDARDS. IT'S AGAINST MY STANDARDS FOR AN API TO CHANGE INPUT REQUIREMENTS WITHOUT ASSERTION CHECKING. BUT I'LL REMOVE IT.
====================
I'll upload a new release in a little while. I want to work on some other things first.
I requested command-line access on one of my servers so I can run drush and coder.
Comment #81
permutations commentedAll mentioned issues are fixed in RC3, which I just uploaded.