Download & Extend

How to set number for maximum recipients?

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

Version:» 6.x-1.x-dev

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

Version:6.x-1.x-dev»
Category:support request» feature request

Setting the correct category, this is a new feature, not a support request.

#5

Version:» 6.x-1.x-dev
Category:feature request» bug report

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

Version:6.x-1.x-dev» 6.x-2.x-dev
Status:active» needs review

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.

AttachmentSizeStatusTest resultOperations
fix_maxlength.patch1 KBIdleFAILED: [[SimpleTest]]: [MySQL] 2,874 pass(es), 348 fail(s), and 58 exception(es).View details

#9

Status:needs review» needs work

The last submitted patch, fix_maxlength.patch, failed testing.

#10

Status:needs work» needs review

Ok, it's a bit more complicated than that.

#maxlength must be explicitly unset in an #after_build function. This should do the trick.

AttachmentSizeStatusTest resultOperations
fix_maxlength2.patch1.43 KBIdlePASSED: [[SimpleTest]]: [MySQL] 3,286 pass(es).View details

#11

Status:needs review» fixed

Committed to 6.x-2.x and 7.x-2.x

Powered by Dreditor (triage sandbox) and Triage transitions

#12

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.