Simple Machines Community Forum

Customizing SMF => Modifications and Packages => Topic started by: dougiefresh on November 26, 2017, 10:22:13 AM

Title: Better Messages Menu (SMF 2.0.x Only)
Post by: dougiefresh on November 26, 2017, 10:22:13 AM
Link to Mod (https://custom.simplemachines.org/mods/index.php?mod=4161)


BETTER MESSAGES MENU 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=3904)


Introduction
This mod alters the main menu's "My Messages" menu to bring all the functionality of the PM system to the main forum's menu bar.

This mod was inspired by tip provided by snow (http://www.simplemachines.org/community/index.php?action=profile;u=152526) in Lazy Admin Menu (http://www.simplemachines.org/community/index.php?topic=400767.msg2785613#msg2785613) in order to make it easier for the user to navigate straight to where they want to go.

The only difference is that this mod built dynamically, so that any changes to the profile menu are shown immediately.

Compatibility Notes
This mod was tested on SMF 2.0.14, but should work on any version of SMF 2.0.x.  SMF 1.x will not be supported.

SMF 2.1 Beta 3 will not be supported by this mod, as this mod seeks to duplicate the new functionality of the SMF 2.1 beta series for the SMF 2.0.x series.

Changelog
The changelog can be viewed at XPtsp.com (http://www.xptsp.com/board/free-modifications/better-messages-menu/).

License
Quote
Copyright (c) 2017 - 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.
Title: Re: Better Messages Menu
Post by: Rock Lee on November 26, 2017, 10:50:33 AM
I just installed it but I do not fully understand the function it fulfills ... Does not it have an image that shows what it does?


Regards!
Title: Re: Better Messages Menu
Post by: Arantor on November 26, 2017, 11:01:31 AM
Just curious, but what exactly does this do on 2.1 given the messages item was moved out of the main menu back before beta 1?
Title: Re: Better Messages Menu
Post by: dougiefresh on November 26, 2017, 09:09:14 PM
Just curious, but what exactly does this do on 2.1 given the messages item was moved out of the main menu back before beta 1?
(In a high-and-mighty-like tone...) Well, if you must know.....  O:)  Not a damn thing.  I missed that in the compatibility notes....   :P

Thank you, Arantor, for pointing that out!
Title: Re: Better Messages Menu
Post by: dougiefresh on November 26, 2017, 09:20:50 PM
Uploaded v1.1 - November 26th, 2017
o Updated documentation to properly reflect SMF 2.1 Beta 3 status.
o Fixed package-info.xml so that Subs-BetterMessages.php gets installed.



@Everybody:  I fixed the package-info.xml file so that the file gets moved during installation.  Sorry for the confusion....

@Rock Lee:  Before and After screenshot is attached.  Yes, it is working now.....
Title: Re: Better Messages Menu
Post by: Arantor on November 27, 2017, 02:43:00 AM
I did wonder :P

Nice job.
Title: Re: Better Messages Menu
Post by: Rock Lee on November 27, 2017, 08:18:35 AM
@dougiefresh How strange I did not see it and that left the cursor for a while ... maybe it was a few layered errors to have it in local but the modification seems very good!


Regards!
Title: Re: Better Messages Menu
Post by: dougiefresh on November 27, 2017, 11:31:03 AM
@dougiefresh How strange I did not see it and that left the cursor for a while ... maybe it was a few layered errors to have it in local but the modification seems very good!
Well, when I installed v1.0.x, I didn't see the changes it was supposed to effect.....  Turns out the file responsible for doing said changes wasn't present....  Putting the file in place made the thing work, so the package installer was modified so that the file was correctly copied.
Title: Re: Better Messages Menu
Post by: Rock Lee on November 27, 2017, 06:44:34 PM
Well, when I installed v1.0.x, I didn't see the changes it was supposed to effect.....  Turns out the file responsible for doing said changes wasn't present....  Putting the file in place made the thing work, so the package installer was modified so that the file was correctly copied.

Ah then it was because of that, now while I'm letting down some things, I'm going to try it again to see how it is.


Regards!
Title: Re: Better Messages Menu
Post by: pepa on January 30, 2018, 03:38:24 AM
Uploaded v1.1 - November 26th, 2017
o Updated documentation to properly reflect SMF 2.1 Beta 3 status.
o Fixed package-info.xml so that Subs-BetterMessages.php gets installed.



@Everybody:  I fixed the package-info.xml file so that the file gets moved during installation.  Sorry for the confusion....

@Rock Lee:  Before and After screenshot is attached.  Yes, it is working now.....

Sorry, buy doesn't work for me.  Using SMF 2.0.15 default theme with responsive curve.  I cannot see a file Subs-BetterMessages.php installed?
Title: Re: Better Messages Menu
Post by: pepa on January 30, 2018, 05:21:44 AM
Uploaded v1.1 - November 26th, 2017
o Updated documentation to properly reflect SMF 2.1 Beta 3 status.
o Fixed package-info.xml so that Subs-BetterMessages.php gets installed.



@Everybody:  I fixed the package-info.xml file so that the file gets moved during installation.  Sorry for the confusion....

@Rock Lee:  Before and After screenshot is attached.  Yes, it is working now.....

Sorry, buy doesn't work for me.  Using SMF 2.0.15 default theme with responsive curve.  I cannot see a file Subs-BetterMessages.php installed?
Actually Subs-BetterMessages.php is installed, it's in /Sources ... cannot find add_remove_hooks.php anywhere though, is it supposed to install as well?
Title: Re: Better Messages Menu
Post by: dougiefresh on January 30, 2018, 10:28:28 AM
Actually Subs-BetterMessages.php is installed, it's in /Sources ... cannot find add_remove_hooks.php anywhere though, is it supposed to install as well?
No, the add_remove_hooks.php file is executed by Package Manager, but not installed.
Title: Re: Better Messages Menu
Post by: pepa on January 30, 2018, 05:35:09 PM
Actually Subs-BetterMessages.php is installed, it's in /Sources ... cannot find add_remove_hooks.php anywhere though, is it supposed to install as well?
No, the add_remove_hooks.php file is executed by Package Manager, but not installed.

Yep  ... OK, but it still doesn't work for me even though Subs-BetterMessages.php is in /Sources, any ideas what's up?
Title: Re: Better Messages Menu
Post by: pepa on February 02, 2018, 02:31:40 AM
Actually Subs-BetterMessages.php is installed, it's in /Sources ... cannot find add_remove_hooks.php anywhere though, is it supposed to install as well?
No, the add_remove_hooks.php file is executed by Package Manager, but not installed.

As I said immediately above it still isn't working for me ... but a question:
Subs-BetterMessages.php is installed into /Sources, wondering if it should be in /Themes/default instead?
Title: Re: Better Messages Menu
Post by: pepa on February 02, 2018, 05:47:07 AM
Actually Subs-BetterMessages.php is installed, it's in /Sources ... cannot find add_remove_hooks.php anywhere though, is it supposed to install as well?
No, the add_remove_hooks.php file is executed by Package Manager, but not installed.

As I said immediately above it still isn't working for me ... but a question:
Subs-BetterMessages.php is installed into /Sources, wondering if it should be in /Themes/default instead?

Tried putting the file Subs-BetterMessages.php in /Themes/default but didn't make any difference.  Uninstalled the mod and re-installed it, still doesn't work?
Title: Re: Better Messages Menu
Post by: dougiefresh on February 03, 2018, 12:19:59 PM
Uploaded v1.2 - February 3rd, 2018
o Made sure all function names referenced are what they are supposed to be.



@pepa:  Hopefully this update will work for you.  BTW, the changes made should in the main menu, under My Messages.....
Title: Re: Better Messages Menu
Post by: pepa on February 03, 2018, 04:54:29 PM
Uploaded v1.2 - February 3rd, 2018
o Made sure all function names referenced are what they are supposed to be.



@pepa:  Hopefully this update will work for you.  BTW, the changes made should in the main menu, under My Messages.....

Thanks for your efforts with this Dougie : ) ...unfortunately, it's still not working.  I uninstalled version 1.1 before installing this one, presume that was the right process.  Just checked and Sus-BetterMessages.php has been installed into /Sources.  My overall configuration is:

SMF 2.0.15
Default Theme with Responsive Curve

Installed Mods:
Better Messages Menu   1.2
Contact Page   4.0
SMF 2.0.15 Update   1.0
Board-color-and-icons   1.1
reCAPTCHA for SMF   1.0.0   
Responsive Curve   1.0.0   
PayPal Donate   1.0
Global Topics   2.2

PayPal Donate doesn't work and cannot be uninstalled, there's no uninstaller.
Title: Re: Better Messages Menu
Post by: pepa on February 09, 2018, 06:40:38 AM
Has anyone been able to get this working in 2.0.15?
Title: Re: Better Messages Menu
Post by: Tonyvic on February 09, 2018, 08:11:45 AM
It works fine on my 2.0.15 forum with normal 'Curve', I don't use 'Responsive Curve'
Title: Re: Better Messages Menu
Post by: dougiefresh on February 10, 2018, 10:44:14 AM
@pepa:  I just installed your mod list on my localhost forum.  Better Messages Menu mod works just fine.  Screenshot can be seen on the mod page with the mod in action.

Regarding Paypal Donate, if you emulate SMF 2.0RC5, it will uninstall for you.
Title: Re: Better Messages Menu
Post by: pepa on February 10, 2018, 04:55:42 PM
@pepa:  I just installed your mod list on my localhost forum.  Better Messages Menu mod works just fine.  Screenshot can be seen on the mod page with the mod in action.

Regarding Paypal Donate, if you emulate SMF 2.0RC5, it will uninstall for you.

Thanks Dougie, I just uninstalled Paypal donate.  Still no luck with Better Messages Menu though.  Tried uninstalling it after uninstalling Paypal donate and reinstalled again, but still no go.  I don't suppose I'm missing something basic, like it has to be turned on somewhere in the admin area? Checked the error log, no problems reported there.
Title: Re: Better Messages Menu
Post by: pepa on February 10, 2018, 07:31:23 PM
Still playing around with this.  Seems if I have v1.1 installed I can't install v1.2 as it's listed in /BrowsePackages as an older version.  Checked code differences, before and after install, in PersonalMessage.php ... seems this code is installed:

Code: [Select]
// If we are being called by the Better Messages mod, return with the array:
if (isset($_GET['sa']) && $_GET['sa'] == 'BetterMessages_ucp')
{
$context['pm_areas'] = $pm_areas;
return;
}

Also double checked that Subs-BetterMessages.php is installed in /Sources, it is and the code is:

Code: [Select]
[quote]if (!defined('SMF'))
die('Hacking attempt...');

/**********************************************************************************
* Better Profile Menu hook
**********************************************************************************/
function BetterMessages_Verify_User()
{
if (isset($_GET['action']) && $_GET['action'] == 'pm' && isset($_GET['sa']) && $_GET['sa'] == 'BetterMessages_ucp')
return isset($_GET['u']) ? (int) $_GET['u'] : 0;
}

function BetterMessages_Load_Theme()
{
// This admin hook must be last hook executed!
add_integration_function('integrate_menu_buttons', 'BetterMessages_Menu_Buttons', false);
}

function BetterMessages_Hook()
{
global $user_info, $scripturl, $txt, $context;

// Keep from triggering the Forum Hard Hit mod:
if (!empty($context['HHP_time']))
unset($_SESSION['HHP_Visits'][$context['HHP_time']]);

// Rebuild the PM menu:
$myPM_areas = $context['pm_areas'];
$cached = array();
foreach ($myPM_areas as $id1 => $area1)
{
// Build first level menu:
$cached[$id1] = array(
'title' => $area1['title'],
'show' => true,
'sub_buttons' => array(),
);
$first = $last = false;
if (isset($area1['custom_url']) && !empty($area1['custom_url']))
$first = $cached[$id1]['href'] = $area1['custom_url'];

// Build second level menus:
foreach ($area1['areas'] as $id2 => $area2)
{
if (empty($area2['label']))
continue;
if (!$first)
$first = $cached[$id1]['href'] = $scripturl . '?action=profile;area=' . $id2;

// Add the entry into the custom menu we're building:
$link = isset($area2['custom_url']) ? $area2['custom_url'] : $scripturl . '?action=pm;area=' . $id2;
$show = (!isset($area2['enabled']) || $area2['enabled']) && (empty($area2['permission']['own']) || (!empty($area2['permission']['own']) && allowedTo($area2['permission']['own'])));
$cached[$id1]['sub_buttons'][$last = $id2] = array(
'title' => $area2['label'],
'href' => $link,
'show' => $show,
);

// Let's add the "Show Posts" area to the menu under "Show Topics":
if ($id2 == 'showposts')
$cached[$id1]['sub_buttons'][$last = 'showtopics'] = array(
'title' => $area2['label'] . ': ' . $txt['topics'],
'href' => $link . ';sa=topics',
'show' => $show,
);
}
$cached[$id1]['sub_buttons'][$last]['is_last'] = true;
}

// Cache the menu we just built for the calling user:
$func = function_exists('safe_serialize') ? 'safe_serialize' : 'serialize';
echo $func($cached);
exit;
}

function BetterMessages_Menu_Buttons(&$areas)
{
global $txt, $scripturl, $user_info;

// Gotta prevent an infinite loop here:
if (isset($_GET['action']) && $_GET['action'] == 'pm' && isset($_GET['area']) && $_GET['area'] == 'BetterMessages_ucp')
return;

// Are you a guest, or can't send PMs for some reason?  Then why bother with it....
if (empty($user_info['id']))
return;

// Attempt to get the cached Messages menu:
$MyPM = &$areas['pm'];
if (!empty($user_info['new_pm']) || ($cached = cache_get_data('BetterMessages_' . $user_info['id'], 86400)) == null)
{
// Force the profile code to build our new My Messages menu:
$contents = @file_get_contents($scripturl . '?action=pm;sa=BetterMessages_ucp;u=' . $user_info['id']);
if (substr($contents, 0, 2) == 'a:')
{
$func = function_exists('safe_unserialize') ? 'safe_unserialize' : 'unserialize';
$cached = @$func($contents);
cache_put_data('BetterMessages_' . $user_info['id'], $cached, 86400 * 7);
}
}
if (is_array($cached))
$MyPM['sub_buttons'] = $cached;
}[/quote]

If none of the above gives you any clues, I think I'll just add a final post here stating something along the lines of "enigmatic local error, unable to be replicated elsewhere".

Thanks for trying Dougie, appreciate your effort : )
Title: Re: Better Messages Menu
Post by: dougiefresh on February 10, 2018, 09:29:27 PM
I don't suppose I'm missing something basic, like it has to be turned on somewhere in the admin area?
Nope.  Once you install it, it should show up on the main menu.  There are no switches to turn this on or off, although that's not a bad idea....
Title: Re: Better Messages Menu
Post by: Obsydian on February 10, 2018, 10:50:33 PM
Hello there!

Is it possible to make a no click action on the first dropdown?  I have some people concerned since clicking those take you back to your profile page.
Title: Re: Better Messages Menu
Post by: dougiefresh on February 12, 2018, 11:24:28 AM
@pepa:  Strangely, the mod has stopped working for me....  This is annoying...

