News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Enhanced PM System

Started by dougiefresh, April 20, 2014, 04:30:16 PM

Previous topic - Next topic

dougiefresh

Link to Mod



ENHANCED PM SYSTEM v3.5.2
By Dougiefresh - Link to Mod



Introduction
This mod makes some changes to the PM system, seperating the PM conversations from the PM list.  It forces all users to conversation mode and makes users click on the message they want to view.  This keeps the forum from marking the latest message as read if you glance over the message list and click on something else and want to read a message that isn't the latest message received.

It adds an Outbox to the mix and seperates unread PMs from those that have been read.  It changes the "labels" into "folders" and removes the contents of the PM from the email notification.  It will allow users to edit PMs that they have sent out, as long as NO RECIPIENT has read it.  It also allows users to unsend and delete any unread PMs to other users.

This mod adds settings in the "Features and Options" page.  By default, this mod forces the view for personal messages to Conversation mode, but there is a new switch permitting the users to select a different mode other than Conversation mode.  The "PM Remove Inbox Label" and "Copy to Outbox" options are removed from the Personal Messages Settings page and set as default.

Version 2.0 sports an enhanced PM search system, which allows you to search Sent Items and the Outbox for PMs you specify.  It also allows the user to search them by username, just like the core functionality provided for the Inbox.  You are allowed to move PMs to folders for Inbox PMs, and allowed to delete PMs from all folders.

Version 3.0 adds the PM Quick Reply box, as well as changes some options to membergroup permissions....

As a anti-spam measure, this mod can block new members from sending PMs during the 24-hour period after their account is activated.  Please note that members activated before this mod is installed will not be affected by this anti-spam measure, as the activation time is not recorded in the database prior to this mod.

Related Discussions
o [DONE] PM Separate List and View Request
o [DONE] Always PM Conversation and Save a Copy
o [DONE] Private Message Email Notification
o [DONE] PM outbox/sent like phpbb
o [DONE] Unsend PM
o [DONE] Outbox with editable PMs
o [DONE] Require Subject for PMs
o [DONE] Block PM on the first day
o [DONE] NEW FOR v2.0: Search by Sent PMs
o [DONE] NEW FOR v2.0: Perform Actions on Searched-For PMs
o [DONE] NEW FOR V2.0: "User xx has blocked your personal message."
o [DONE] NEW FOR V2.1: Allow Members to Send PM's While Muted
o [DONE] NEW FOR V2.1: PM Message Rules - Members can avoid Admin PMs & Warning PMs
o [DONE] NEW FOR V2.2: A "Quote to All" in PM Conversation mode?
o [DONE] NEW FOR V3.0: PM Quick Reply
o [INCOMPLETE] Move Personal Messages

Permission Notices
o MLM gave permission to use his changes from Always PM Conversation and Save a copy discussion.
o floydpink gave permission to use his changes from Move Personal Messages discussion.

Mail Icons
o Ultimate Gnome iconset (released under a GPL license) found at IconFinder.com

Compatibility Notes
This mod was tested on SMF 2.0.9, but should work on SMF 2.1 Beta 2, as well as SMF 2.0 and up.  SMF 1.x is not and will not be supported.

The PM Attachments mod should be installed first to avoid any conflict with this mod.

Questions and Answers
Q: Will this mod ever include PM attachment support?
A: No, there is a PM Attachments mod already developed that supports this.  The exception is editing PMs with attachments, which this mod will eventually support fully.

Q: Why can't I edit the attachments on a PM?
A: At present time, it is not possible to list and/or remove files attached to the PM while editing the PM.  Future versions of this mod will resolve this issue.

Q: Why can't I move messages from the Outbox and/or Sent Items folder?
A: At present time, it is not possible to mass-move messages from the Outbox or Sent Items folder.  Future versions of this mod may resolve this issue.

Translators
o @rjen - Dutch translation
o messire_Leonard - Russian translation!
o Rock Lee! - Spanish Latin translation

Changelog
The changelog has been removed and can be seen at XPtsp.com.

License
Copyright (c) 2015 - 2018, Douglas Orend
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

etn991

I really like this mod, since my old forum was based on phpbb and had the ability to delete messages which had not been read yet.

However, I get the following error when I go to a PM in my inbox and try to Quote or Reply.  It doesn't seem to matter which PM I select, and it happens for other users (not just the admin).  When I uninstall the mod, quote and reply work as expected.

An Error Has Occurred!
The personal message you're trying to quote is not your own or does not exist, please go back and try again.


I am using SMF 2.0.7 with the following mods:
SimplePortal    2.3.5
Switch Permissions    1.0
Custom Form Mod    1.7
Recent Topics On Board Index    1.03
Treasury    2.12
Enhanced PM System    1.0

Is anyone else having this problem?

Thanks,
Ed

(hope I posted this in the right place)

dougiefresh

Sorry about replying so late, as I just found this message :o  I will look into the issue.....

dougiefresh

#3
Uploaded v1.1 - June 1st, 2014 ->
o Fixed an error that keeps users from quoting or replying to PMs...  Thanks, etn991!

Mod is upgradable from v1.0... Thanks, etn991!

EDIT: Post changed in order to update format of version notices....

DasVON

I just installed this Mod with No Errors but nothing seems changed (like your example pics) and the menu its like this MY MESSAGES and not like this MY MESSAGES [1]

I am using this theme http://custom.simplemachines.org/themes/index.php?lemma=2764

Mods Installed are:

Quote1.   Download bbcode 2.0
2.   Send Pm When Rank Change 1.0     
3.   SimplePortal 2.3.5     
4.   Joinable Groups 1.0     
5.   Customize *Child Board*    2.7     
6.   Enhanced PM System 1.1     
7.   Team Page 3.6     
8.   Additional Membergroups 1.02     
9.   Quick Spoiler 0.9.5     
10.   Custom Copyright 1.0.2 
11.   Welcome Back    1.0     
12.   Event Registration Mod for SMF2: 2.26     
13.   Adk Personal Icon forums 1.0     
14.   Advance Fake Guests n Users Online 1.0     
15.   Sorted Package Manager Listing 1.2     
16.   Custom Greeting Mod 2.0     
17.   Anti-SID(PHPSESSID) canonical tag 0.5     
18.   Simple .htaccess Cache Mod 2.6     
19.   Contact Page 3.2     
20.   Adk System FAQs 1.0     
21.   NiceTooltips 1.9 
22.   Remove Help From Menu 1.0     
23.   OS & Browser Detection 1.5     
24.   Aeva ~ Auto-Embed Video & Audio 7.2     
25.   RSS Feed Poster 3.1a     
26.   Footer Menu 1.1.2     
27.   Private Profile 0.3.2     
28.   Menu Editor Lite 1.0.5

Do I need to modify anything if so what and how ?


Shambles

I believe "Menu Editor Lite 1.0.5" may have that effect. Check the discussion thread for that mod. I'm sure I read about it there...

dougiefresh

#6
Uploaded v1.2 - June 8th, 2014
o Fixed an undefined variable error found in PersonalMessage.php...
o Fixed error in uninstaller from v1.1, relating to upgraded installations...
o Fixed error in uninstaller from v1.1, relating to one edit that didn't want to uninstall...

Upgrade is possible from v1.0 and v1.1 to v1.2.

dougiefresh

@DasVON: I can verify that Menu Editor Lite v1.0.5 screws extensively with the top menu, negating the top menu changes made by this mod.  Other than uninstalling the Menu Editor Lite mod, I have no idea how to resolve this particular problem....

The Regain theme doesn't have a PersonalMessages.template.php file within it, so I'm at a loss of why you wouldn't see the rest of the changes made....  Mind you, the changes aren't that big, as most of the changes are "under the hood".  But you should see a new folder labeled "Outbox" underneath the "Sent Items", in which unread PMs will show up.  Once at least one recipient reads the PM, it will disappear from the "Outbox" folder.  In the "Outbox" folder, clicking on a PM gets you to a similar screen as viewing the PM.  There you can unsend and edit a PM....

I hope this helps....

Arantor

Also note the changes made by Menu Editor Lite are described by its author as a feature not a bug and never going to be changed.

etn991

Quote from: dougiefresh on June 01, 2014, 09:48:06 PM
Updated the mod to v1.1, which fixes the reply/quote issue that etn991 reported.  Mod is upgradable from v1.0... Thanks, etn991!

