• Welcome to Simple Machines Community Forum. Please login or sign up.
December 07, 2021, 01:04:01 AM

News:

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


Better Messages Menu (SMF 2.0.x Only)

Started by dougiefresh, November 26, 2017, 10:22:13 AM

Previous topic - Next topic

pepa

February 10, 2018, 04:55:42 PM #20 Last Edit: February 10, 2018, 05:11:36 PM by pepa
Quote from: 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.

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.

pepa

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:

// 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:

[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 : )

dougiefresh

Quote from: pepa on February 10, 2018, 04:55:42 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....

Obsydian

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.

dougiefresh

@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....

dougiefresh

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, but I will also apply these changes to that mod as well.

pepa

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".

dougiefresh

@pepa:  Can you attach your Sources/PersonalMessages.php file?  I need to see WTF is going on there....

pepa

Quote from: 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....
Hi Dougie

WTF.php is attached : )

dougiefresh

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....

pepa

Hi Dougie

Thanks again for all your efforts, but still no luck for me with this V1.4.

dougiefresh

@pepa:  This is getting irritating!  >:(  Does either Better Profile Menu or Lazy Admin Menu mods work on your forum, by any chance?

pepa

Quote from: dougiefresh on February 17, 2018, 06:01:34 PM
@pepa:  This is getting irritating!  >:(  Does either Better Profile Menu or Lazy Admin Menu 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".

dougiefresh

@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?

pepa

Quote from: 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?

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

pepa

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.

dougiefresh

February 22, 2018, 09:48:38 AM #36 Last Edit: February 22, 2018, 10:31:40 AM by dougiefresh
If you uninstall mods in the wrong order, you get issues like that.  In my profile signature:
QuoteProblem uninstalling mods?  Try Arantor's Sortable Packages (and Installed Time) mod!  It's super helpful!
Have you tried this first?

pepa

Quote from: 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:
QuoteProblem uninstalling mods?  Try Arantor's Sortable Packages (and Installed Time) 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!

pepa

Hi Dougie

Aleksi has made another suggestion -> here.

But that's not available to me either.

pepa

Uninstall BetterMessagesMenu V1.4 problem all fixed now, check this thread.

Advertisement: