Advertisement:

Author Topic: Search Sent Personal Messages (PMs)  (Read 7186 times)

Offline dougiefresh

  • SMF Hero
  • ******
  • Posts: 2,437
    • XPtsp.com Community
Search Sent Personal Messages (PMs)
« on: July 06, 2014, 09:21:50 PM »
Link to Mod


SEARCH SENT PERSONAL MESSAGES v2.5
By Dougiefresh -> Link to Mod


Introduction
This mod allows the users of the Personal Messaging (PM) system to search sent PMs in addition to the core Inbox PMs.  With the Search Sent Personal Messages (PMs) mod installed, you also get the ability to choose between read and unread outgoing PMs.

Version 2.0 introduces the concept of taking action on searched-for PMs.  (Not available on the Core theme!)

Admin Settings
There are no admin settings.  To disable it, you must remove this mod.

Related Discussions
o Search by Sent PMs
o Perform Actions on Searched-For PMs

Compatibility Notes
This mod was tested on SMF 2.0.15, 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.

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

License
Quote
Copyright (c) 2015 - 2017, 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.
« Last Edit: January 19, 2015, 09:43:42 AM by dougiefresh »
NOTICE:  My website is back up!

My Free Simple Machines mods on XPtsp.com and Simple Machines Customization Site!
My mods are being uploaded and are available at GitHub as well!

Offline dougiefresh

  • SMF Hero
  • ******
  • Posts: 2,437
    • XPtsp.com Community
Re: Search Sent Personal Messages (PMs)
« Reply #1 on: July 18, 2014, 03:41:51 AM »
Uploaded v1.2 - July 17, 2014
o Added ability to search Sent Items by user/username
o Added ability to hide the labels when selecting Sent Items to avoid confusion

NOTICE:  My website is back up!

My Free Simple Machines mods on XPtsp.com and Simple Machines Customization Site!
My mods are being uploaded and are available at GitHub as well!

Offline skeletonkiss

  • Jr. Member
  • **
  • Posts: 103
Re: Search Sent Personal Messages (PMs)
« Reply #2 on: August 23, 2014, 05:16:57 PM »
I installed this, and for some reason, the submit button has disappeared from the search page...

Offline dougiefresh

  • SMF Hero
  • ******
  • Posts: 2,437
    • XPtsp.com Community
Re: Search Sent Personal Messages (PMs)
« Reply #3 on: August 24, 2014, 08:25:51 AM »
 :o That's not good....  I'll fix it...
NOTICE:  My website is back up!

My Free Simple Machines mods on XPtsp.com and Simple Machines Customization Site!
My mods are being uploaded and are available at GitHub as well!

Offline dougiefresh

  • SMF Hero
  • ******
  • Posts: 2,437
    • XPtsp.com Community
Re: Search Sent Personal Messages (PMs)
« Reply #4 on: August 24, 2014, 08:39:39 AM »
Uploaded v1.3 - August 24th, 2014
o Moved the submit button so that it is visible without labels being created.
NOTICE:  My website is back up!

My Free Simple Machines mods on XPtsp.com and Simple Machines Customization Site!
My mods are being uploaded and are available at GitHub as well!

Offline dougiefresh

  • SMF Hero
  • ******
  • Posts: 2,437
    • XPtsp.com Community
Re: Search Sent Personal Messages (PMs)
« Reply #5 on: January 19, 2015, 09:43:56 AM »
Uploaded v1.4 - January 19th, 2015
o License change to Simplified BSD.  No functionality change.
NOTICE:  My website is back up!

My Free Simple Machines mods on XPtsp.com and Simple Machines Customization Site!
My mods are being uploaded and are available at GitHub as well!

Offline dougiefresh

  • SMF Hero
  • ******
  • Posts: 2,437
    • XPtsp.com Community
Re: Search Sent Personal Messages (PMs)
« Reply #6 on: April 27, 2015, 07:19:57 PM »
Uploaded v1.5 - April 27th, 2015
o Updated for SMF 2.1 Beta 1
NOTICE:  My website is back up!

My Free Simple Machines mods on XPtsp.com and Simple Machines Customization Site!
My mods are being uploaded and are available at GitHub as well!

Offline dougiefresh

  • SMF Hero
  • ******
  • Posts: 2,437
    • XPtsp.com Community
Re: Search Sent Personal Messages (PMs)
« Reply #7 on: September 25, 2015, 10:18:47 AM »
Uploaded v1.6 - August 29th, 2015
o Removed support for SMF 2.1 Beta 1
o Added support for SMF 2.1 Beta 2

Uploaded v1.7 - September 25th, 2015
o Added support for SMF 2.0.11
NOTICE:  My website is back up!

My Free Simple Machines mods on XPtsp.com and Simple Machines Customization Site!
My mods are being uploaded and are available at GitHub as well!

Offline dougiefresh

  • SMF Hero
  • ******
  • Posts: 2,437
    • XPtsp.com Community
Re: Search Sent Personal Messages (PMs)
« Reply #8 on: March 16, 2017, 09:50:18 PM »
Uploaded v2.0 - March 13th, 2017[
o Rebuilt mod to work with Separate Unread PMs mod.
NOTICE:  My website is back up!

My Free Simple Machines mods on XPtsp.com and Simple Machines Customization Site!
My mods are being uploaded and are available at GitHub as well!

Offline James Gryphon

  • Semi-Newbie
  • *
  • Posts: 54
Re: Search Sent Personal Messages (PMs)
« Reply #9 on: March 28, 2017, 07:52:59 PM »
Hi Doug,
I've been looking into installing some of these mods (Search Sent, Separate Unread PMs, and also Edit Unread) to replace the older Enhanced PM System mod. Unfortunately, some things haven't been going so well.

Search Sent and Separate each generate errors when attempting to install when the other one is already installed; 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.

Unfortunately I don't have time to go through right now and check to see what each of these errors are right now for you, but I thought I'd ask whether these errors are known and if the mods actually work fine in spite of the error reports. If you hadn't heard of any of this before and need more info, I'll provide it ASAP; I just thought I'd get this post on right now before I leave for a few hours, so you might have a chance to hear about it earlier.

I haven't done a lot of testing to see how well they work with the PM Attachments mod. I mean to look into that sometime soon, though.

Offline dougiefresh

  • SMF Hero
  • ******
  • Posts: 2,437
    • XPtsp.com Community
Re: Search Sent Personal Messages (PMs)
« Reply #10 on: March 28, 2017, 10:20:00 PM »
Search Sent and Separate each generate errors when attempting to install when the other one is already installed;

Also, all of them pretty universally report a multitude of errors with the Core theme's template file.
Thank you for notifying me of these issues!  I am working to resolve these issues that you raised!  I try to make sure everything will play nice with everything else....  Guess I missed something  O:)

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.
Fixed these issues with the Edit Unread PMs mod....
NOTICE:  My website is back up!

My Free Simple Machines mods on XPtsp.com and Simple Machines Customization Site!
My mods are being uploaded and are available at GitHub as well!

Offline James Gryphon

  • Semi-Newbie
  • *
  • Posts: 54
Re: Search Sent Personal Messages (PMs)
« Reply #11 on: March 29, 2017, 03:42:26 PM »
All right!

Now that my schedule is more free, do you want me to post up the error messages I get when attempting to install, or do you have that under control?

Offline dougiefresh

  • SMF Hero
  • ******
  • Posts: 2,437
    • XPtsp.com Community
Re: Search Sent Personal Messages (PMs)
« Reply #12 on: March 30, 2017, 09:41:16 AM »
Now that my schedule is more free, do you want me to post up the error messages I get when attempting to install, or do you have that under control?
I'm working on it.  The only operation in conflict that I'm aware of is operation 6 in PersonalMessages.php.....  Do you have more?

EDIT:  As well as the core theme issue....
« Last Edit: March 30, 2017, 10:03:54 AM by dougiefresh »
NOTICE:  My website is back up!

My Free Simple Machines mods on XPtsp.com and Simple Machines Customization Site!
My mods are being uploaded and are available at GitHub as well!

Offline James Gryphon

  • Semi-Newbie
  • *
  • Posts: 54
Re: Search Sent Personal Messages (PMs)
« Reply #13 on: March 30, 2017, 06:29:41 PM »
Not counting the Core theme stuff…

With "Separate Unread PMs" installed, attempting to install Search Sent PMs.

1. Replace failed (PersonalMessage.php)
Code: (Find) [Select]
$pmbox = $context['folder'] != 'sent' ? $txt['inbox'] : $txt['sent_items'];
Code: (Replace) [Select]
$context['folder_pmbox'] = $pmbox = ($context['folder'] != 'sent' ? ($context['folder'] != 'unread' ? $txt['inbox'] : $txt['unread_items']) : $txt['sent_items']);
With Separate Unread PMs installed, attempting to install Edit Unread PMs 1.2.

4. Add after failed (PersonalMessage.php)
Code: (Find) [Select]
$context['folder'] = !isset($_REQUEST['f']) || $_REQUEST['f'] != 'sent' ? 'inbox' : 'sent';
Code: (Replace) [Select]
$context['folder'] = !isset($_GET['sa']) || $_GET['sa'] == 'edit' || $_GET['sa'] == 'edit' ? 'sent' : $context['folder'];

15. Add after failed ("Ignore errors")
16. Add before failed ("Ignore errors")

With Search Sent PMs installed, attempting to install Separate Unread PMs.

6. Replace failed (PersonalMessage.php)
Code: ("Find") [Select]
$pmbox = $context['folder'] != 'sent' ? $txt['inbox'] : $txt['sent_items'];
Code: ("Replace") [Select]
$pmbox = $context['folder'] == 'sent' ? $txt['sent_items'] : $context['folder'] == 'unread' ? $txt['unread_items'] : $txt['inbox'];
No apparent main errors when attempting to install Edit Unread PMs onto Search Sent PMs, except Core theme errors.

With Edit Sent PMs installed, attempting to install Separate Unread PMs.

No errors!

With Edit Sent PMs installed, attempting to install Search Sent PMs.

No main errors, except for Core theme errors.

At a quick glance, I don't think PM attachment mod impacts whether any of these mods install properly, although if someone wants to uninstall it after installing one of these mods, they need to uninstall the other mods first.

Offline dougiefresh

  • SMF Hero
  • ******
  • Posts: 2,437
    • XPtsp.com Community
Re: Search Sent Personal Messages (PMs)
« Reply #14 on: August 04, 2017, 02:36:25 PM »
@James Gryphon:  I've made changes to both this mod, as well as uploaded version 1.6 of the Separate Unread PMs mod, which contains related install-compatibility fixes.  I've going to work on the Core theme compatibility (as well as compatibility with SMF 2.1 Beta 3) before uploading the fixed version of this mod....

I haven't tested the PM Attachment mod in with this mix, though.  I can't see how it affects either of these two mods, although I really haven't dug deep into that mod, either....
NOTICE:  My website is back up!

My Free Simple Machines mods on XPtsp.com and Simple Machines Customization Site!
My mods are being uploaded and are available at GitHub as well!

Offline dougiefresh

  • SMF Hero
  • ******
  • Posts: 2,437
    • XPtsp.com Community
Re: Search Sent Personal Messages (PMs)
« Reply #15 on: August 04, 2017, 11:06:27 PM »
Uploaded v2.1 - August 4th, 2017
o Removed support for SMF 2.1 Beta 1 & 2.
o Added support for SMF 2.1 Beta 3.
o Added almost-complete support for SMF 2.0's Core theme.
o Compatibilty changes for Separate Unread PMs.



@James Gryphon:  Hopefully this update fixes the compatibility issues you reported earlier.  Thank you for the report!
NOTICE:  My website is back up!

My Free Simple Machines mods on XPtsp.com and Simple Machines Customization Site!
My mods are being uploaded and are available at GitHub as well!

Offline GL700Wing

  • Jr. Member
  • **
  • Posts: 269
  • Gender: Female
Re: Search Sent Personal Messages (PMs)
« Reply #16 on: October 01, 2017, 06:56:21 AM »
I've encountered a couple of 'Undefined Index' issues with v2.2 of this mod - fixes as follows:

Error Message: Undefined index: is_selected
Cause: Installation code missing.

./Sources/PersonalMessage.php
Find:
Code: [Select]
'counter' => ++$counter,
Add After:
Code: [Select]
'is_selected' => '',

Error Message: Undefined index: icon
Cause: Installation code incorrect.

./Themes/default/PersonalMessage.template.php
Find:
Code: [Select]
<td>', $message['time'], '</td>
<td>', $message['link'], '</td>
<td>', $message['member']['link'], '</td>

