Currently one can only add members to a group if one knows their exact username. Perhaps this could be improved by adding an alternative way of adding a user. Perhaps we could add an autocomplete field like the one used by the userreference CCK field.

Comments

nath’s picture

Subscribing.

marvil07’s picture

StatusFileSize
new1.56 KB

Hi all.

I needed that too at the web I'm developing. So lastent and I created a little module for that.

I doubt if it's big enought to be a contributed module, but I submit it here for you to test it.

I wait for your comments.

gustav’s picture

marvil07: that is exactly what I was looking for. Thank you very much for posting this. It works like a charm.

Would you be happy to have this integrated into og.module in case Moshe is interested? I think that would be more convenient than having it as a separate module. I can see no drawback with having this gadget enabled by default for all users.

nath’s picture

Version: 5.x-5.4 » 5.x-7.3

It's still complicated with the current version. Would be nice if this could be integrated.

dugh’s picture

subscribe

marvil07’s picture

Assigned: Unassigned » marvil07

I think Moshe it's not interested on this inside OG, but some people may need it, and it's not so relevant. So I'll make a project after waiting some time for suggestions.

moshe weitzman’s picture

I actually do want this in core OG. I'd love a patch for 6.x as well.

marvil07’s picture

Status: Active » Needs review
StatusFileSize
new4.53 KB

Excellent news!

I've made a patch against 5.x-7.3.

I'll do a patch against 6.x now :D

marvil07’s picture

Here is:
- a new version of the patch for OG 5.x-7.3 because of a line remove.
- the patch for OG 6.x-HEAD :D

moshe weitzman’s picture

Priority: Minor » Normal
Status: Needs review » Needs work

I reviewed the 'add members' form on D6:

* Can we just reuse user_autocomplete() instead of doing our own?
* The 'add' link is appearing all the way to the right, far from the textfield. I'd like to see a real button, just after the textfield that does what the link does. I know that multiple buttons on forms is a bit dicey, but you can probably make it so that this button does not actually submit the form when js is enabled.
* I don't think the 'username helper fieldset is needed. Also, the textfield description should be "Lookup a username and add it to the list below". The title should be 'Add user'.

Ideally, patches are made from the root of the contrib module. i had to hunt a bit to find b/og_username_helper.js. Not a big deal. Like the git patch :). Maybe i will learn it one day soon.

marvil07’s picture

Status: Needs work » Needs review
StatusFileSize
new3.94 KB

This version of the patch for OG 7.3 implements moshe suggestions and change form id names for better understanding.

I hope I could make a patch for 6.x tomorrow.

If someone else want to test this patch he wants to:

patch -p1 < integrate-og_username_helper-inside-OG-7.3-v3.patch
marvil07’s picture

Here is the patch for 6.x with the same modifications on my last comment, and a new version of 5.x removing an unused line.

Waiting for revision :D

marvil07’s picture

I reviewed the patch against new HEAD updated to August 14, 2008, and it's still applying well.

gustav’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new2.75 KB
new896 bytes

I have re-rolled the patch so it applies against HEAD. This feature is working really well. I would vote for adding it to og.

develcuy’s picture

I have rebuild the patch against 7.3 in git, so it is now in CVS. I have also updated the patch against 8.x-dev(DRUPAL-5--3 o_O!)

Blessings!

alb’s picture

http://drupal.org/node/310264
here there is a patch for to have visible all the users that one want insert in a group;
I think this is the solution better;
but at me not work.

I think pheraphs is necessary some small change.

tborrome’s picture

Hi, is this available in the latest OG 5.x-8.0 release?

tborrome’s picture

Status: Reviewed & tested by the community » Active

I would really want to have this functionality. There are several patches in this thread. What patch works with 5.x.7.3? I tried integrate-og_username_helper-inside-OG-7.3-v5.patch in post #15 but had problems patching:

patch < integrate-og_username_helper-inside-OG-7.3-v5.patch
patching file og.css
Hunk #1 FAILED at 50.
1 out of 1 hunk FAILED -- saving rejects to file og.css.rej
patching file og.module
Hunk #1 FAILED at 24.
Hunk #2 FAILED at 76.
Hunk #3 FAILED at 204.
Hunk #4 FAILED at 1565.
4 out of 4 hunks FAILED -- saving rejects to file og.module.rej
patching file og_username_helper.js

what's the right patch for 5.x-7.3 release?

Is there a patch available for 5.x-8.0? Or is this already included in 5.x-8.0?

develcuy’s picture

Version: 5.x-7.3 » 5.x-8.0
Status: Active » Reviewed & tested by the community

I have tested the patch in 5.x-8.0 and works fine :)
In order to make this stuff work:
1. Go to administer->site building->menus (just open it will rebuild menu cache)
2. grant roles the permission: "access og username helper"

And in answer to #16, this is a core like feature, since we should consider having a combobox with about 1000+ users is not a good idea.

Blessings!

moshe weitzman’s picture

No time to review now but this would be committed to HEAD first, and then 5. I don't see a current patch for HEAD (compatible with d6)

Anonymous’s picture

Hi,
here is a patch to og and also a rewritten module if you don't wanna patch your og module. And all these are for HEAD compatible with d6.
In the javascript i solve improve a bit the codes :
- don't add a username if already in the textarea
- don't add if no input in autocomplete textbox
- trim all usernames before adding them to the textarea

In the form_alter hook
i improve these:
- check if user has permissions before even creating form elements

moshe weitzman’s picture

Status: Reviewed & tested by the community » Needs work

Indentation is all over the place. See coding standards. Still not sure this is clean enough.

Anonymous’s picture

I cleaned the codes following the coding standards. remember to clean ur cache.
Thanks

Anonymous’s picture

more cleaning using coder :)

GregoryHeller’s picture

Wondering if this patch is on its way to being committed to og for drupal 6?

moshe weitzman’s picture

Version: 5.x-8.0 » 6.x-2.x-dev
Status: Needs work » Needs review
marcvangend’s picture

Status: Needs review » Needs work

Thanks for the patch, this is a valuable addition to the UI of the add members page.
Unfortunately, it doesn't work for me in IE, only in Firefox. When I click the add-button, IE starts reloading the page, as if the form is posted at the click of the button. I wasn't able to find the cause (yet).

zdean’s picture

subscribe

marvil07’s picture

Status: Needs work » Needs review
StatusFileSize
new4.82 KB

So, it's been a long time since I review this issue :-p

I see you were contributing to improve it, thanks!

After reviewing all patches here and fixing some, I had:

- Salimane Adjao Moustapha work
  - form alter in drupal way for access
  - don't add a username if already in the textarea
  - don't add if no input in autocomplete textbox
  - trim all usernames before adding them to the textarea
- fix for IE:
  - use jquery inArray instead of indexOf. IE have problems with indexOf, so avoid
it.
- pass coder review :D
- avoid define for permission string

I'm only providing the patch, but the module should be straightforward now.

Hope it was clean now,

marvil07’s picture

is there something more needed here?

Jackinloadup’s picture

subscribe

Anonymous’s picture

StatusFileSize
new1.51 KB

Here is attached the module version if you don't wanna patch your og core module. It includes the latest modification from marvil07.
This is for drupal 6.x
Thanks

jianingy’s picture

Thanks, salimane. It's a handy module. It helps alot.

landry’s picture

Using the module here, works fine, and it's a really nice addition. Looking forward for integration into OG.
My only concern : if you start typing a letter and no user match, no propositions are made, and clicking on 'add' will append the letter to the 'to-be-added userlist'. Dunno if that can be considered as a bug.

pheraph’s picture

Had problems with the latest patch, but the module in #32 works great! Thx Salimane!

marvil07’s picture

I had verified the patch in #29 and it actually still works(against branch DRUPAL-6--2) today

patch -p1 --dry-run < integrate-og_username_helper-to-OG-6.x-2.0-RC3-v0.patch 
patching file og.module
Hunk #3 succeeded at 456 (offset 3 lines).
Hunk #4 succeeded at 1371 (offset 31 lines).
patching file og_username_helper.js
patching file theme/og.css
Hunk #1 succeeded at 53 (offset -2 lines).
merilainen’s picture

This is a really big improvement on the usability.

Using the module version, I get the same problem which is mentioned in #34. Also if I just type partial user name, and try to choose the name with arrow keys, the partial username is added to the list, and to the adding form, which is a bug.

Maybe somebody could add some AJAX magic here so that the list wouldn't be a text area, but some elements which could be also removed if added by mistake? My skills are very limited in this area.

Update: It doesn't seem to work with Google Chrome.

bricef’s picture

Great work, i think you should publish it as a standalone module in order to improve the work around it.

develcuy’s picture

+1, as standlone it will have more visibility and will make our life easier as site maintainers, no more patching!

marvil07’s picture

@bricef: thanks for the suggestion!

After thinking about it, add button is not really necessary, so I updated the patch and the module to use the enter with keyup event(not keypress because of some conflicts with autocomplete IIRC).

this patch is against actual DRUPAL-6--2 branch

@moshe: I think this is the cleanest version of the patch until now, do you still want to integrate it in OG? I believe if not now it's time to make an independent module.

Thanks for all the feedback!

BTW: you can see a little video with the module working on http://blip.tv/file/2921743

marcp’s picture

I also think this would be great as a standalone module.

Great video -- it's helpful to see it in action before trying the module out.

The standalone has an unused global $user; in og_username_helper_form_alter().

merilainen’s picture

I'm trying to use the standalone version, but it doesn't work as expected.

I'm choosing a name from the list with a mouse, but it gets added to the auto-complete field, not the actual list field as in the video. If I press enter, the whole form gets submitted and then I get a message "0 users added to the group."

Now the auto-complete form works for Chrome, but behaves as described above.

Why this module has it's own permission rule? I think it should respect OG's permissions.

amitaibu’s picture

I think this should live in contrib. Also in OG7, Og itself allows adding a user one by one. The contrib module can replace (hook_menu_alter()) Og's impementation with its own

jvieille’s picture

Works great.
I don't know how OG administrators have survived without this capability. How the hell one had to know user's names by heart in order to subscribe them? The existing OG feature to add user is not much better than filling up the MySQL tables directly.
Can we expect an official module soon?
Now, waiting for a picking list...

Thanks a lot.

marvil07’s picture

Status: Needs review » Closed (works as designed)

ok, I'll work on this to get it as a separate module in the next days.

amitaibu’s picture

Muchas gracias marvil07 :)

marvil07’s picture

It's on og_username_helper.

BTW: I made a change to let it also use the click event :-)

marcushenningsen’s picture

The new module works great. Thanks a lot, a huge usability improvement.

alesr’s picture

Is there a way (module/patch) to see all users that you just click to join into a group?
Something like this http://drupal.org/files/issues/add_users_form.png