Posted by igorik on May 16, 2009 at 5:39am
| Project: | Privatemsg |
| Version: | 6.x-2.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
Hi
I would like to raise number of allowed recipients in input field "To:".
I found in privatemsg.module on line 631 this info:
"// Do not hardcode #maxlength, make it configurable by number of recipients, not their name length."
ok, but where and how I can set (raise) number of recipients?
I need to raise current allowed number to e.g. 80, (it is useful for people in groups)
can you help me please with this?
thanks
Igorik
http://www.somvprahe.sk
Comments
#1
Not sure how to do that - I did not think there was an artificial limit placed on the number of recipients yet?
For now you can try #398916: Remove hook_form_alter in favor of a more flexible privatemsg_new form which will allow for programmatic insertion of user names as that may be easier than writing out a list of 80 odd names, but we also need to figure out some sane manner to send messages to roles/groups without resorting to sending the messages individually - imagine a site where a person sends a message to the authenticated role...
#2
Hi nbz, I applied that patch, read all discussion for it, I clear the cache before applying, but I didn't see progress for adding more names (manually, into input), the max length or number of allowed recioents was the same as before.
so I added '#maxlength' => 5000, for input "To" in privatemsg.module and it works for me. I know that it is not the good idea to do changes in contributed module, (watching new privatemsg releases and to do this change again), but I tried to play with that patch a few times but it doesn't help to me) so this is quick and working fix for me.
thanks again
Igorik
http://www.somvprahe.sk
#3
its not directly linked, but it allows you to go to "messages/new/1,2,3,4,5,6,7,...,99" to have all those prefilled as recipients - just a possible convenience.
As for setting the maxlength without editing the module, hook_form alter would be the right way as Berdir mentioned in the other issue.
#4
Setting the correct category, this is a new feature, not a support request.
#5
Current behaviour is wrong - by default textfield is limited by 128 so this limit actualy to 8-9 usernames.
Suppose for D7 we can make a setting for recipients limit and use ajax to replace textfield with updatable widget so it make easy integration with realname and other contrib
#6
subscribing, i would like to limit number of recipients vs characters.
#7
For anyone stumbling across this who's unfamiliar with hook_form_alter, here's a code example for setting a new limit on characters (not recipients):
function YOUR_CUSTOM_MODULE_NAME_form_alter(&$form, $form_state, $form_id) {
// Normally a switch is used because you may want to alter more than
// one form and it is easy to add a new case for each form.
switch ($form_id) {
// This is our form ID.
case 'privatemsg_new':
// Example: Set the maximum length of the 'recipient' field to 10000 characters.
$form['recipient']['#maxlength'] = 10000; // New limit is 10,000.
break;
}
}
#8
That comment is just plain wrong because #maxlength defaults to 128. To not hardcode it, it needs to be set to 0.
To limit the number of recipients, use privatemsg_limits.module.
Patch is for 6.x-2.x, please test.
#9
The last submitted patch, fix_maxlength.patch, failed testing.
#10
Ok, it's a bit more complicated than that.
#maxlength must be explicitly unset in an #after_build function. This should do the trick.
#11
Committed to 6.x-2.x and 7.x-2.x
Powered by Dreditor (triage sandbox) and Triage transitions
#12
Automatically closed -- issue fixed for 2 weeks with no activity.