@Obsydian:  Yeah, I can do that, once I figure out why the mod isn't working on my localhost forum....
Title: Re: Better Messages Menu
Post by: dougiefresh on February 14, 2018, 09:24:44 PM
Uploaded v1.3 - February 14th, 2018
o Added dropdown box in Profile => Look and Layout to control mod per user.



@pepa and @Obsydian: This version adds a field to the members table, which should default to "Enabled".  I've also added a switch to allow end-users of the forum to control whether they want the mod disabled or enabled, or with the "no click" option enabled.  Hope this helps somebody....

@Obsydian:  I'm pretty sure that your mod request was intended for Better Profile Menu (http://custom.simplemachines.org/mods/index.php?mod=3904), but I will also apply these changes to that mod as well.
Title: Re: Better Messages Menu
Post by: pepa on February 15, 2018, 08:41:53 AM
Hi Dougie

Really hate to tell you this after all your good efforts ... but, still not working. This is there, at least I can see that, but nothing else works, "Added dropdown box in Profile => Look and Layout to control mod per user".
Title: Re: Better Messages Menu
Post by: dougiefresh on February 15, 2018, 10:42:03 AM
@pepa:  Can you attach your Sources/PersonalMessages.php file?  I need to see WTF is going on there....
Title: Re: Better Messages Menu
Post by: pepa on February 15, 2018, 05:46:16 PM
@pepa:  Can you attach your Sources/PersonalMessages.php file?  I need to see WTF is going on there....
Hi Dougie

WTF.php is attached : )
Title: Re: Better Messages Menu
Post by: dougiefresh on February 17, 2018, 12:07:41 PM
Uploaded v1.4 - February 17th, 2018
o Removed possibly unnecessary check from Subs-BetterMessages.php.
o Added redirect to purge file cache, so fresh information can be gathered.



@pepa:  Hopefully, this update will work for you.  I've added a file cache purge redirect, so if you have corrupted information in your cache, purging it SHOULD help make this mod work....
Title: Re: Better Messages Menu
Post by: pepa on February 17, 2018, 04:42:46 PM
Hi Dougie

