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

nath - March 3, 2008 - 13:58

Subscribing.

#2

marvil07 - March 3, 2008 - 15:41

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.

AttachmentSize
og_username_helper.tar_.gz 1.56 KB

#3

gustav - March 3, 2008 - 20:08

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

nath - July 30, 2008 - 10:57
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.

#5

dugh - August 3, 2008 - 22:46

subscribe

#6

marvil07 - August 5, 2008 - 19:08
Assigned to:Anonymous» 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.

#7

moshe weitzman - August 5, 2008 - 19:14

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

#8

marvil07 - August 8, 2008 - 16:33
Status:active» needs review

Excellent news!

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

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

AttachmentSize
integrate-og_username_helper-inside-OG-7.3.patch 4.53 KB

#9

marvil07 - August 8, 2008 - 19:21

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

AttachmentSize
integrate-og_username_helper-inside-OG-7.3-v2.patch 4.44 KB
integrate-og_username_helper-to-OG-6.x-HEAD.patch 4.09 KB

#10

moshe weitzman - August 9, 2008 - 03:23
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.

#11

marvil07 - August 12, 2008 - 19:10
Status:needs work» needs review

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

AttachmentSize
integrate-og_username_helper-inside-OG-7.3-v3.patch 3.94 KB

#12

marvil07 - August 13, 2008 - 15:52

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

AttachmentSize
integrate-og_username_helper-inside-OG-7.3-v4.patch 3.84 KB
integrate-og_username_helper-to-OG-6.x-HEAD-v2.patch 3.47 KB

#13

marvil07 - August 20, 2008 - 16:27

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

#14

gustav - November 18, 2008 - 12:22
Status:needs review» reviewed & tested by the community

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.

AttachmentSize
og_username_helper.js_.txt 896 bytes
og.patch 2.75 KB

#15

develCuy - December 2, 2008 - 05:21

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!

AttachmentSize
integrate-og_username_helper-inside-OG-7.3-v5.patch 4.39 KB
integrate-og_username_helper-inside-OG-8.x-dev.patch 4.39 KB

#16

alb - December 9, 2008 - 17:50

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

tborrome - February 4, 2009 - 21:56

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

#18

tborrome - February 5, 2009 - 04:46
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?

#19

develCuy - February 14, 2009 - 06:30
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!

#20

moshe weitzman - February 14, 2009 - 14:09

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

Salimane Adjao ... - February 25, 2009 - 12:22

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

AttachmentSize
og_username_helper.tar_.gz 1.55 KB
og_username_helper-to-OG-6.x-HEAD.patch 4.52 KB

#22

moshe weitzman - March 16, 2009 - 18:13
Status:reviewed & tested by the community» needs work

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

#23

Salimane Adjao ... - March 19, 2009 - 07:52

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

AttachmentSize
integrate-og_username_helper-to-OG-6.x-HEAD.patch 4.48 KB
og_username_helper.tar_.gz 1.48 KB

#24

Salimane Adjao ... - March 20, 2009 - 10:52

more cleaning using coder :)

AttachmentSize
integrate-og_username_helper-to-OG-6.x-HEAD.patch 4.53 KB
og_username_helper.tar_.gz 1.49 KB

#25

GregoryHeller - June 2, 2009 - 23:14

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

#26

moshe weitzman - June 3, 2009 - 01:23
Version:5.x-8.0» 6.x-2.x-dev
Status:needs work» needs review

#27

marcvangend - June 11, 2009 - 11:47
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).

#28

zdean - June 12, 2009 - 18:59

subscribe

#29

marvil07 - June 15, 2009 - 07:31
Status:needs work» needs review

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,

AttachmentSize
integrate-og_username_helper-to-OG-6.x-2.0-RC3-v0.patch 4.82 KB

#30

marvil07 - July 25, 2009 - 08:15

is there something more needed here?

#31

jackinloadup - July 25, 2009 - 10:19

subscribe

#32

Salimane Adjao ... - July 27, 2009 - 07:40

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

AttachmentSize
og_username_helper.tar_.gz 1.51 KB

#33

jianingy - August 3, 2009 - 08:04

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

#34

landry - October 22, 2009 - 08:26

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

jakewalk - November 4, 2009 - 19:34

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

#36

marvil07 - November 5, 2009 - 23:06

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).

#37

mErilainen - November 26, 2009 - 14:20

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

bricef - December 2, 2009 - 10:47

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

#39

develCuy - December 2, 2009 - 16:51

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

#40

marvil07 - December 2, 2009 - 18:20

@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

AttachmentSize
integrate-og_username_helper-to-OG-6.x-2.x-v11.patch 4.39 KB
og_username_helper-6.x-1.x-v6.tar_.gz 1.27 KB

#41

marcp - December 2, 2009 - 18:30

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().

 
 

Drupal is a registered trademark of Dries Buytaert.