No problem.  Thank you for the fix.  So far works like a charm.

snake_ripken

thank you for mod it work well
no option to have attachment file in pm?

dougiefresh

Quote from: snake_ripken on June 21, 2014, 03:11:12 AM
thank you for mod it work well
no option to have attachment file in pm?
You're welcome.  There is a seperate mod called PM Attachments by SoLoGHoST that provides this functionality.  The Enhanced PM System will work with the PM Attachments mod, provided PM Attachments is installed FIRST...  Unfortunately, because editing PMs isn't an option in the core files, altering attachments in PMs once they are sent isn't an option from that mod.  It hasn't been implemented for this mod yet, either....  Although it is planned for a future release.

butch2k

I noticed a few SQL errors indeed your INNER JOIN Clauses are not using any ON which results in cross joins.
You need to add ON (pmr.id_pm = pm.id_pm) in a few queries.

$request = $smcFunc['db_query']('', '
SELECT COUNT(' . ($context['display_mode'] == 2 ? 'DISTINCT pm.id_pm_head' : '*') . ')
FROM {db_prefix}personal_messages AS pm
INNER JOIN {db_prefix}pm_recipients AS pmr
WHERE pm.id_member_from = {int:current_member}
AND pmr.is_read > {int:not_read}
AND pm.deleted_by_sender = {int:not_deleted}',
array(
'current_member' => $user_info['id'],
'not_deleted' => 0,
'not_read' => 0,
)
);

dougiefresh

#13
It's been fixed for v1.3.  Thanks, butch2k!!! 

Thanks to this topic, I've been inspired to add an easy change to this mod to search sent pms.  I'll release it in v1.3 once it's done.....

dougiefresh

Uploaded v1.3 - June 22nd, 2014
o Fixed a few SQL errors based on the INNER JOIN clauses resulting in cross joins.  Thanks, butch2k!



UPDATE: The ability to search sent PMs has not been added to version 1.3, as it is much more complicated than I anticipated.  There are far more places of code that need to be changed for the feature to work properly and I think that it would be better to release it as another version than to put off bug fixes until that feature is complete.  I apologize about disappointing anyone....

FragaCampos

#15
Hi, dougiefresh
I read your message on the search sent PMs' topic and found this great mod. Congratulations for creating this.
In my opinion, SMF PM system as always been a bit clunky and not very versatile, and this mod surely helps to improve it!

