News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Search Sent Personal Messages (PMs)

Started by dougiefresh, July 06, 2014, 09:21:50 PM

Previous topic - Next topic

GigaWatt

Quote from: Kindred on January 13, 2021, 03:15:59 PM
However, providing the instructions on WHAT to update in the mod is perfectly allowed....

Well... of course it is :D. I don't see an issue in that, some members have been doing that in support threads of abandoned mods ;).
"This is really a generic concept about human thinking - when faced with large tasks we're naturally inclined to try to break them down into a bunch of smaller tasks that together make up the whole."

"A 500 error loosely translates to the webserver saying, "WTF?"..."

GL700Wing

#41
Quote from: James Gryphon on January 13, 2021, 12:07:31 PMDiscovered when I was attempting to fix something (the pagination seems to be broken).
The pagination issue is caused by the value of the folder to search being reset to '1' (ie, inbox) when there is more than one page of results and you click on the page index link for the second or subsequent pages.

I've just worked out a fix for this using a session variable - the variable is unset when the 'Search Messages' window is displayed and it's set when the search button is clicked (at this point the folder to search has been selected).

In ./Sources/PersonalMessage.php
Find:
// !!! For the moment force the folder to the inbox.
$folder = (int) (isset($_REQUEST['search_what']) ? $_REQUEST['search_what'] : 1);
$context['folder'] = ($folder == 1 ? 'inbox' : (!isset($context['sup_folder']) || $folder == 2 ? 'sent' : 'unread'));

Replace With:
// !!! For the moment force the folder to the inbox.
if (!isset($_SESSION['pm_search_folder']))
{
$folder = (int) (isset($_REQUEST['search_what']) ? $_REQUEST['search_what'] : 1);
$context['folder'] = ($folder == 1 ? 'inbox' : (!isset($context['sup_folder']) || $folder == 2 ? 'sent' : 'unread'));
}
else
$context['folder'] = $_SESSION['pm_search_folder'];


In ./Themes/default/PersonalMessage.template.php
Find:
function template_search()
{
global $context, $settings, $options, $scripturl, $modSettings, $txt;

Add After:
// Unset the session variable for pm folder name.
unset($_SESSION['pm_search_folder']);
Life doesn't have to be perfect to be wonderful ...

Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

GL700Wing

#42
Quote from: GL700Wing on January 14, 2021, 07:07:17 AMThe pagination issue is caused by the value of the folder to search being reset to '1' (ie, inbox) when there is more than one page of results and you click on the page index link for the second or subsequent pages.

I've just worked out a fix for this using a session variable - the variable is unset when the 'Search Messages' window is displayed and it's set when the search button is clicked (at this point the folder to search has been selected).

And I just worked out a much simper fix which also seems to work ...

In ./Sources/PersonalMessage.php
Find:
// !!! For the moment force the folder to the inbox.
$folder = (int) (isset($_REQUEST['search_what']) ? $_REQUEST['search_what'] : 1);
$context['folder'] = ($folder == 1 ? 'inbox' : (!isset($context['sup_folder']) || $folder == 2 ? 'sent' : 'unread'));

Replace With:
if (isset($_REQUEST['search_what']))
{
$folder = (int) ($_REQUEST['search_what']);
$context['folder'] = ($folder == 1 ? 'inbox' : (!isset($context['sup_folder']) || $folder == 2 ? 'sent' : 'unread'));
};
Life doesn't have to be perfect to be wonderful ...

Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

James Gryphon

@GL700Wing: Unfortunately I didn't have any luck with the most recent PersonalMessage.php fix, but the first and complex one seems to work fine; congrats!

I also haven't run into the count error, so I'm hoping that the problem was related to that and now the mod is in good shape.

GL700Wing

#44
Quote from: James Gryphon on January 14, 2021, 11:24:11 PM@GL700Wing: Unfortunately I didn't have any luck with the most recent PersonalMessage.php fix, but the first and complex one seems to work fine; congrats!

I also haven't run into the count error, so I'm hoping that the problem was related to that and now the mod is in good shape.
Glad one of them worked!
Life doesn't have to be perfect to be wonderful ...

Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

Advertisement: