Author |
Message |
Salvatos Board Member
Joined: 19 Feb 2009
Posts: 449 Location: Québec
|
Posted: Wed Nov 02, 2011 10:50 pm Post subject: Multiple PM Recipients Redux [Current: 0.3] |
|
|
In an effort to improve PM usability for my boards, I installed and tweaked a few existing MODs. One in particular was Multiple PM Recipients, originally by Harold Martin and others. As I thought it was a little too bulky for its purpose, I changed the following:
- Removed everything related to JavaScript and AJAX (spares you from downloading entire libraries just for this);
- Taking usernames in a single semi-colon-separated field instead of manually adding one field per username;
- And of course, allowed using multiple recipients when replying to a PM, which was strangely missing.
The existing capabilities were, in short:
- Write a PM to more than one user at a time;
- Set and manage limits on the number of users that can be PM'd at once based on user level, from the ACP;
- And a Mass PM page in the ACP (untouched and untested by me).
If you'd like to try it out, I would gladly take feedback and perhaps some feature suggestions. I haven't tried installing the MOD from scratch (I'm rather busy lately), so if the install file seems to be missing instructions, please let me know and I will update the attachment!
Updated to 0.3: Changed comma separators to semi-colons, and blocked these from username creation. Also added missing instructions for a template file's edits.
Description: |
MOD instructions and included files |
|
Download |
Filename: |
Multiple_PM_Recipients_Redux_0.3.zip |
Filesize: |
12.81 KB |
Downloaded: |
1954 Time(s) |
|
|
Back to top |
|
|
drathbun Board Member
Joined: 24 Jul 2008
Posts: 729 Location: Texas
|
Posted: Thu Nov 03, 2011 1:25 am Post subject: Re: Multiple PM Recipients Redux |
|
|
Salvatos wrote: | - Taking usernames in a single comma-separated field instead of manually adding one field per username; |
Do you use usernames or user_id values? Can usernames legitimately include commas in them? Because that would mess up your input list...
Based on the standard phpbb_clean_username() function it removes HTML characters, spaces, and quotes. But a comma looks like it could be okay as a username character. When I tested, I was able to create a username called "test,comma" so you might want to think about how to work around that.
_________________ phpBBDoctor Blog |
|
Back to top |
|
|
Salvatos Board Member
Joined: 19 Feb 2009
Posts: 449 Location: Québec
|
Posted: Thu Nov 03, 2011 12:27 pm Post subject: Re: Multiple PM Recipients Redux |
|
|
Aw, shucks, I worked on this over a couple weeks and ended up forgetting to check that.
I'll have a look at the forbidden characters later today and see what else could make sense as a delimiter. I actually have a member with spaces in his username, so that won't be an option either...
|
|
Back to top |
|
|
drathbun Board Member
Joined: 24 Jul 2008
Posts: 729 Location: Texas
|
Posted: Thu Nov 03, 2011 2:00 pm Post subject: Re: Multiple PM Recipients Redux |
|
|
If you could build the "pick list" using user names but store the list as a selection of user_id values then a comma separated list would work just fine.
_________________ phpBBDoctor Blog |
|
Back to top |
|
|
Salvatos Board Member
Joined: 19 Feb 2009
Posts: 449 Location: Québec
|
Posted: Thu Nov 03, 2011 6:03 pm Post subject: Re: Multiple PM Recipients Redux |
|
|
But how would I make the transition? I'd have the same issue where I can't separate usernames accurately. The problem is with the user's input, I don't use separators anymore once the code is running.
Apparently the only characters that phpBB2 doesn't allow are " and alt-255. Using " as a separator looks rather... inappropriate. And I can't just block commas from usernames since it would break backward-compatibility on existing forums...
I guess we can't help having multiple fields. But I think I'll try a different approach. I'll keep just one input, and next to it I'll have an "Add user to recipients" button, kind of like the poll and attachment buttons where you have to click to confirm each entry. This will add it to a list I'll manage with JavaScript and display under the field. To the user, it will look like a comma-separated list, but in fact it will be a group of disabled inputs that I'll post with the rest of the form in separate POST variables.
I'll try to do that by the end of the weekend, not in the mood for it tonight.
|
|
Back to top |
|
|
drathbun Board Member
Joined: 24 Jul 2008
Posts: 729 Location: Texas
|
Posted: Fri Nov 04, 2011 10:03 am Post subject: Re: Multiple PM Recipients Redux |
|
|
Have a look at how the moderator control panel works... it presents a list of topics for action, and the moderator can pick one or more via a checkbox. The selected list is passed as a javascript array of topic_id values. I would think you would be able to generate a list of users for selection (you already have that) but instead of passing a list of user names, pass the list of user_id values instead.
_________________ phpBBDoctor Blog |
|
Back to top |
|
|
Salvatos Board Member
Joined: 19 Feb 2009
Posts: 449 Location: Québec
|
Posted: Wed Nov 09, 2011 2:17 pm Post subject: Re: Multiple PM Recipients Redux [Current: 0.3] |
|
|
I took a while to think about it and finally settled for semi-colons as separators. This includes blocking them from username creation in functions_validate.php. I included a file that tells you if you have any existing usernames with semi-colons, so you can contact the users and change them to avoid bugs.
OP is updated with the new download.
|
|
Back to top |
|
|
drathbun Board Member
Joined: 24 Jul 2008
Posts: 729 Location: Texas
|
Posted: Wed Nov 09, 2011 2:32 pm Post subject: Re: Multiple PM Recipients Redux [Current: 0.3] |
|
|
Did you think about using user_id values rather than usernames? Even if you still collect usernames via your input form, you could convert each of them into a user_id value with a simple query. Those values are guaranteed numeric and can be delimited with , or ; or whatever you like.
Also from a quick scan of your MOD you've set up varchar(500) for the new field in the private message table. Earlier versions of MySQL don't allow that size:
Quote: | In MySQL 5.0, the range of M is 0 to 255 before MySQL 5.0.3, and 0 to 65,535 in MySQL 5.0.3 and later. The effective maximum length of a VARCHAR in MySQL 5.0.3 and later is subject to the maximum row size (65,535 bytes, which is shared among all columns) and the character set used. |
If you went with user_id values, then 500 is fairly long. With usernames being up to 25 characters you're only allowing for 500/25 or 20 potential recipients. That's assuming, of course, that usernames are all 25 characters long, which clearly they're not...
I really think you might want to reconsider storing the recipients in user_id form, and perhaps even consider setting up a new table to do that rather than adding a fixed-length field in the private message table. Adding a new table with a private message id and the user id fields would be enough. Each user that is selected as a recipient gets added to that table, which can have from zero to really-big-number of rows.
_________________ phpBBDoctor Blog |
|
Back to top |
|
|
hoimyr Board Member
Joined: 16 Apr 2009
Posts: 115 Location: Oslo
|
Posted: Tue Nov 22, 2011 6:38 pm Post subject: Re: Multiple PM Recipients Redux [Current: 0.3] |
|
|
Nice work. I have a suggestion for new feature. What about sending to groups? If you are sending to multiple people you most likely want to send to the same group of people again later on.
Or does it have it allready?
|
|
Back to top |
|
|
Salvatos Board Member
Joined: 19 Feb 2009
Posts: 449 Location: Québec
|
Posted: Tue Nov 22, 2011 7:07 pm Post subject: Re: Multiple PM Recipients Redux [Current: 0.3] |
|
|
It's not part of it as it is, but I agree it would be convenient. I won't be working on this for a long while, though, so if anyone wants to take over, please be my guest.
|
|
Back to top |
|
|
Holger Board Member
Joined: 19 Jan 2009
Posts: 509 Location: Hanover
|
Posted: Wed Nov 23, 2011 3:33 am Post subject: Re: Multiple PM Recipients Redux [Current: 0.3] |
|
|
hoimyr wrote: | Nice work. I have a suggestion for new feature. What about sending to groups? If you are sending to multiple people you most likely want to send to the same group of people again later on.
Or does it have it allready? |
You mean, previous recipient-groups, like an addressbook? Thats brilliant.
_________________ Love your data! Back it up! |
|
Back to top |
|
|
|