I really liked the well organized files. ;)
Here's my small contribution:
Code (Portuguese_pt-utf8) Select
<!-------------------------------------------------------------------------->
<!-- Language file edits (Portuguese - Modifications & PersonalMessage)      -->
<!-------------------------------------------------------------------------->
<file name="$languagedir/Modifications.portuguese_pt-utf8.php">
<operation>
<search position="replace"><![CDATA[// Version: 2.0; Modifications]]></search>
<add><![CDATA[// Version: 2.0; Modifications
/* Enhanced PM System mod */
$txt['eps_title'] = 'Sistema Melhorado de MPs';
$txt['eps_pm_view_switch'] = 'Permmitir que os utilizadores escolham outras vistas de MPs além do modo de conversação';
$txt['eps_deny_unsend'] = 'Impedir que os utilizadores cancelem MPs por ler';
$txt['eps_deny_edit'] = 'Impedir que os utilizadores alterem MPs por ler';
$txt['eps_block_1st_day'] = 'Impedir o envio de MPs no primeiro dia (24 horas) de registo no fórum';
/* End Enhanced PM System mod */
]]></add>
</operation>
</file>
<file name="$languagedir/PersonalMessage.portuguese_pt-utf8.php">
<operation>
<search position="replace"><![CDATA[$txt['pm_msg_label_title'] = 'Mensagem de marcador';
$txt['pm_msg_label_apply'] = 'Adicionar marcador';
$txt['pm_msg_label_remove'] = 'Remover marcador';]]></search>
<add><![CDATA[$txt['pm_msg_label_title'] = 'Mover Mensagem';
$txt['pm_msg_label_apply'] = 'Mover para';
$txt['pm_msg_label_remove'] = 'Pasta Atual';]]></add>
</operation>
<operation>
<search position="replace"><![CDATA[$txt['pm_sel_label_title'] = 'Marcador selecionado';]]></search>
<add><![CDATA[$txt['pm_sel_label_title'] = 'Mover Selecionados';]]></add>
</operation>
<operation>
<search position="replace"><![CDATA[$txt['pm_manage_labels'] = 'Gerir marcadores';
$txt['pm_labels_delete'] = 'Tem a certeza que quer apagar os marcadores selecionadas?';
$txt['pm_labels_desc'] = 'Aqui pode adicionar, editar e apagar marcadores usados nas suas mensagens.';
$txt['pm_label_add_new'] = 'Adicionar novo marcador';
$txt['pm_label_name'] = 'Nome do marcador';
$txt['pm_labels_no_exist'] = 'Atualmente não tem nenhum marcador definido!';]]></search>
<add><![CDATA[$txt['pm_manage_labels'] = 'Gerir Pastas';
$txt['pm_labels_delete'] = 'Tem a certeza que pretende apagar as pastas selecionadas?';
$txt['pm_labels_desc'] = 'Aqui pode adicionar, alterar e apagar pastas usadas no seu centro de mensagens privadas.';
$txt['pm_label_add_new'] = 'Adicionar Nova Pasta';
$txt['pm_label_name'] = 'Nome da Pasta';
$txt['pm_labels_no_exist'] = 'De momento, não tem pastas criadas!';]]></add>
</operation>
<operation>
<search position="replace"><![CDATA[$txt['pm_labels'] = 'Marcadores';]]></search>
<add><![CDATA[$txt['pm_labels'] = 'Pastas';]]></add>
</operation>
<operation>
<search position="replace"><![CDATA[$txt['pm_search_choose_label'] = 'Escolha o marcador a procurar, ou procurar tudo';]]></search>
<add><![CDATA[$txt['pm_search_choose_label'] = 'Escolha as pastas a procurar ou procure todas';]]></add>
</operation>
<operation>
<search position="replace"><![CDATA[$txt['pm_email'] = 'Acabou de receber uma Mensagem Pessoal enviada por SENDER no ' . $context['forum_name'] . '.\\n\\nIMPORTANTE: Lembre-se, isto é apenas uma notificação. Por favor não responda a este e-mail.\\n\\nA mensagem que lhe foi enviada foi a seguinte:\\n\\nMESSAGE';]]></search>
<add><![CDATA[$txt['pm_email'] = 'Acabou de receber uma mensagem privada de SENDER em ' . $context['forum_name'] . '.' . "\n\n" . 'IMPORTANTE: Lembre-se, isto é apenas uma notificação. Por favor, não responda a este e-mail.\\n\\nA mensagem que recebeu foi a seguinte:\\n\\nMESSAGE';]]></add>
</operation>
<operation>
<search position="replace"><![CDATA[$txt['sent_items'] = 'Itens Enviados';]]></search>
<add><![CDATA[$txt['sent_items'] = 'Itens Enviados';
$txt['unread_items'] = 'Caixa de Saída';
$txt['unsend_item'] = 'Cancelar Envio';]]></add>
</operation>
<operation>
<search position="replace"><![CDATA[$txt['pm_rule_label'] = 'Etiquetar mensagem com';
$txt['pm_rule_sel_label'] = 'Seleccionar Etiqueta';]]></search>
<add><![CDATA[$txt['pm_rule_label'] = 'Mover mensagem para a pasta';
$txt['pm_rule_sel_label'] = 'Escolher Pasta';]]></add>
</operation>
<operation>
<search position="replace"><![CDATA[?>]]></search>
<add><![CDATA[$txt['pm_edit'] = 'Alterar';
$txt['edit_message'] = 'Alterar Mensagem';
$txt['pm_unsent_denied'] = 'Você não pode cancelar o envio de uma mensagem.';
$txt['pm_unsent'] = 'A sua mensagem foi cancelada com sucesso para todos os destinatários.';
$txt['pm_unsent_some'] = 'A sua mensagem foi cancelada de todos os destinatários que ainda não a tinham lido.';
$txt['pm_edited'] = 'A sua mensagem foi alterada e todos os novos destinatários receberam e-mails.';
$txt['pm_no_edit'] = 'Não foi possível alterar a MP, porque pelo menos um dos destinatários já leu a MP que você pretende alterar.';
$txt['pm_send_blocked'] = 'Você não tem permissão para enviar MPs durante as primeiras 24 horas do seu registo no fórum.';
$txt['unsend_message'] = 'Cancelar o envio desta mensagem a todos os destinatários que ainda não a leram.';

?>]]></add>
</operation>
<operation>
<search position="replace"><![CDATA[$txt['pm_actions_filter_by_label'] = 'Filtrar por categoria';]]></search>
<add><![CDATA[$txt['pm_actions_filter_by_label'] = 'Filtrar Por Pasta';]]></add>
</operation>
<operation>
<search position="replace"><![CDATA[$txt['pm_current_label'] = 'Marcadores';]]></search>
<add><![CDATA[$txt['pm_current_label'] = 'Pasta';]]></add>
</operation>
<operation>
<search position="replace"><![CDATA[$txt['pm_readable_label'] = 'aplicar a etiqueta &quot;{LABEL}&quot;';]]></search>
<add><![CDATA[$txt['pm_readable_label'] = 'mover para a pasta &quot;{LABEL}&quot;';]]></add>
</operation>
</file>

FragaCampos

#16
## Other things ##

Problems:
-> I realized now that when you click on a PM the page takes longer to load. I believe the default PM system uses anchors or something and this system actually loads a new page. Is that correct?
-> I'm getting a "Undefined index: edit" in the error log.
-> If I understood correctly, the icons in Outbox shouldn't be "eps_mail_unread"? As it is now, all PM show the "eps_mail_read" icon.


Suggestions:
-> Is it possible to add folders to "Sent Items" too? (That way it would be also possible to move sent PMs)
-> It would be nice to add tooltips to these icons so that users could know what they mean.




dougiefresh

#17
Thanks!!  I agree that the core PM system needs help....  ;D  Your Portuguese language contribution has been added for the next version!

Quote from: FragaCampos on June 24, 2014, 07:14:00 PM
-> I realized now that when you click on a PM the page takes longer to load. I believe the default PM system uses anchors or something and this system actually loads a new page. Is that correct?
Huh....  Didn't realize that it takes longer to load.  You are correct when you said that the default PM system uses anchors in non-conversation mode.In Conversation mode, I do believe that it loads a new page for each convo.  However, if a message had the latest reply, that conversation would be automatically loaded.

The Enhanced PM System forces all users to conversation mode and makes users click on the message they want to view.  This keeps the forum from marking the latest message as read if you glance over the message list and click on something else and want to read a message that isn't the latest message received.

Quote from: FragaCampos on June 24, 2014, 07:14:00 PM
-> I'm getting a "Undefined index: edit" in the error log.
Can you attach your PersonalMessage.php and PersonalMessage.template.php and copy the error message so I can research it?

Quote from: FragaCampos on June 24, 2014, 07:14:00 PM
-> If I understood correctly, the icons in Outbox shouldn't be "eps_mail_unread"? As it is now, all PM show the "eps_mail_read" icon.
At one point, the code did what it was supposed to....  I'm guessing there is a problem with the logic somewhere.... Lemme research it....

EDIT: Fixed  :P

Quote from: FragaCampos on June 24, 2014, 07:14:00 PM
-> It would be nice to add tooltips to these icons so that users could know what they mean.
Easy to do.  Will be in the next version....

EDIT: DONE!  :P

Quote from: FragaCampos on June 24, 2014, 07:14:00 PM
-> Is it possible to add folders to "Sent Items" too? (That way it would be also possible to move sent PMs)
I'm sure it would be POSSIBLE, however, probable is another story....   :-[  I guess the answer is that it depends on how hard it is to modify the system.  Looking at the message rules, I noticed yet another "bug" that I need to resolve: being able to assign two folders to the same message  :P

FragaCampos

#18
Thank you for your considerations and changes. :)

Here goes the attached files and the error is this one (the line number varies):
- index.php?action=pm;sa=send;f=inbox;pmsg=23033;quote;u=1848
- 8: Undefined index: edit
- public_html/Sources/PersonalMessage.php
Line: 1717

FragaCampos

Of course.

- "Unread" -> "Não lida"
- "Search group" (I would need the context of this one, but this will do for now) -> "Procurar por grupo"


Advertisement: