Simple Machines Community Forum

Customizing SMF => Modifications and Packages => Topic started by: dougiefresh on March 12, 2017, 06:46:19 AM

Title: Edit Unread PMs
Post by: dougiefresh on March 12, 2017, 06:46:19 AM
Link to Mod (https://custom.simplemachines.org/mods/index.php?mod=4140)



EDIT UNREAD PMs v1.7
By Dougiefresh (http://www.simplemachines.org/community/index.php?action=profile;u=253913) -> Link to Mod (http://custom.simplemachines.org/mods/index.php?mod=4140)



Introduction
This mod allows permitted membergroups to edit and unsend personal messages, as long as nobody has read them.

This mod has been tested with the PM Attachments (http://custom.simplemachines.org/mods/index.php?mod=1974) mod, and does support adding and removing PM attachments while editing the PM.

Admin Settings
In Admin => Members => Permissions, there are two new permissions:
o Can Edit Unread PMs
o Can Unsend Unread PMs

Legacy Disclaimer
This mod was part of the now-discontinued Enhanced PM System (http://www.simplemachines.org/community/index.php?topic=521508.0).  It is been seperated from it and built into a newer, hopefully better mod...

This updated mod makes additional checks to make sure nobody has read the PM before you are allowed to edit or unsend it.

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

This mod should be installed AFTER the PM Attachments (https://custom.simplemachines.org/mods/index.php?mod=1974) mod!

Related Discussions
o Outbox with editable PMs (http://www.simplemachines.org/community/index.php?topic=403840)
o Unsend PM (http://www.simplemachines.org/community/index.php?topic=29990)
o Private Message Email Notification (http://www.simplemachines.org/community/index.php?topic=426840)

Translators
o Spanish Latin: Rock Lee (https://www.simplemachines.org/community/index.php?action=profile;u=322597)

Changelog
The changelog can be viewed at XPtsp.com (http://www.xptsp.com/board/free-modifications/edit-unread-pms/).

License
Copyright (c) 2017 - 2019, 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.
Title: Re: Edit Unread PMs
Post by: dougiefresh on March 13, 2017, 01:44:54 PM
Uploaded v1.1 - March 13th, 2017
o Added support for SMF 2.1 Beta 2.
Title: Re: Edit Unread PMs
Post by: dougiefresh on March 28, 2017, 09:53:33 PM
Uploaded v1.2 - March 28th, 2017
o Added support for the core theme in SMF 2.0.x.
o Fixed install errors by changing file extension on language_english_20x.txt to .xml.



Quote from: James Gryphon on March 28, 2017, 07:52:59 PM
Edit Unread also chokes when attempting to install after Search (I haven't seen whether it installs with Separate). It also gives me a "Modification parse error" when testing whether it can modify the language_english_20x.xml file.

Also, all of them pretty universally report a multitude of errors with the Core theme's template file.
This should resolve these bug reports concerning this mod.  Thank you for reporting them!
Title: Re: Edit Unread PMs
Post by: dougiefresh on July 05, 2017, 10:28:42 PM
Uploaded v1.3 - July 5th, 2017
o Added support for SMF 2.1 Beta 3.
o Removed support for SMF 2.1 Beta 2.
Title: Re: Edit Unread PMs
Post by: Geor'G on February 20, 2018, 01:34:18 PM
The mod does not work correctly!
When you install the mod, the - $context['folder'] variable is reassigned:
$context['folder'] = !isset($_REQUEST['f']) || $_REQUEST['f'] != 'sent' ? 'inbox' : 'sent';
$context['folder'] = !isset($_GET['sa']) || $_GET['sa'] == 'edit' || $_GET['sa'] == 'edit' ? 'sent' : $context['folder'];


This code here is superfluous:
Find: [Select]
$context['folder'] = !isset($_REQUEST['f']) || $_REQUEST['f'] != 'sent' ? 'inbox' : 'sent';
Add After: [Select]
$context['folder'] = !isset($_GET['sa']) || $_GET['sa'] == 'edit' || $_GET['sa'] == 'edit' ? 'sent' : $context['folder'];


RU:
Мод работает неправильно!
При установке мода, переназначается переменная - $context['folder']:
$context['folder'] = !isset($_REQUEST['f']) || $_REQUEST['f'] != 'sent' ? 'inbox' : 'sent';
$context['folder'] = !isset($_GET['sa']) || $_GET['sa'] == 'edit' || $_GET['sa'] == 'edit' ? 'sent' : $context['folder'];


Title: Re: Edit Unread PMs
Post by: -Rock Lee- on February 20, 2018, 02:48:40 PM
I'm not familiar with the branch 2.1 but I also did the translation into Latin Spanish ... and naturally the 2.0 branch is done.


Regards!
Title: Re: Edit Unread PMs
Post by: dougiefresh on February 21, 2018, 10:08:28 AM
Uploaded v1.4 - February 20th, 2018
o Fixed issue where $context['folder'] was incorrectly reassigned.
o Moved all language files from xml files to php files for better readability.
o Added Spanish Latin translation, courtsey of Rock Lee (https://www.simplemachines.org/community/index.php?action=profile;u=322597).
o Added translator section to readme.txt.




@Geor'G:  I think I've fixed the bug report that you mentioned.

@Rock Lee:  I've included your translation in this version!  Thanks very much!
Title: Re: Edit Unread PMs
Post by: Geor'G on February 22, 2018, 03:45:03 PM
@dougiefresh, thanks, now works.

In the email notification in the mail, comes the contents of the letter.

ru:
В письме с оповещением на почту, приходит содержание письма.


Test:
You have just been sent a personal message by test on My Community.

IMPORTANT: Remember, this is just a notification. Please do not reply to this email.

The message they sent you was:

;) ;) ;) ;) ;) ;) ;) ;) ;) ;) ;) ;) ;)


I think this code should be inserted into the MessagePost() function, into the file PersonalMessage.php.
ru:
Я думаю этот код, надо вставлять в функцию MessagePost(), файла PersonalMessage.php
loadLanguage('EditPMs');
$txt['pm_email'] = substr($txt['pm_email'], 0, strpos($txt['pm_email'], 'MESSAGE'));
$txt['pm_email'] = substr($txt['pm_email'], 0, strrpos($txt['pm_email'], '.'));



Russification.
Title: Re: Edit Unread PMs
Post by: dougiefresh on October 12, 2018, 09:56:11 PM
Uploaded v1.5 - October 12th, 2018
o No functionality change.
o Updated documentation to point to new website.




@Geor'G:  I apologize for replying so late to your message.  I will incorporate these changes as soon as I get my GitHub repositories uploaded.  If you want, you can create a fork and incorporate those changes yourself and submit a pull request in the meantime.....
Title: Re: Edit Unread PMs
Post by: dougiefresh on October 18, 2018, 10:49:19 AM
Uploaded v1.6 - October 18th, 2018
o Added Russian translation, courtsey of Geor'G (https://www.simplemachines.org/community/index.php?action=profile;u=244106)!
o Fixed an issue where message was incorrectly sent when it shouldn't be.




@Geor'G:  Thank you for the suggested bug fix, as well as the Russian translation!  They've been included in this version!
Title: Re: Edit Unread PMs
Post by: dougiefresh on June 19, 2019, 08:58:52 AM
Uploaded v1.7 - June 19th, 2019
o Added support for SMF 2.1 RC2.
o Removed support for SMF 2.1 Beta 3.
Title: Re: Edit Unread PMs
Post by: efk on July 06, 2021, 05:33:46 AM
3 Questions:

#1
QuoteThis mod should be installed AFTER the PM Attachments mod!
I guess PM Attachments mod is not obligatory to install since I'm not thinking to install it?

#2
I know users are getting email notifications for new posts/topics, but are they getting emails with content from private messages?

#3
1. Execute Modification ./Sources/ManagePermissions.php Test successful
2. Execute Modification ./Sources/PersonalMessage.php Test successful
1. Add After ./Sources/PersonalMessage.php Test successful
2. Add Before ./Sources/PersonalMessage.php Test successful
3. Add After ./Sources/PersonalMessage.php Test successful
4. Replace ./Sources/PersonalMessage.php Test successful
5. Add After ./Sources/PersonalMessage.php Test successful
6. Add Before ./Sources/PersonalMessage.php Test successful
7. Replace ./Sources/PersonalMessage.php Test successful
8. Replace ./Sources/PersonalMessage.php Test successful
9. Add Before ./Sources/PersonalMessage.php Test successful
10. Add Before ./Sources/PersonalMessage.php Test successful
11. Add Before ./Sources/PersonalMessage.php Test successful
12. Add Before ./Sources/PersonalMessage.php Test successful
13. Replace ./Sources/PersonalMessage.php Test successful
14. Add After ./Sources/PersonalMessage.php Test successful
15. Add After ./Sources/PersonalMessage.php Test successful
16. Add Before ./Sources/PersonalMessage.php Test successful
    >>> 17. Add After ./Sources/PersonalMessage.php Test failed (Ignore Errors) <<<
    >>> 18. Add Before ./Sources/PersonalMessage.php Test failed (Ignore Errors) <<<
3. Execute Modification ./Sources/Subs-Post.php Test successful
4. Execute Modification ./Themes/core/PersonalMessage.template.php Test successful
5. Execute Modification ./Themes/default/PersonalMessage.template.php Test successful