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

CommentFileSizeAuthor
#10 fix_maxlength2.patch1.43 KBberdir
#8 fix_maxlength.patch1 KBberdir

Comments

naheemsays’s picture

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

igorik’s picture

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

naheemsays’s picture

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.

berdir’s picture

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

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

andypost’s picture

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

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

nymo’s picture

subscribing, i would like to limit number of recipients vs characters.

fureigh’s picture

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;
  }
}
berdir’s picture

Version: 6.x-1.x-dev » 6.x-2.x-dev
Status: Active » Needs review
StatusFileSize
new1 KB

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.

Status: Needs review » Needs work

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

berdir’s picture

Status: Needs work » Needs review
StatusFileSize
new1.43 KB

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

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

berdir’s picture

Status: Needs review » Fixed

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

Powered by Dreditor (triage sandbox) and Triage transitions

Status: Fixed » Closed (fixed)

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

sokrplare’s picture

Should this have been committed to 7.x-1.x as well? Might prevent things like this duplicate when the next 7.x-1.x release rolls out #1822330: How to increase the Recepient field limit? (128 Chars limit).