ElkArte Community

Extending Elk => Addons => Topic started by: live627 on February 27, 2015, 12:12:09 am

Title: [ADDON] Ultimate Menu
Post by: live627 on February 27, 2015, 12:12:09 am
Ultimate Menu 1.0

(http://opensource.org/licenses/MIT) (https://github.com/live627/elk-um/issues) (https://github.com/live627/elk-um/releases) (https://github.com/live627/elk-um/releases) (https://supporter.60devs.com/give/axlsj1o8o0amepfrr5eqlcjza)

Add custom buttons to the main menu within ElkArte

Introduction:

This allows custom buttons to be added to the main menu within ElkArte at will, complete with children and grandchildren menus (so, a main menu item, a dropdown and a follow-on dropdown)

Known issues:


http://addons.ElkArte.net/enhancement/Ultimate-Menu.html

Title: Re: [ADDON] Ultimate Menu
Post by: nhwood on February 27, 2015, 04:09:34 am
I suck at PHP so this will come in handy, thanks :)
I was hoping this would allow us to edit the current menu also but it's good enough.
Title: Re: [ADDON] Ultimate Menu
Post by: nhwood on February 27, 2015, 04:18:06 am
Found a bug
Title: Re: [ADDON] Ultimate Menu
Post by: Ant59 on February 27, 2015, 04:43:24 am
Awesome addon! I'm sure this will be helpful to a lot of people wanting to just add a few links to their menus without diving into their theme code. Is it possible to also remove the built-in options with this addon?
Title: Re: [ADDON] Ultimate Menu
Post by: live627 on February 27, 2015, 11:02:00 am
Quote Is it possible to also remove the built-in options with this addon?
No.
Title: Re: [ADDON] Ultimate Menu
Post by: emanuele on February 27, 2015, 02:38:40 pm
Nice stuff here too! :D
Title: Re: [ADDON] Ultimate Menu
Post by: meetdilip on March 02, 2015, 09:43:48 am
Excellent @live627 . Love it :)
Title: Re: [ADDON] Ultimate Menu
Post by: Jorin on March 06, 2015, 01:49:16 am
Great! This comes in handy atm!  :)
Title: Re: [ADDON] Ultimate Menu
Post by: Jorin on March 06, 2015, 06:00:04 am
Tried to install it and get these error message:

QuoteParse error: syntax error, unexpected '[' in /www/htdocs/w00f21f1/hp_elkarte/packages/temp/install.php on line 87

Line 87 is this:

Code: [Select]
foreach ($tables as $table)
$dbtbl->db_create_table('{db_prefix}' . $table['name'], $table['columns'], $table['indexes'], [], 'update');
Title: Re: [ADDON] Ultimate Menu
Post by: Spuds on March 06, 2015, 08:54:35 am
Thats php 5.4 shorthand syntax, change the
Code: [Select]
 , [], 
to
Code: [Select]
 , array(),
Title: Re: [ADDON] Ultimate Menu
Post by: emanuele on March 06, 2015, 08:56:41 am
Problem is that the same construct is used in the code as well, so it would not work unless all the instances are replaced or you @Jorin update to php 5.4.
Title: Re: [ADDON] Ultimate Menu
Post by: Spuds on March 06, 2015, 08:58:59 am
Ah good to know, had not looked at the code ... if thats the only 5.4 stuff easy to change though.
Title: Re: [ADDON] Ultimate Menu
Post by: Jorin on March 06, 2015, 10:03:37 am

Hm, server is running PHP 5.3. It seems I can "update" via PHP-CGI but I think I remember from my SMF support board that PHI-CGI should only be used with caution. Maybe @live627 can modify the addon?
Title: Re: [ADDON] Ultimate Menu
Post by: ahrasis on March 07, 2015, 07:36:26 pm
Nice addon @live627
Title: Re: [ADDON] Ultimate Menu
Post by: live627 on March 07, 2015, 08:26:43 pm
Quote from: Spuds – if thats the only 5.4 stuff easy to change though.
Yep.
Title: Re: [ADDON] Ultimate Menu
Post by: Jorin on March 13, 2015, 07:17:25 am

Have this too.  :(
Title: Re: [ADDON] Ultimate Menu
Post by: Jorin on March 13, 2015, 07:55:33 am
Another Bug. I created a child entry. It looks like this.
Title: Re: [ADDON] Ultimate Menu
Post by: Jorin on March 13, 2015, 08:18:20 am
Urgs! An internal link leads to this:

Code: [Select]
http://forum-alternative-antriebe.de/index.php?/topic,467.0.html

when entering only:

Code: [Select]
/topic,467.0.html

I need it without the ?

 :o
Title: Re: [ADDON] Ultimate Menu
Post by: Jorin on March 13, 2015, 08:27:38 am
And a third: I made more then one child entries. But they are not shown. It seems only one child entry is shown.

Edit: Now I know why! I cannot choose "before" or "after" for the location of a child entry (then it's not shown). I can only choose "child of" and choose the parent entry. So there's no chance to sort child entries atm.
Title: Re: [ADDON] Ultimate Menu
Post by: Jorin on March 13, 2015, 09:35:27 am
Sorry, but it's not working without errors anyhow. After re-organization of the child entries all of them disappeared. After that I can't make new entries now. At the moment the first entry, the main one, will not collapse (they are child entries in it). I have to deactivate the addon, it doesn't work in my board.  :(
Title: Re: [ADDON] Ultimate Menu
Post by: ahrasis on March 13, 2015, 11:30:13 pm

I don't think without ? is possible or is it possible @emanuele / @Spuds ?
Title: Re: [ADDON] Ultimate Menu
Post by: Jorin on March 14, 2015, 02:00:41 am
Oh, you're right. Why are my topic links look like that:

Quotehttp://forum-alternative-antriebe.de/index.php/topic,4396.0.html

And yours look like that:

Quotehttp://www.elkarte.net/community/index.php?topic=2310.0

:o
Title: Re: [ADDON] Ultimate Menu
Post by: emanuele on March 14, 2015, 05:16:14 pm
Honestly I never used that version of the links, so I have no idea at the moment.
Title: Re: [ADDON] Ultimate Menu
Post by: Spuds on March 14, 2015, 05:42:49 pm
Those are what you get if you enable "Search engine friendly URLs" in the ACP ... (configuration->general)
Title: Re: [ADDON] Ultimate Menu
Post by: Spuds on March 16, 2015, 11:13:16 am
Was messing around a bit, not sure I really did anything :P  but did change a couple minor porting items and a couple of minor things.
Title: Re: [ADDON] Ultimate Menu
Post by: live627 on March 19, 2015, 04:16:03 am
Quote from: Jorin – Urgs! An internal link leads to this:

Code: [Select]
http://forum-alternative-antriebe.de/index.php?/topic,467.0.html

when entering only:

Code: [Select]
/topic,467.0.html

I need it without the ?

 :o
I guess you can try topic=467 (assuming the buffer fixes it, I haven't checked) or try the full external link option.

Quote from: emanuele – Honestly I never used that version of the links, so I have no idea at the moment.
me neither

Quote from: Spuds – Was messing around a bit, not sure I really did anything :P  but did change a couple minor porting items and a couple of minor things.
Thanks! Added to the repo.
Title: Re: [ADDON] Ultimate Menu
Post by: Jorin on March 19, 2015, 04:47:17 am
Quote from: Spuds – Those are what you get if you enable "Search engine friendly URLs" in the ACP ... (configuration->general)

So the experts don't use search enginge friendly URLs? Why not?  :o
Title: Re: [ADDON] Ultimate Menu
Post by: radu81 on March 19, 2015, 04:55:18 am
I'm not an expert, but I see non advantage in using this kind of links. Even a site like Youtube is not using friendly urls.

In the past I used on smf the Pretty URLS mod which I don't recommend, the site was getting slower and slower and the database bigger and bigger.
Title: Re: [ADDON] Ultimate Menu
Post by: live627 on March 19, 2015, 05:00:26 am
Elk bug. Problem areas highlighted.

input, .input_text, button, select {
    height: 2em;
    max-height: 2em;
    min-height: 2em;

    padding: 0 6px;
    vertical-align: middle;
}
Title: Re: [ADDON] Ultimate Menu
Post by: live627 on March 19, 2015, 05:03:33 am
Quote from: Jorin –
Quote from: Spuds – Those are what you get if you enable "Search engine friendly URLs" in the ACP ... (configuration->general)
So the experts don't use search enginge friendly URLs? Why not?  :o
The only advantage is human readability. Spiders are not affected at all.
Title: Re: [ADDON] Ultimate Menu
Post by: live627 on March 19, 2015, 05:10:21 am
I cannot uninstall this despite

Code: [Select]
<uninstall for="1.0 - 1.0.99">
Title: Re: [ADDON] Ultimate Menu
Post by: Spuds on March 19, 2015, 09:38:56 am
Quote from: live627 –
Quote from: Jorin –
Quote from: Spuds – Those are what you get if you enable "Search engine friendly URLs" in the ACP ... (configuration->general)
So the experts don't use search enginge friendly URLs? Why not?  :o
The only advantage is human readability. Spiders are not affected at all.
It also only works "out of the box" on Apache/Lighttpd, and I use Nginx for almost everything these days.


Yeah I've know about that one since RC days, there are a couple of override classes to "fix" that behavior where needed, but a generic class should be added as well, I'll toss something in for 1.04.  
Don't know what to say other than any form elements need to be beaten to death to get them to display properly across OS (and revisions), font stacks and browsers.  Probably worth a revisit in 1.1 but chasing down how those areas render across win/mac/*nix/ saf/ie/chrome/ff/etc 7/8/ml/mav/yos/unbu/cent/etc/blabla is not a whole lot of fun.  At one point I had a test setup with a combo matrix to see how those rendered (or did not) the differences were sometimes stunning.  At some point the same needs to be done or checked on, mobile devices as well bleh!

Title: Re: [ADDON] Ultimate Menu
Post by: Joshua Dickerson on March 19, 2015, 04:17:20 pm
Quote from: Jorin –
Quote from: Spuds – Those are what you get if you enable "Search engine friendly URLs" in the ACP ... (configuration->general)

So the experts don't use search enginge friendly URLs? Why not?  :o
"Search engine friendly" is a misnomer. They are really just more friendly for humans but have no bearing for the major search engines.
Title: Re: [ADDON] Ultimate Menu
Post by: Jorin on March 20, 2015, 02:08:37 am
Do you prefer to change back to "normal" URLs? Is this possible for me?
Title: Re: [ADDON] Ultimate Menu
Post by: live627 on March 20, 2015, 02:29:16 am
Can someone split out the off-topic SEF URL posts?
Title: Re: [ADDON] Ultimate Menu
Post by: Obamatron on March 27, 2015, 09:38:08 am
How about FontAwesone icons for mobile users?
Title: Re: [ADDON] Ultimate Menu
Post by: live627 on March 27, 2015, 08:59:17 pm
Does Ellk's main menu support icons? I haven't checked...
Title: Re: [ADDON] Ultimate Menu
Post by: kode54 on January 19, 2016, 10:00:02 pm
Issue/feature request: Allow defining a FontAwesome icon for the small screen view for top level menus.
Title: Re: [ADDON] Ultimate Menu
Post by: Jorin on January 20, 2016, 01:30:55 am
Huh? They do have an icon in mobile view which is a fontawesome icon and can be changed in the css files. What do you mean exactly?
Title: Re: [ADDON] Ultimate Menu
Post by: kode54 on January 20, 2016, 02:04:57 am
I am referring to this report (https://hydrogenaud.io/index.php/topic,110890.msg914717.html#msg914717).
Title: Re: [ADDON] Ultimate Menu
Post by: Jorin on January 20, 2016, 02:09:06 am
It seems the code must be copied to the section for mobile views. Should be in the css files too. But I don't know where.
Title: Re: [ADDON] Ultimate Menu
Post by: oblivion on February 25, 2016, 09:31:45 am
I've installed this and configured a new menu item.  It doesn't show up for some custom member groups that inherit the regular member permissions.
Title: Re: [ADDON] Ultimate Menu
Post by: kode54 on April 01, 2016, 08:43:08 pm
Icon picker. Add icon data attribute to links.

Or instead, I think I'll just eliminate the code that turns the top menu into incomprehensible icons on mobile devices. But that's ElkArte code or style, not this add-on.
Title: Re: [ADDON] Ultimate Menu
Post by: emanuele on April 02, 2016, 05:33:49 pm
Are you asking for an icon picker for the menu entries?
If so, I guess it would make sense, since icons are added in a nasty way in Elk.
Actually, you should still be able to add them via css alone (inside a media query), can't give you an example right now, sorry... :(
Title: Re: [ADDON] Ultimate Menu
Post by: live627 on July 17, 2016, 08:04:26 pm
v1.0 is now officially released!

http://addons.elkarte.net/enhancement/Ultimate-Menu.html

Please do donate if you feel so inclined.  
Title: Re: [ADDON] Ultimate Menu
Post by: Jorin on July 18, 2016, 12:46:54 am
Great! I will give it another try!  :)
Title: Re: [ADDON] Ultimate Menu
Post by: Jorin on July 18, 2016, 02:05:17 am
I get three errors:

1. A long title for the button (or maybe the html code inside the title) makes it impossible to edit the title after saving the button. This happens if you edit a button with such a long title (attachment 1). Title I saved was:

Code: [Select]
<i class="fa fa-pencil" aria-hidden="true"></i> Entwürfe

2. It causes problems with my start page using bootstrap things (attachment 2). The button clicked is not shown active too. This is line 26 and following:

Code: [Select]
	// Make damn sure we ALWAYS load last. Priority: 100!
if (end(explode(',', $modSettings['integrate_menu_buttons'])) != 'um_load_menu')
{
remove_integration_function('integrate_menu_buttons', 'um_load_menu');
add_integration_function('integrate_menu_buttons', 'um_load_menu');
}

3. Icons made with addon are not shown in mobile view. There is only a white pixel shown.
Title: Re: [ADDON] Ultimate Menu
Post by: emanuele on July 18, 2016, 05:58:37 pm
The errors can be fixed by changing:
Code: [Select]
if (end(explode(',', $modSettings['integrate_menu_buttons'])) != 'um_load_menu')
to:
Code: [Select]
$hooks = explode(',', $modSettings['integrate_menu_buttons']);
if (end($hooks) != 'um_load_menu')
Title: Re: [ADDON] Ultimate Menu
Post by: Jorin on July 19, 2016, 01:11:09 am
The error is gone, thank you, but the three problems stay.
Title: Re: [ADDON] Ultimate Menu
Post by: Jorin on July 25, 2016, 03:17:47 am
Can the addon author please help me with the icons not shown in mobile view?  :-[

Edit: Would be nice if the user and group rights to see an menu icon or not were considered too.
Title: Re: [ADDON] Ultimate Menu
Post by: emanuele on July 25, 2016, 07:38:51 am
Quote from: Jorin – 1. A long title for the button (or maybe the html code inside the title) makes it impossible to edit the title after saving the button. This happens if you edit a button with such a long title (attachment 1). Title I saved was:

Code: [Select]
<i class="fa fa-pencil" aria-hidden="true"></i> Entwürfe
This is not a problem of long name, but of unsanitized data.
@live627 you should htmlspecialchars $context['button_data']['name'].
Jorin, for the time being you can fix it by changing:
Code: [Select]
<input type="text" name="name" id="bnbox" value="', $context['button_data']['name'], '" tabindex="1" class="input_text" style="width: 100%;" />
to:
Code: [Select]
<input type="text" name="name" id="bnbox" value="', Util::htmlspecialchars($context['button_data']['name']), '" tabindex="1" class="input_text" style="width: 100%;" />
in ManageUltimateMenu.template.php (default theme directory).
Title: Re: [ADDON] Ultimate Menu
Post by: emanuele on July 25, 2016, 07:55:17 am
Quote from: Jorin – 2. The button clicked is not shown active too.
Make it active is not really a trivial thing.
The status is defined by the "action", without a new action it's basically very difficult to make a button active.
The only way that comes to my mind, is to let specify an action and a subaction on which it will be selected as active, though, even that is an incomplete solution because there may be situations it won't work.
No good answer here, sorry.
And this is more a problem with the way Elk highlights the button than the menu editor.

Quote from: Jorin – 3. Icons made with addon are not shown in mobile view. There is only a white pixel shown.
Something specific for that may be implemented in the menu editor, but at the moment, due to the way Elk handles icons in mobile view, you'd have to:
1) find the id of the button,
2) add a bit of css along the lines of:
Code: [Select]
#id_of_the_button .linklevel1:before {
font-family: 'FontAwesome';
    border: 3px solid #666;
    padding: 1px;
    margin: 2px;
    height: 1.15em;
    width: 1.15em;
    text-align: center;
    display: inline-block;
    border-radius: 4px;
    line-height: 1.2em;
    font-size: 2em;
    color: #666;
    content: 'the-code-of-the-fontawesome-icon-you-want';
}
For example, for your home page, it could be:
Code: [Select]
#button_f6f31cebde020d86add72bea0e662341-1468822676 .linklevel1:before {
font-family: 'FontAwesome';
    border: 3px solid #666;
    padding: 1px;
    margin: 2px;
    height: 1.15em;
    width: 1.15em;
    text-align: center;
    display: inline-block;
    border-radius: 4px;
    line-height: 1.2em;
    font-size: 2em;
    color: #666;
    content: '\f015';
}
while, for the Entwurfe button:
Code: [Select]
#button_6935862f74f620598b6b2549c202aafa-1468821375 .linklevel1:before {
font-family: 'FontAwesome';
    border: 3px solid #666;
    padding: 1px;
    margin: 2px;
    height: 1.15em;
    width: 1.15em;
    text-align: center;
    display: inline-block;
    border-radius: 4px;
    line-height: 1.2em;
    font-size: 2em;
    color: #666;
    content: '\f040';
}
Title: Re: [ADDON] Ultimate Menu
Post by: kode54 on July 25, 2016, 04:39:52 pm
Or suppose I wanted to use an .SVG as a button, I could reference it using some slightly different code for the CSS block. (For example, referring to the foobar2000 subforum with the foobar2000 icon.)
Title: Re: [ADDON] Ultimate Menu
Post by: kode54 on August 01, 2016, 07:54:49 pm
I'm trying (unsuccessfully) to set a button with a .png or an .svg icon instead of a FontAwesome glyph. It's not even rendering the button if I set it as the background, and I can't seem to set content property to anything but raw text.
Title: Re: [ADDON] Ultimate Menu
Post by: live627 on August 01, 2016, 08:49:36 pm
Can I see the code you added (I'm assuming CSS)?
Title: Re: [ADDON] Ultimate Menu
Post by: kode54 on August 02, 2016, 02:03:42 am
I attempted to add:
Code: [Select]
    #button_2cad931b9566e54811554d5f7fdc1e84-1451402398 .linklevel1:before {
        padding: 1px;
        margin: 2px;
        height: 1.15em;
        width: 1.15em;
        display: inline-block;
        background: url(//fb2k_icon.png) no-repeat;
        background-size: 100%;
    }

It doesn't render the button at all unless I add a content: ' ', and in that case, it lacks the background image.

Attempting to use content: url(//fb2k_icon.png) results in a lovely question mark image appearing in Safari.
Title: Re: [ADDON] Ultimate Menu
Post by: live627 on August 02, 2016, 06:58:19 pm
try
Code: [Select]
content: url(../../fb2k_icon.png)
Title: Re: [ADDON] Ultimate Menu
Post by: kode54 on August 03, 2016, 12:47:24 am
I ended up settling on:

Code: [Select]
    #button_2cad931b9566e54811554d5f7fdc1e84-1451402398 .linklevel1:before {
        min-height: 40px;
        padding: 1px;
        padding-right: 41px;
        display: block;
        background-position: center;
        background-size: 40px 40px;
        background-repeat: no-repeat;
        background-image: url(../../fb2k_icon.png);
        content: "";
    }
Title: Re: [ADDON] Ultimate Menu
Post by: live627 on August 03, 2016, 12:54:28 am
rock on! ;D
Title: Re: [ADDON] Ultimate Menu
Post by: Jorin on August 03, 2016, 01:56:21 am
Quote from: emanuele – Make it active is not really a trivial thing.
The status is defined by the "action", without a new action it's basically very difficult to make a button active.
The only way that comes to my mind, is to let specify an action and a subaction on which it will be selected as active, though, even that is an incomplete solution because there may be situations it won't work.
No good answer here, sorry.
And this is more a problem with the way Elk highlights the button than the menu editor.

Okay, maybe with future versions of ElkArte there is a way?

As for the rest, thank you very much. I uninstalled the addon and made the menu in Subs.php on my own so it has icons in mobile view.  ;)
Title: Re: [ADDON] Ultimate Menu
Post by: live627 on August 08, 2016, 12:44:25 am
v1.1.1 has been released; changelog is at https://github.com/live627/elk-um/releases
Title: Re: [ADDON] Ultimate Menu
Post by: shaitan on February 06, 2017, 02:41:28 pm
Nice Addon, thank you.

French translation in attachment.
Title: Re: [ADDON] Ultimate Menu
Post by: live627 on February 09, 2017, 06:44:43 pm
Thanks for the donation! Very much appreciated :)
Title: Re: [ADDON] Ultimate Menu
Post by: WittyUsernameSA on February 16, 2017, 04:54:11 pm
Got a question.

Using Ultimate Menu and Simple Portal pages,  I want to put some pages up in the menu. And that works great and all. But there's a visual issue that I have a problem with. Due to the way Simpleportal is set up, everything is driven by the homepage portal and every page acts like a child of the homepage. So, when I click the newly added simple portal page in the menu, it registers it as the homepage being active, which I find incredibly distracting:



It's probably something that only bothers me, but I would like, when that particular link, is clicked, it'd show the test button as active. Otherwise, I really don't want to use Ultimate Menu.

I am using Mostly Blue:

http://www.elkarte.net/community/index.php?topic=3682.0

I'm wanting to ask for one of two possible solutions:

1. Editing a file in the theme to force in the menu rather than using ultimate menu (I don't think that's possible with UM, as it stands) so that when index.php?page=test (or whatever comes after =) appears, it shows that menu item as active.

2. If that's not doable due to the way Simpleportal handles items, I would like to remove the "active" graphic so that there's ONLY hover and inactive graphics. It'd suck to lose that, but it's merely a cosmetic and no one would miss it since they'd never know it existed.

If the author is still around, and knows of a way to fix this, I'd love to see it. Simpleportal is widely used, especially for its pages. This would be helpful for many.
Title: Re: [ADDON] Ultimate Menu
Post by: txcas on April 10, 2017, 09:02:56 am
I would like to request mobile view support on this add-on.
Title: Re: [ADDON] Ultimate Menu
Post by: Frenzie on April 10, 2017, 09:12:05 am
@txcas Could you clarify that a bit? What's the problem exactly? I use it and I don't see any trouble.
Title: Re: [ADDON] Ultimate Menu
Post by: live627 on April 10, 2017, 09:30:41 pm
icons?
Title: Re: [ADDON] Ultimate Menu
Post by: txcas on April 12, 2017, 03:03:30 pm
Quote from: Frenzie – @txcas Could you clarify that a bit? What's the problem exactly? I use it and I don't see any trouble.
I added a new menu for my site.  It shows on desktops, but no icon for the new menu on mobile devices.
Title: Re: [ADDON] Ultimate Menu
Post by: Frenzie on April 12, 2017, 03:16:30 pm
Ah, I've only worked with submenus. I'm not sure if the add-on should be expected to provide CSS styling, unless the problem is something more severe.
Title: Re: [ADDON] Ultimate Menu
Post by: russena on March 10, 2018, 09:35:21 am
it's work with Elkarte 1.1.2?
Title: Re: [ADDON] Ultimate Menu
Post by: Mrs. Chaos on May 25, 2018, 12:21:01 pm
Hello!
Last night my hoster changed the php version of my account from PHP 5.5.38  to 7.2.1.
Now I found more than 90 pages with the same error in the error protocol. :o
Here' an example. The lines written in red are the same everywhere, the others are mostly different:

W4FfEyTf6lpT7fBqxHFmilZrES6gH10w
Type of error: General
Unknown Error: The each() function is deprecated. This message will be suppressed on further calls

https://forum.xxx.de/index.php?action=mentions;sa=fetch;api=json;lastsent=0

File: /www/htdocs/w00f7xxx/forum/sources/subs/UltimateMenu.subs.php
Line: 41


Line 41 in the UltimateMenu.subs.php is the 3rd here -> while (list(, $row) = each($db_buttons)) {

Code: [Select]
    // Insert the items in to the site menu as defined in the um ACP
    reset($db_buttons);
    while (list(, $row) = each($db_buttons)) {
        // UM menu button basics
        $temp_menu = array(
            'title' => $row['name'],
            'href' => ($row['type'] === 'forum' ? $scripturl . '?' : '') . $row['link'],
            'target' => $row['target'],
            'show' => (allowedTo('admin_forum') || count(array_intersect($user_info['groups'], explode(',', $row['permissions']))) >= 1) && $row['status'] === 'active',
        );

What's wrong there?
.
Title: Re: [ADDON] Ultimate Menu
Post by: tino on May 25, 2018, 01:24:15 pm
I think changing it from

Code: [Select]
 while (list(, $row) = each($db_buttons)) { 

to

Code: [Select]
 foreach ( $db_buttons as $id => $row) { 

should be the same...
Title: Re: [ADDON] Ultimate Menu
Post by: Mrs. Chaos on May 25, 2018, 02:26:31 pm
Yes, that helps.
The errors stay away now.
Thanks a lot!
Title: Re: [ADDON] Ultimate Menu
Post by: bea on May 25, 2018, 03:18:01 pm
Quote from: tino – I think changing it from

Code: [Select]
 while (list(, $row) = each($db_buttons)) { 

to

Code: [Select]
 foreach ( $db_buttons as $id => $row) { 

should be the same...

AFAIK, older versions of PHP were lacking the foreach construct, and the each() functions was a workaround to it. Now that there is a foreach loop, the workaround is not necessary anymore and becomes deprecated. Which might cause some trouble for users of older machines.
Title: Re: [ADDON] Ultimate Menu
Post by: Mrs. Chaos on May 25, 2018, 03:47:11 pm
Thanks for the explanation!
Title: Re: [ADDON] Ultimate Menu
Post by: Mrs. Chaos on June 26, 2018, 11:35:26 am
After the update to ElkArte 1.1.4  I get this error message for three lines (167, 183 and 216), if I go to the Ultimate Menu in the ACP:

Unknown Error: Function create_function() is deprecated
https://forum.website.de/index.php?action=admin;area=umen;sa=manmenu;lC6YqBG=ug0ThYsUqmmXa9Afj6CjjDCu77ZB9HWn
-> ManageUltimateMenu.controller.php

Can someone help, please?
Title: Re: [ADDON] Ultimate Menu
Post by: tino on June 26, 2018, 02:18:29 pm
That’s due to your version of php you’re running, not the Elkarte update.

They need to be changed to anonymous functions. http://php.net/manual/en/functions.anonymous.php

I can’t look at it now but should be able to tomorrow if you can’t work out the changes.
Title: Re: [ADDON] Ultimate Menu
Post by: Mrs. Chaos on June 26, 2018, 03:12:15 pm
Aha, the PHP version is to blame . It's now PHP 7.2.1.

It would be nice if you did that for me. I've looked at it and understood only a little... O:-)
Title: Re: [ADDON] Ultimate Menu
Post by: ahrasis on June 26, 2018, 07:34:11 pm
It simply means to convert all create_function to function. It shouldn't be that hard. Find and list them here if you are not sure.
Title: Re: [ADDON] Ultimate Menu
Post by: Mrs. Chaos on June 27, 2018, 10:55:52 am
To do it by myself unfortunately exceeds my knowledge.
Here are the parts with create_function in it. It's always in the second line.
The complete page is attached below.

Code: [Select]
                    'data' => array(
                        'function' => create_function('$rowData', '
                            global $txt;

                            return $txt[$rowData[\'type\'] . \'_link\'];
                        '),
                    ),

Code: [Select]
                    'data' => array(
                        'function' => create_function('$rowData', '
                            global $txt;

                            // Don\'t show the stub name if we can find the parent name
                            $check = common_um_name($rowData[\'parent\']);
                            $name = !empty($check) ? $check : $rowData[\'parent\'];

                            return $txt[\'mboards_order_\' . $rowData[\'position\']] . \' \' . ucwords($name);
                        '),
                    ),

Code: [Select]
                    'data' => array(
                        'function' => create_function('$rowData', '
                            global $txt;

                            $isChecked = $rowData[\'status\'] === \'inactive\' ? \'\' : \' checked="checked"\';
                            return sprintf(\'<span>%3$s</span>&nbsp;<input type="checkbox" name="status[%1$s]" id="status_%1$s" value="%1$s"%2$s />\', $rowData[\'id_button\'], $isChecked, $txt[$rowData[\'status\']], $rowData[\'status\']);
                        '),
                        'class' => 'centertext',
                    ),
Title: Re: [ADDON] Ultimate Menu
Post by: tino on June 27, 2018, 01:58:15 pm
Here is an example of the first one, I think it should work...

Code: [Select]
'data' => array (
    function ($rowData ) use ( $txt ) {
        return $txt[$rowData['type'] . '_link'];
    }
),
Title: Re: [ADDON] Ultimate Menu
Post by: Mrs. Chaos on June 27, 2018, 03:43:40 pm
My second:

Code: [Select]
'data' => array (
    function ($rowData ) use ( $txt ) {

    // Don\'t show the stub name if we can find the parent name
    $check = common_um_name($rowData['parent']);
    $name = !empty($check) ? $check : $rowData['parent'];

    return $txt['mboards_order_' . $rowData['position']] . ' ' . ucwords($name);
    }
),


and my third:

Code: [Select]
'data' => array (
     function ($rowData ) use ( $txt ) {

    $isChecked = $rowData['status'] === 'inactive' ? '' : ' checked="checked"';
     return sprintf(\'<span>%3$s</span>&nbsp;<input type="checkbox" name="status[%1$s]" id="status_%1$s" value="%1$s"%2$s />', $rowData['id_button'], $isChecked, $txt[$rowData['status']], $rowData['status']);
     }
    'class' => 'centertext',
),

Are they correct?

After the upload the Ultimate Menu pages are not shown, but this new error message:
syntax error, unexpected 'if' (T_IF)

The error protocol says this:
Exception: syntax error, unexpected 'if' (T_IF)
line 11

Line 11 is the second here:
Code: [Select]
create_function
    if (!defined('ELK'))
die('No access...');
Title: Re: [ADDON] Ultimate Menu
Post by: tino on June 27, 2018, 05:05:41 pm
They look correct, not sure how that create_function got in the top of your file? That’s causing the error.

The \ on the third one just after the sprintf also shouldn’t be there.
Title: Re: [ADDON] Ultimate Menu
Post by: ahrasis on June 28, 2018, 12:52:06 am
I hope I remember to look into this when I am home. Now I need to do some shopping.
Title: Re: [ADDON] Ultimate Menu
Post by: Mrs. Chaos on June 28, 2018, 06:01:21 am
I removed the slash and also the "create_function".
Now there's an error message for line 218:
syntax error, unexpected ''class'' (T_CONSTANT_ENCAPSED_STRING), expecting ')'

Line 218 is the penultimate:  'class' => 'centertext',

Code: [Select]
'data' => array (
    function ($rowData ) use ( $txt ) {

    $isChecked = $rowData['status'] === 'inactive' ? '' : ' checked="checked"';
    return sprintf('<span>%3$s</span>&nbsp;<input type="checkbox" name="status[%1$s]" id="status_%1$s" value="%1$s"%2$s />', $rowData['id_button'], $isChecked, $txt[$rowData['status']], $rowData['status']);
    }
    'class' => 'centertext',
),
Title: Re: [ADDON] Ultimate Menu
Post by: tino on June 28, 2018, 01:35:05 pm
Think you need a , after the closing }

Sorry I can’t test atm only on my phone until the weekend now.
Title: Re: [ADDON] Ultimate Menu
Post by: Mrs. Chaos on June 28, 2018, 03:04:28 pm
Yes, it was the missing  ,  .
The error messages are now gone. Thank you!  :)

However, as I have seen, in the ACP in the list of the menu buttons, the entries under "Button Type" and "Button Position" are gone, too. Something like "external link" and "after Forum". That's also now when I create a new link/button.
But the links in the forum menu are working and so that's not bad.
Title: Re: [ADDON] Ultimate Menu
Post by: tino on June 28, 2018, 03:12:52 pm
It might be that the $txt isn’t defined as a global until it was called.

Try putting global $txt; at the start of each function ( not the ones you just created , but the existing ones )

It might be showing something in the error log on Elkarte about $txt being undefined if this is the issue.
Title: Re: [ADDON] Ultimate Menu
Post by: Mrs. Chaos on June 28, 2018, 03:40:31 pm
The error log is empty...
Title: Re: [ADDON] Ultimate Menu
Post by: Mrs. Chaos on June 29, 2018, 05:52:45 am
I didn't manage that with the global $txt; . Either I did something wrong while writing or I inserted it in the wrong places. Or both together...
Would you please take another look at it and tell me what exactly I need to insert where or what I have to change?
You can take your time, it's not hurry!

Attached is the current page.
Title: Re: [ADDON] Ultimate Menu
Post by: tino on June 29, 2018, 01:00:13 pm
Try the attached, I've not tested it but I think that was the mistake... I removed the first 'function' => when I shouldn't off.
Title: Re: [ADDON] Ultimate Menu
Post by: Mrs. Chaos on June 29, 2018, 01:52:24 pm
Yes, that was the mistake. All errors are corrected now and the missing information is displayed again!
Thank you for your great help!!!  :)
Title: Re: [ADDON] Ultimate Menu
Post by: augras on February 18, 2021, 05:12:30 am
Quote from: tino – Try the attached, I've not tested it but I think that was the mistake... I removed the first 'function' => when I shouldn't off.
Hi,
i use your file and it works fine : thank you.
But there is an error in UtimateMenu.subs.php :
   admin
1y2VogPBXfacpMjvbM8derLuakQzjNkn
Type d'erreur: Générale
Unknown Error: The each() function is deprecated. This message will be suppressed on further calls
https://augras.eu/forum_zwii/index.php?action=admin;area=umen
Fichier: /home/augras/public_html/augras.eu/forum_zwii/sources/subs/UltimateMenu.subs.php
Ligne: 41
It seems everything works but there is this error.
I'm with php 7.4.
Philippe
Title: Re: [ADDON] Ultimate Menu
Post by: augras on February 18, 2021, 06:23:21 am
The file for the french language !
Title: Re: [ADDON] Ultimate Menu
Post by: tino on February 18, 2021, 10:38:15 am
Code: [Select]
     foreach ( $db_buttons as $id => $row) { 

Should fix it
Title: Re: [ADDON] Ultimate Menu
Post by: augras on February 18, 2021, 10:47:29 am
You are right : it works fine.
Thank you tino.
Title: Re: [ADDON] Ultimate Menu
Post by: augras on February 28, 2021, 05:07:38 am
Hi,
is it possible to update the package dowloaded with the packages Manager ?
Thank you,
Philippe
Title: Re: [ADDON] Ultimate Menu
Post by: Spuds on March 04, 2021, 03:42:39 pm
The package author would have to update their release package, the addon site/packager only reflects what the addon site has.
Title: Re: [ADDON] Ultimate Menu
Post by: ahrasis on March 04, 2021, 07:34:54 pm
Git clone and update it at your own git?
Title: Re: [ADDON] Ultimate Menu
Post by: augras on March 05, 2021, 02:31:38 am
Quote from: ahrasis – Git clone and update it at your own git?
It seems to be the better way.
But i'm not the better person to do that, don't know at all how git works and not a developper to update the code each time it needs.
Title: Re: [ADDON] Ultimate Menu
Post by: Spuds on December 10, 2021, 08:22:25 pm
Quick package of the all the previous changes and a couple of other minor tweaks for 1.1 and 7.x for anyone that needs it.

Title: Re: [ADDON] Ultimate Menu
Post by: augras on December 11, 2021, 06:23:43 am
Hi,
Thank you @Spuds.
I installed the zip but something is wrong with the french language : the file ManageUltimateMenu.french.php is in the .zip but is not installed.
It must be in /themes/default/languages/french, but not. And anywhere : i can't find the file.
Philippe
Title: Re: [ADDON] Ultimate Menu
Post by: Spuds on December 11, 2021, 08:35:39 am
I had not added the French language to the installer, should be fixed in the above package now.  Uninstall and then install with the new package above.
Title: Re: [ADDON] Ultimate Menu
Post by: augras on December 11, 2021, 09:02:18 am
I didn't understand because the file was in the zip but not on the server : it's ok now, and it's automatic.
Thank you @Spuds.
Title: Re: [ADDON] Ultimate Menu
Post by: live627 on December 17, 2021, 12:01:18 am
Quote from: Spuds – Quick package of the all the previous changes and a couple of other minor tweaks for 1.1 and 7.x for anyone that needs it.


I made that a new  release https://github.com/live627/elk-um/releases/tag/v1.1.2
Title: Re: [ADDON] Ultimate Menu
Post by: Spuds on December 17, 2021, 09:21:44 am
Cool ... thanks
Title: Re: [ADDON] Ultimate Menu
Post by: augras on December 18, 2021, 08:09:31 am
Thanks a lot !
Title: Re: [ADDON] Ultimate Menu
Post by: augras on December 19, 2021, 05:36:40 am
Hi,
i made a fresh install and in the Packages manager it is still the 1.1.1 and not the 1.1.2.
I made the update by hand and i got an error :

Unknown Error: Function create_function() is deprecated
https://augras.eu/elkatest/index.php?action=admin;area=umen
Fichier: /home/augras/public_html/augras.eu/elkatest/sources/admin/ManageUltimateMenu.controller.php
Ligne: 167

Everything seems to work,

Philippe

Title: Re: [ADDON] Ultimate Menu
Post by: Spuds on December 19, 2021, 09:47:35 am
You should get the package file from the link posted by @live627  

The link in the package manage is 1.1.1 (the addons site was not updated with the new link, so still points at the old old) The old package is not fully PHP 7.x compatible and should not be used.
Title: Re: [ADDON] Ultimate Menu
Post by: augras on December 19, 2021, 10:01:20 am
Thank you @Spuds : it's what i made.
I thought the link could be the new.