Thanks again for all your efforts, but still no luck for me with this V1.4.
Title: Re: Better Messages Menu
Post by: dougiefresh on February 17, 2018, 06:01:34 PM
@pepa:  This is getting irritating!  >:(  Does either Better Profile Menu (http://custom.simplemachines.org/mods/index.php?mod=3904) or Lazy Admin Menu (http://custom.simplemachines.org/mods/index.php?mod=3901) mods work on your forum, by any chance?
Title: Re: Better Messages Menu
Post by: pepa on February 17, 2018, 10:04:02 PM
@pepa:  This is getting irritating!  >:(  Does either Better Profile Menu (http://custom.simplemachines.org/mods/index.php?mod=3904) or Lazy Admin Menu (http://custom.simplemachines.org/mods/index.php?mod=3901) mods work on your forum, by any chance?

Hi Dougie, sorry to be an irritant, I do appreciate your efforts : ).  Haven't installed either of those mods, I like to be as minimalist and therefore as bug free as I can with software.  I will install Better Profiles Menu and let you know.

UPDATE: Just installed Better Profile Menu V2.5  ... "Doesn't work for me".
Title: Re: Better Messages Menu
Post by: dougiefresh on February 18, 2018, 06:21:52 AM
@pepa:  You're not irritating me.  It irritates me that I can't make this mod work for ya.  I don't understand why it isn't working...  What mods do you have installed?
Title: Re: Better Messages Menu
Post by: pepa on February 18, 2018, 07:17:52 AM
@pepa:  You're not irritating me.  It irritates me that I can't make this mod work for ya.  I don't understand why it isn't working...  What mods do you have installed?

SMF 2.0.15

Installed Mods:
Better Messages Menu   1.4
Contact Page   4.0
SMF 2.0.15 Update   1.0
reCAPTCHA for SMF   1.0.0   
Responsive Curve   1.0.0   
Global Topics   2.2
Global Headers Footers 2.0.1
Title: Re: Better Messages Menu
Post by: pepa on February 22, 2018, 06:36:50 AM
More problems Dougie.

BetterMessagesMenu V1.4 will not uninstall without errors.  If I try to uninstall there is quite a list of error messages and a recommendation not to proceed.
Title: Re: Better Messages Menu
Post by: dougiefresh on February 22, 2018, 09:48:38 AM
If you uninstall mods in the wrong order, you get issues like that.  In my profile signature:
Quote
Problem uninstalling mods?  Try Arantor's Sortable Packages (and Installed Time) (http://custom.simplemachines.org/mods/index.php?mod=2323) mod!  It's super helpful!
Have you tried this first?
Title: Re: Better Messages Menu
Post by: pepa on February 22, 2018, 05:28:37 PM
If you uninstall mods in the wrong order, you get issues like that.  In my profile signature:
Quote
Problem uninstalling mods?  Try Arantor's Sortable Packages (and Installed Time) (http://custom.simplemachines.org/mods/index.php?mod=2323) mod!  It's super helpful!
Have you tried this first?

Just installed Arantor's mod, but not sure how to work with it.  It shows a list of "View and Remove Installed Packages", does this suggest this all mods need to be uninstalled in order from earliest to latest in order to solve the Better Message Menu uninstall problem?  I tried just clicking on BetterMessagesMenu (which is at the top of the list/most recently installed) but just got the same error messages listed .. so not going there!
Title: Re: Better Messages Menu
Post by: pepa on February 24, 2018, 12:26:30 AM
Hi Dougie

Aleksi has made another suggestion -> here (https://www.simplemachines.org/community/index.php?topic=558993.msg3963200#msg3963200).

But that's not available to me either.
Title: Re: Better Messages Menu
Post by: pepa on February 25, 2018, 04:12:21 PM
Uninstall BetterMessagesMenu V1.4 problem all fixed now, check this thread (https://www.simplemachines.org/community/index.php?topic=558993.0).
Title: Re: Better Messages Menu
Post by: dougiefresh on February 26, 2018, 10:04:22 AM
Uploaded v1.5 - February 26th, 2018
o Fixed issue causing long pause each page load.
o Added Spanish Latin translation, courtsey of Rock Lee (https://www.simplemachines.org/community/index.php?action=profile;u=322597).
Title: Re: Better Messages Menu
Post by: dougiefresh on April 07, 2018, 12:53:53 PM
Uploaded v1.6 - April 7th, 2018
o Fixed Spanish Latin translation XML file to properly skip operations.



@chyyyone: Thanks for reporting this bug (source (https://www.simplemachines.org/community/index.php?topic=525857.msg3968454#msg3968454)).  It's been fixed for this version!
Title: Re: Better Messages Menu
Post by: Steve on April 07, 2018, 03:05:19 PM
Sweet! Not sure why I hadn't installed this before now!
Title: Re: Better Messages Menu
Post by: dougiefresh on October 10, 2018, 12:48:30 PM
Uploaded v1.7 - October 10th, 2018
o No functionality change.
o Updated documentation to point to new website.
Title: Re: Better Messages Menu
Post by: GigaWatt on March 23, 2019, 12:16:49 AM
Has anybody had issues with this mod? Like everyone registered reading their messages when the mod is installed? And then, they seem to go off about their business when the mod is uninstalled :P :D. I guess it's just the power this mod has :D.
Title: Re: Better Messages Menu (SMF 2.0.x Only)
Post by: dougiefresh on June 19, 2019, 09:05:44 AM
@GigaWatt:  I don't understand what you are reporting.  Can you please explain what you mean?  Thanks.....
Title: Re: Better Messages Menu (SMF 2.0.x Only)
Post by: GigaWatt on June 19, 2019, 08:17:52 PM
Well, when the mod is installed, when I (I haven't tested this with a regular/test user) click on the online users link (the one that tells you what everyone currently browsing the forum is doing :)), every single registered user is reading their messages :P :D... which, of course, can't be true :D... not that I've got like 100, 200 users online at that time, but even if that number is 5, it seems very unlikely that they'll all be reading their messages at the same time... and then suddenly stop doing that when the mod is uninstalled :D.

This happens every time I click the online users link... they can't all be reading their messages at the same time, every single one of them, right, LOL :D.
Title: Re: Better Messages Menu (SMF 2.0.x Only)
Post by: dougiefresh on June 20, 2019, 10:10:40 AM
Yeah.....  They can't all be reading them at the same time.  You're right.  It has everything to do with how the mod functions.  Let me see if I can fix the issue....
Title: Re: Better Messages Menu (SMF 2.0.x Only)
Post by: dougiefresh on June 24, 2019, 07:58:15 PM
@GigaWatt:  Can you insert the following code in the writeLog function in Sources/Subs.php, just after global variable declarations?  It should be around line 2591 (in the unmodified version of the file)....
Code: [Select]
// Are we doing something for Better Message Menu mod?
if (!empty($_SESSION['old_url']) && strpos($_SESSION['old_url'], 'action=pm;sa=bettermessages_ucp') !== false)
return;

Let me know if this solves this particular problem.  Thanks!
Title: Re: Better Messages Menu (SMF 2.0.x Only)
Post by: GigaWatt on July 06, 2019, 06:07:31 AM
Sorry for replying a bit late :).

So let me get this straight, you're suggesting to add this code to Subs.php before I install the mod, then install it, and see if the same thing happens again, right?
Title: Re: Better Messages Menu (SMF 2.0.x Only)
Post by: GigaWatt on July 06, 2019, 06:20:25 AM
Nope... I did what I described in my previous post and it still shows me as viewing my messages :-\, when I'm in fact viewing who's online :-\.

(https://i.postimg.cc/MHCsrR9x/SHOT7053.png)
Title: Re: Better Messages Menu (SMF 2.0.x Only)
Post by: Justyne on July 06, 2019, 09:09:37 AM
I am confused. Not sure the screenshot you added to this matches up with what you're saying.
Title: Re: Better Messages Menu (SMF 2.0.x Only)
Post by: GigaWatt on July 06, 2019, 09:56:54 PM
Yeah, my bad... it takes a few seconds for the changes to reflect and I did the screenshot right away. Here's a new one ;).



Hmm... now that's interesting... it shifts between what I'm really doing and viewing my messages just by hitting F5 a few times :D. If "Viewing their messages" shows up, I have to hit F5 two times for "Viewing Who's Online" to show up, but I only have to hit F5 once after "Viewing Who's Online" shows up for it to change back to "Viewing their messages"... weird LOL :D.

(https://i.postimg.cc/J4dx3snh/SHOT7054.png)

(https://i.postimg.cc/MpCY4g12/SHOT7055.png)

I think I added the code in the right place in Subs.php ???.

Code: [Select]
// Put this user in the online log.
function writeLog($force = false)
{
global $user_info, $user_settings, $context, $modSettings, $settings, $topic, $board, $smcFunc, $sourcedir;

// Are we doing something for Better Message Menu mod?
if (!empty($_SESSION['old_url']) && strpos($_SESSION['old_url'], 'action=pm;sa=bettermessages_ucp') !== false)
return;

// If we are showing who is viewing a topic, let's see if we are, and force an update if so - to make it accurate.
if (!empty($settings['display_who_viewing']) && ($topic || $board))
{
// Take the opposite approach!
$force = true;
// Don't update for every page - this isn't wholly accurate but who cares.
if ($topic)
{
if (isset($_SESSION['last_topic_id']) && $_SESSION['last_topic_id'] == $topic)
$force = false;
$_SESSION['last_topic_id'] = $topic;
}
}