More convenient way to add users
gustav - February 22, 2008 - 11:24
| Project: | Organic groups |
| Version: | 6.x-2.x-dev |
| Component: | og.module |
| Category: | feature request |
| Priority: | normal |
| Assigned: | marvil07 |
| Status: | needs review |
| Issue tags: | user interface improvements |
Description
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.

#1
Subscribing.
#2
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.
#3
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.
#4
It's still complicated with the current version. Would be nice if this could be integrated.
#5
subscribe
#6
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.
#7
I actually do want this in core OG. I'd love a patch for 6.x as well.
#8
Excellent news!
I've made a patch against 5.x-7.3.
I'll do a patch against 6.x now :D
#9
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
#10
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.
#11
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#12
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
#13
I reviewed the patch against new HEAD updated to August 14, 2008, and it's still applying well.
#14
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.
#15
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!
#16
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.
#17
Hi, is this available in the latest OG 5.x-8.0 release?
#18
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?
#19
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!
#20
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)
#21
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
#22
Indentation is all over the place. See coding standards. Still not sure this is clean enough.
#23
I cleaned the codes following the coding standards. remember to clean ur cache.
Thanks
#24
more cleaning using coder :)
#25
Wondering if this patch is on its way to being committed to og for drupal 6?
#26
#27
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).
#28
subscribe
#29
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,
#30
is there something more needed here?
#31
subscribe
#32
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
#33
Thanks, salimane. It's a handy module. It helps alot.
#34
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.
#35
Had problems with the latest patch, but the module in #32 works great! Thx Salimane!
#36
I had verified the patch in #29 and it actually still works(against branch
DRUPAL-6--2) todaypatch -p1 --dry-run < integrate-og_username_helper-to-OG-6.x-2.0-RC3-v0.patchpatching 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).
#37
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.
#38
Great work, i think you should publish it as a standalone module in order to improve the work around it.
#39
+1, as standlone it will have more visibility and will make our life easier as site maintainers, no more patching!
#40
@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
#41
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;inog_username_helper_form_alter().