Replace with:
Code: [Select]
<td align="center">
<script type="text/javascript"><!-- // --><![CDATA[
currentLabels[', $message['id'], '] = {';

if (!empty($message['labels']))
{
$first = true;
foreach ($message['labels'] as $label)
{
echo $first ? '' : ',', '
"', $label['id'], '": "', $label['name'], '"';
$first = false;
}
}

echo '
};
// ]]></script>
', $message['is_replied_to'] ? '<img src="' . $settings['images_url'] . '/icons/pm_replied.gif" style="margin-right: 4px;" alt="' . $txt['pm_replied'] . '" />' : '<img src="' . $settings['images_url'] . '/icons/pm_read.gif" style="margin-right: 4px;" alt="' . $txt['pm_read'] . '" />', '</td>
<td>', $message['time'], '</td>
<td>', $message['link'], '</td>
<td>', ($context['folder'] == 'inbox' ? $message['member']['link'] : implode(', ', $message['recipients']['to'])), '</td>
<td align="center" width="4%"><input type="checkbox" name="pms[]" id="deletelisting', $message['id'], '" value="', $message['id'], '"', $message['is_selected'] ? ' checked="checked"' : '', ' onclick="if (document.getElementById(\'deletedisplay', $message['id'], '\')) document.getElementById(\'deletedisplay', $message['id'], '\').checked = this.checked;" class="input_check" /></td>

However, despite fixing these errors and installing v2.2 on an SMF 2.0.14 forum without any other mods, this mod does not return *any* results when searching 'Sent Items' ...

Offline GL700Wing

  • Jr. Member
  • **
  • Posts: 269
  • Gender: Female
Re: Search Sent Personal Messages (PMs)
« Reply #17 on: October 01, 2017, 08:43:00 AM »
It took me a while to work out why the mod was still not working but I did find it and it's also due to an installation error:

Error Condition: No Messages Found
Cause: Installation code incorrect ('Add Before' used instead of 'Replace With').

./Sources/PersonalMessage.php
Find:
Code: [Select]
$context['folder'] = 'inbox';
Replace With:
Code: [Select]
$folder = (int) (isset($_REQUEST['search_what']) ? $_REQUEST['search_what'] : 1);
$context['folder'] = ($folder == 1 ? 'inbox' : (!isset($context['sup_folder']) || $folder == 2 ? 'sent' : 'unread'));


Finally, and even though I was now getting search results from 'Sent Items', the links provided did not work but after further investigation I found the cause and worked out the fix.

Error Message: You are not allowed to access this section
Cause: Installation code incorrect (the folder was always being set to 'unread' instead of using $context['folder'] when applicable).

./Sources/PersonalMessage.php
Find:
Code: [Select]
$href = $scripturl . '?action=pm;f=' . $context['folder'] . (isset($context['first_label'][$row['id_pm']]) ? ';l=' . $context['first_label'][$row['id_pm']] : '') . ';pmid=' . ($context['display_mode'] == 2 && isset($real_pm_ids[$head_pms[$row['id_pm']]]) ? $real_pm_ids[$head_pms[$row['id_pm']]] : $row['id_pm']) . '#msg' . $row['id_pm'];
Replace With:
Code: [Select]
$href = $scripturl . '?action=pm;f=' . ($context['folder'] != 'unread' && empty($context['message_read'][$row['id_pm']]) ? $context['folder'] : 'unread') . ';kstart;start=0;sort=date;pmid=' . ($context['display_mode'] == 2 && isset($real_pm_ids[$head_pms[$row['id_pm']]]) ? $real_pm_ids[$head_pms[$row['id_pm']]] : $row['id_pm']) . '#msg' . $row['id_pm'];

Offline GL700Wing

  • Jr. Member
  • **
  • Posts: 269
  • Gender: Female
Re: Search Sent Personal Messages (PMs)
« Reply #18 on: October 02, 2017, 06:06:53 AM »
One last 'Undefined Index' error caused by a text string missing from a language file.

Error Message: Undefined index: sent
Cause: Missing text string

./Themes/default/languages/PersonalMessage.english.php
Find (at the end of the file):
Code: [Select]
?>
Add Before:
Code: [Select]
$txt['pm_search_what'] = 'Search group';
$txt['pm_search_to_user'] = 'To user';
$txt['sent'] = 'Sent Items';

Offline dougiefresh

  • SMF Hero
  • ******
  • Posts: 2,437
    • XPtsp.com Community
Re: Search Sent Personal Messages (PMs)
« Reply #19 on: October 09, 2017, 09:10:03 AM »
Uploaded v2.3 - October 9th, 2017
o Added missing string, as noted by GL700Wing in this post.



@GL700Wing:  Thank you for reporting the missing string!  I've got in this update!
NOTICE:  My website is back up!

My Free Simple Machines mods on XPtsp.com and Simple Machines Customization Site!
My mods are being uploaded and are available at GitHub as well!