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.
Found a bug
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?
Nice stuff here too! :D
Excellent
@live627 . Love it :)
Great! This comes in handy atm! :)
Tried to install it and get these error message:
Line 87 is this:
foreach ($tables as $table)
$dbtbl->db_create_table('{db_prefix}' . $table['name'], $table['columns'], $table['indexes'], [], 'update');
Thats php 5.4 shorthand syntax, change the
, [],
to
, array(),
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.
Ah good to know, had not looked at the code ... if thats the only 5.4 stuff easy to change though.
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?
Another Bug. I created a child entry. It looks like this.
Urgs! An internal link leads to this:
http://forum-alternative-antriebe.de/index.php?/topic,467.0.html
when entering only:
/topic,467.0.html
I need it without the
? :o
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.
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. :(
I don't think without ? is possible or is it possible
@emanuele /
@Spuds ?
Oh, you're right. Why are my topic links look like that:
And yours look like that:
:o
Honestly I never used that version of the links, so I have no idea at the moment.
Those are what you get if you enable "Search engine friendly URLs" in the ACP ... (configuration->general)
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.
I guess you can try
topic=467 (assuming the buffer fixes it, I haven't checked) or try the full external link option.
me neither
Thanks! Added to the repo.
So the experts don't use search enginge friendly URLs? Why not? :o
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.
Elk bug. Problem areas highlighted.
input, .input_text, button,
select {
height: 2em;
max-height: 2em;
min-height: 2em; padding: 0 6px;
vertical-align: middle;
}
The only advantage is human readability. Spiders are not affected at all.
I cannot uninstall this despite
<uninstall for="1.0 - 1.0.99">
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!
"Search engine friendly" is a misnomer. They are really just more friendly for humans but have no bearing for the major search engines.
Do you prefer to change back to "normal" URLs? Is this possible for me?
Can someone split out the off-topic SEF URL posts?
How about FontAwesone icons for mobile users?
Does Ellk's main menu support icons? I haven't checked...
Issue/feature request: Allow defining a FontAwesome icon for the small screen view for top level menus.
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?
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.
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.
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.
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... :(
v1.0 is now officially released!
http://addons.elkarte.net/enhancement/Ultimate-Menu.html
Please do donate if you feel so inclined.
Great! I will give it another try! :)
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:
<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:
// 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.
The errors can be fixed by changing:
if (end(explode(',', $modSettings['integrate_menu_buttons'])) != 'um_load_menu')
to:
$hooks = explode(',', $modSettings['integrate_menu_buttons']);
if (end($hooks) != 'um_load_menu')
The error is gone, thank you, but the three problems stay.
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.
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:
<input type="text" name="name" id="bnbox" value="', $context['button_data']['name'], '" tabindex="1" class="input_text" style="width: 100%;" />
to:
<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).
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.
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:
#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:
#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:
#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';
}
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.)
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.
Can I see the code you added (I'm assuming CSS)?
I attempted to add:
#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.
try
content: url(../../fb2k_icon.png)
I ended up settling on:
#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: "";
}
rock on! ;D
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. ;)
v1.1.1 has been released; changelog is at https://github.com/live627/elk-um/releases
Nice Addon, thank you.
French translation in attachment.
Thanks for the donation! Very much appreciated :)
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.
I would like to request mobile view support on this add-on.
@txcas Could you clarify that a bit? What's the problem exactly? I use it and I don't see any trouble.
icons?
I added a new menu for my site. It shows on desktops, but no icon for the new menu on mobile devices.
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.
it's work with Elkarte 1.1.2?
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)) {
// 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?
.
I think changing it from
while (list(, $row) = each($db_buttons)) {
to
foreach ( $db_buttons as $id => $row) {
should be the same...
Yes, that helps.
The errors stay away now.
Thanks a lot!
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.
Thanks for the explanation!
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?
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.
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:-)
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.
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.
'data' => array(
'function' => create_function('$rowData', '
global $txt;
return $txt[$rowData[\'type\'] . \'_link\'];
'),
),
'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);
'),
),
'data' => array(
'function' => create_function('$rowData', '
global $txt;
$isChecked = $rowData[\'status\'] === \'inactive\' ? \'\' : \' checked="checked"\';
return sprintf(\'<span>%3$s</span> <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',
),
Here is an example of the first one, I think it should work...
'data' => array (
function ($rowData ) use ( $txt ) {
return $txt[$rowData['type'] . '_link'];
}
),
My second:'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:'data' => array (
function ($rowData ) use ( $txt ) {
$isChecked = $rowData['status'] === 'inactive' ? '' : ' checked="checked"';
return sprintf(\'<span>%3$s</span> <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:
create_function
if (!defined('ELK'))
die('No access...');
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.
I hope I remember to look into this when I am home. Now I need to do some shopping.
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',
'data' => array (
function ($rowData ) use ( $txt ) {
$isChecked = $rowData['status'] === 'inactive' ? '' : ' checked="checked"';
return sprintf('<span>%3$s</span> <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',
),
Think you need a , after the closing }
Sorry I can’t test atm only on my phone until the weekend now.
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.
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.
The error log is empty...
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.
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.
Yes, that was the mistake. All errors are corrected now and the missing information is displayed again!
Thank you for your great help!!! :)
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
The file for the french language !
foreach ( $db_buttons as $id => $row) {
Should fix it
You are right : it works fine.
Thank you tino.
Hi,
is it possible to update the package dowloaded with the packages Manager ?
Thank you,
Philippe
The package author would have to update their release package, the addon site/packager only reflects what the addon site has.
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.
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.
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
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.
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.
I made that a new release https://github.com/live627/elk-um/releases/tag/v1.1.2
Cool ... thanks
Thanks a lot !
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
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.
Thank you
@Spuds : it's what i made.
I thought the link could be the new.