Comments

mfredrickson’s picture

Title: Buddylist Form Update 1: buddylist_user » Update 2: Settings
StatusFileSize
new6.18 KB

Instead of creating a bunch of issues, I guess it would probably be easier to create one issue, and then post progressive updates. Attached is a patch to update the forms in the buddylist settings.

It is a patch against CVS (20051123) that includes the changes in the first patch I uploaded. If someone only wants the settings changes (though I don't know why), contact me and I'll provide it.

mfredrickson’s picture

StatusFileSize
new5.17 KB

Here's a patch matching current HEAD. Arg for updates. ;-)

Ps. Can somebody review this? It needs to get into head soonish.

mfredrickson’s picture

Title: Update 2: Settings » Getting Buddylist ready for 4.7
StatusFileSize
new7.24 KB

Yet another patch. This gets the buddylist functionality actually working. Though I don't pretend the methods of form validation are actually best practice. In reading the forms API guide, the validation code should be factored out so we don't have to grab $_POST anymore. But one thing at a time...

This patch is pretty usable. I am hoping people actually start using it.

Cheers,
-Mark

scroogie’s picture

Great news, thanks for your work.

flufftronix’s picture

Hmm.. this [most recent, 11/28] patch seems to reduce the number of errors that occur, but there are still two occurences of form_item which breaks looking at other users' profiles.

flufftronix’s picture

Oh, no, wait, I forgot to apply the first patch. My bad!

flufftronix’s picture

Status: Needs review » Active

Sorry for posting so little content at such high frequency, but I have an update..

SO, I've tried to apply all these patches to buddylist.module with lackluster results. Adding buddies is broken, as well as the administration screen. form_select is still in the module numerous times and is apparently an undefined function in 4.7.

Maybe, if anyone has this working under 4.7 they could do a diff of their .module versus the one in cvs right now? Because if it's possible to patch this file four times and get it working in 4.7, it's certainly beyond me.. :(

macgirvin’s picture

The diff arguments were backwards creating the patch. When patched, the newly inserted lines are removed and the original ones re-instated. Maybe my patch program has an argument to reverse the roles. Mark (?) - could we get a new diff?

macgirvin’s picture

StatusFileSize
new7.49 KB

With Unix patch you can use '-R' to apply the backwards diffs. I've done this and created a patch that should be able to be used directly. This contains the 20051128 patch, which looks like it is a rollup of all the others.

macgirvin’s picture

StatusFileSize
new10.91 KB

Now that I've applied the previous patch and actually tried it, found several things that weren't quite right. Seems it only works for the admin and not mortal users. I've changed it so that folks with suitable access can actually add and remove buddies without getting 'page not found' errors and double escaped forwarding URL's and lots of other lovely surprises. Check your access rights because there appears to be two conflicting methods of specifying 'can add/remove buddies'. Rather than wholesale slaughter of the module to use one or the other and get it right, I just used both settings.

This will probably cause a permission related bug somewhere, but at this point I'm only trying to get it working with basic functionality on 4.7. This module needs some (a lot) more work. Also corrected some text which wanted you to confirm adding a buddy - except that the text appears when you're deleting a buddy. This is not an incremental patch. It is a complete patch to cvs HEAD of 12/25/2005.

macgirvin’s picture

StatusFileSize
new12.52 KB

Looks like 4.7b3 user API changed somehow and my previous patch broke. So here it is again.

This time I've also resolved the conflicting admin rights, and ensured that the user page UI can be translated. Once again, this is a complete patch against the current CVS version of the buddylist module for Drupal 4.7 beta 3 as of Feb. 1, 2006.

macgirvin’s picture

There still appears to be a forms api issue with the buddylist group edit page. Not certain I have the forms API expertise to fix this one (mixed formdata&otherdata inside a table within a form). Function is buddylist_buddiesgroups_form - can anybody else help?

merlinofchaos’s picture

The easiest way to do that is to put the 'other data' in #type => value fields, and then put the items in a table in theme_buddylist_buddiesgroups_form().

This technique is demonstrated here

Amazon’s picture

Thanks for porting this module. I move the forms comment to a page here: http://drupal.org/node/47582

Let me know if that doesn't answer your questions.

Kieran

macgirvin’s picture

StatusFileSize
new17.23 KB

OK, I think I figured out the technique. Applying it to this particular chunk of code turned out to be challenging. I don't claim that this is pretty code, but it now seems to work. Buddies, buddy groups, and I also fixed the SQL for displaying buddy posts. (Repeated the same post for every group the buddy is in). You really don't need to see the same post repeated over and over.

I think I'll be bold enough to call this patch 4.7 ready; though I think that claim has been made before. At least it's a launching point for the next round of bugs. Would anybody like to review it and check it in, or have all the buddylist developers jumped ship?

mfredrickson’s picture

I started this ("created this monster" perhaps). I'm happy to review. I'll try to take a look this weekend.

macgirvin’s picture

StatusFileSize
new17.27 KB

Sigh - all the above patches plus a fix for node/47592, a WSOD on editing buddy groups if you have no buddies. Since I was just mucking with this section of code moments ago, it wasn't too difficult to get that bug straightened out as well.

macgirvin’s picture

StatusFileSize
new17.55 KB

Wish I could just put this thing to rest. But as it turns out, the display of 'Buddies' names didn't make it through whatever happened with 4.7b3 last week either. So this will show an actual 'buddies' name rather than 'Object #5' or some such nonsense.

macgirvin’s picture

StatusFileSize
new19.62 KB

This started out as what I thought was a simple exercise in forms upgrade. Oh what fun finding bugs... many of which have been there all along.

The latest bug fix to be applied to this (now) mondo patch relates to having a buddies recent posts block, but you've lost all your buddies through some social calamity or whatever. This unfortunate event means that you don't have any buddies to populate the recent posts block. It also means that you're going to see an SQL error in the logs for every single time you access a page. This is because $str_buddies is an empty string, and therefore produces an empty parenthetical set. An empty parenthetical set in SQL is not allowed.

I've taken care of it for you...

webchick’s picture

Status: Active » Needs work

Changing status to patch, since that's what it is (hopefully will get more attention that way).

I tested this by creating a user @ administer >> users and then adding that user as a buddy.

Now when I go to the edit groups page, I receive:

warning: implode() [function.implode]: Bad arguments. in D:\xampp\htdocs\bl-head\includes\form.inc on line 240.
warning: implode() [function.implode]: Bad arguments. in D:\xampp\htdocs\bl-head\includes\form.inc on line 240.

The groups functionality does appear to work though apart from that. Not sure if this is a momentary bug with HEAD or if it's something with the way the form is written.

In case it helps track it down, line 240 of form.inc is part of function form_get_error($element) and reads:

$key = implode('][', $element['#parents']);

mfredrickson’s picture

Status: Needs work » Needs review
StatusFileSize
new19.28 KB

Attached is a patch against buddylist HEAD (as of 2006-02-05).

It rolls the previous patch(es) with a fix to the problem listed above. The problem was that creating forms in tables is much harder now than it used to be. This patch turns the group editing into three functions: one to create the form, one to theme it, and one to submit it. This convention more closely follows the new forms API specs.

With this patch, buddylist is almost there. Please review and comment.

Cheers,

-Mark

macgirvin’s picture

The problem was that creating forms in tables is much harder now than it used to be.

Ya' got that right... Thanks!

macgirvin’s picture

I've fired up buddylist.patch.20060205 and I'm good to go with it. Angela, is the group edit working for you? I wasn't seeing that bug over here.

robertdouglass’s picture

im in the airport in frankfurt... my time in the plane was spent converting this module to 4.7. will compare implementations and possibly merge patches 2morrow. too bad i didnt have internet in the pkane... would have avoided double effort.

robertdouglass’s picture

StatusFileSize
new26.12 KB

Here's a copy. I combined several things from my work and the last patch. Fortunately, the place where the patch had done the most work was in the buddy groups area, and the biggest improvment I had made was in the add buddy/remove buddy handling.

Also changed:
-- added a setting for the other buddy block tile copy
-- minor cleanup
-- fixed a bug where the wrong variable ($userid) was being used (instead of $uid).

TODO:
-- add an install file to update for UTF-8

robertdouglass’s picture

Status: Needs review » Fixed
Anonymous’s picture

Status: Fixed » Closed (fixed)