Alternative Menu With Top Menu Icon & Button Remover SMF 2.0.x & 1.1.x (Hooks!)

Started by Hj Ahmad Rasyid Hj Ismail, August 03, 2014, 07:48:03 PM

Previous topic - Next topic

Hj Ahmad Rasyid Hj Ismail

Thank you for your feedback Steve and DSystem. And yes, DSystem. That would be the way to replace your custom menu with icon(s).

By the way, since there was a query by the Customization Team about the icon pack that I am using for this mod, kindly be informed that the icons are taken from NIXUS Icon Pack - http://www.tutorial9.net/downloads/nixus-icon-pack-60-beautiful-premium-icons-free.

Since there is no need for attribution for personal use as well as commercial as stated in the site, I don't mention it in the mod page or the mod package.

If there is any additional icons added in the future, that requires attribution, I will attribute them accordingly.

Hj Ahmad Rasyid Hj Ismail

#Updated to version 1.4.1 (hook version)
- Removing old icons and replacing it to a new one since we overlooked that the license did not allow redistribution.
- Fixed css stylings that used jointly with Default Menu On Top mod.
- Added support to Change Profile Text To Avatar mod so that it won't change Avatar to Profile Icon, if enabled for SMF 1.1.x.

We have removed the previous icons completely as the we overlooked that the license did not allow redistribution. We now replaced them with Crystal Clear Icons by Everaldo / Yellowicon http://www.iconarchive.com/show/crystal-clear-icons-by-everaldo.html which the author released under GNU Lesser General Public License.

Unless we otherwise are wrong, we have checked that these new icons does not require attribution or limit their redistribution. We stand corrected and invite everybody to let us know whether there are anything that we may overlook.

With regards to the users who want to use the previous icons, they may downloaded directly to the given site as stated above.

Arantor

As long as the mod's page indicates that you're using the icons under the LGPL, that's fine.

The Crystal Clear icon set is also used in SMF 2.1 for the admin panel, by the way so it's definitely all good.

Hj Ahmad Rasyid Hj Ismail

Thank you for the feedback Arantor. I just have time to play with this mod and will update the mod and the mod page with the said license.

I also found out that sometime the hook for $context['html_headers'] is not working properly. I believe the best solution for the time being is to provide two packages i.e. fully hook and mostly hook version. In the later, $context['html_headers'] via hook will not be used, but manual modification will be applied so that the css file link can properly be inserted and can fully be used by the mod users.

This will apply to my other "hooked" mods as well and hopefully will resolve problem faced by our friend like DSystem in his forum.

Hj Ahmad Rasyid Hj Ismail

#Updated to version 1.4.2 (fully hook version & partially hook version)
- Added icons license and name.
- Fixed support to Change Profile Text To Avatar mod.
- Added more supports for download ['dldir'], multimedia ['multimedia'], teampage ['teampage'] and shop ['shop'].
- Creating two mod packages for this, i.e. fully hook and mostly hook.
- Reason: some sites are experiencing problem with injecting $context['html_headers'] via hook.
- So, that part will be modified manually in mostly hook package.

For SMF 2.0.x users:
- If you faced problems with other mods, or $context['html_headers'] via hook is not working correctly, please install mostly hook (m) version.

DSystem

Like new icons. In addition to not have problems with the permit, are cute and have more options.

Many thanks for the new version of the mod. Now this all working here.

Arantor

QuoteI also found out that sometime the hook for $context['html_headers'] is not working properly

Define 'not working properly'.

Hj Ahmad Rasyid Hj Ismail

Simply, it won't inject the code to the header of the forum. Not all the time but sometimes.

Firstly, the code. For integrating the hooks, I am using mainly this code:
// Define the hooks
$hook_functions = array(
'integrate_pre_include' => '$sourcedir/AlternativeMenu.subs.php',
'integrate_menu_buttons' => 'AlternativeMenu_Buttons',
'integrate_admin_areas' => 'AlternativeMenu_Admin',
'integrate_modify_modifications' => 'AlternativeMenu_Settings',
);


Then in the AlternativeMenu_Buttons function, before menu button areas code, I have this code to inject to $context['html_headers']:
// Add our css
if (!empty($modSettings['alternativemenu']) && !empty($modSettings['altmenu_replace_with_icon'])) {
$context['html_headers'] .= '<link rel="stylesheet" type="text/css" href="' . $settings['default_theme_url']. '/css/AlternativeMenu.styles.css?fin20" />';
}


This mod is tested heavily and working well when install to my test sites but is "not working properly" in DSystem forum. Basically not only this mod, by few other mods that inject codes to $context['html_headers'] via hook.

Sometimes the code is injected and sometimes it isn't. I am not sure how other mods can do this but I find that the safest way to ensure that my mods work, manual modification to index.template.php inserting the code becomes necessary.

In further thought, I haven't found a way to limit the same hook to certain theme as one mod may be needed in one theme but not in the other.

What do you think Arantor? Is there any possibility that the hook was somehow wrong or other mods was manipulating $context['html_headers'] and let no other mods using it?

I think DSystem would allow further inspection on this if necessary. The latest package for both full and partial hook also is available at the mod site.

I am welcoming any thoughts or ideas or suggestions here. Surely need them.

Arantor

Two possibilities occur.

1) you're trying to inject into it after it's already been output to the browser (by which time, any modification is naturally bound to fail because it's already been used)

2) the other mod authors are doing it wrong by trying to inject into $context['html_headers'] by overwriting what's there, without realising it. I know Suki has run into this with trying to support her mods and we'll have to see about that. I would certainly suspect more than one mod isn't doing it properly. But you're doing it right.

Hj Ahmad Rasyid Hj Ismail

I think the second one is the most probable reason though I couldn't be sure in this case. I will have to go through other mods code to check for that but time is not with me for now.

Hj Ahmad Rasyid Hj Ismail

For the time being, the mod only read AlternativeMenu.styles.css file from default css directory. Mod users can modify the mod themselves to enable the mod to read from other theme css directory as follows:

Open AlternativeMenu.subs.php file and find:
<link rel="stylesheet" type="text/css" href="' . $settings['default_theme_url']. '/css/AlternativeMenu.styles.css?fin20" />

Simply change it to:
<link rel="stylesheet" type="text/css" href="' . $settings['theme_url']. '/css/AlternativeMenu.styles.css?fin20" />

This should now enable other custom themes to use their own AlternativeMenu.styles.css file. Then copy AlternativeMenu.styles.css file from default css directory. Modify this css file to suit your custom theme.

I will be supporting DilberMC theme when I upgrade this mod soon. I attached here with the css file that I have recently modified that can be used with DilberMC theme. I hope those who is using DilberMC theme will like it.

shadav

thank you for this :) works perfectly on 2.0.15
I used the mostly with hooks download since you mentioned there's sometimes an issue, figured better safe than sorry...

now to add the rest of my menu to the code so they can all be nice and cute icons ;)

shadav

could you possibly help me :D

so I got all but 2 to display correctly and I can't figure it out...

so one is this mod: Like Posts
Like Stats (/index.php?action=likepostsstats)

I have tried:
AlternitiveMenu.subs.php
$areas['likepostsstats']['title'] = empty($modSettings['altmenu_replace_with_icon']) ? $txt['likepostsstats'] : $txt['likepostsstats_icon'];
and in AlternitiveMenu.english.php
$txt['likepostsstats'] = 'Like Stats';
$txt['likepostsstats_icon'] = '<img src="'. $settings['images_url']. '/AlternativeMenu.icons/like.png" title="'.$txt['likepostsstats']. '" alt="'.$txt['likepostsstats']. '" class="altmenu_blur" />';


but it doesn't work... I have tried likepostsstats, likestats, like, likes, LikePosts, like_posts, lp_menu, lp, lp_stats.... I can't figure it out....


and the other is the Posts menu (index.php?action=unread)

I have tried:
AlternitiveMenu.subs.php
$areas['unread']['title'] = empty($modSettings['altmenu_replace_with_icon']) ? $txt['unread'] : $txt['unread_icon'];
and in AlternitiveMenu.english.php
$txt['unread'] = 'Posts';
$txt['unread_icon'] = '<img src="'. $settings['images_url']. '/AlternativeMenu.icons/post.png" title="'.$txt['unread']. '" alt="'.$txt['unread']. '" class="altmenu_blur" />';


but it doesn't work either... I have tried unread, post, posts, unreadpost, unreadposts, member_postcount, posts_made... I can't figure it out...

thank you for any help

shadav

here are some that I did get working for others who want to use this mod with other mods

so for:




Buddy Page
in AlternativeMenu.subs.php
find
$areas['multimedia']['title'] = empty($modSettings['altmenu_replace_with_icon']) ? $txt['multimedia'] : $txt['multimedia_icon'];
after add
$areas['buddypage']['title'] = empty($modSettings['altmenu_replace_with_icon']) ? $txt['buddypage'] : $txt['buddypage_icon'];

in AlternativeMenu.english.php
find
$txt['teampage'] = 'Team';
$txt['teampage_icon'] = '<img src="'. $settings['images_url']. '/AlternativeMenu.icons/teampage.png" title="'.$txt['teampage']. '" alt="'.$txt['teampage']. '" class="altmenu_blur" />';

after add
$txt['buddypage'] = 'Buddy Page';
$txt['buddypage_icon'] = '<img src="'. $settings['images_url']. '/AlternativeMenu.icons/buddypage.png" title="'.$txt['buddypage']. '" alt="'.$txt['buddypage']. '" class="altmenu_blur" />';


upload your buddypage.png image to the AlternativeMenu folder (it's recommended to use a 32x32 image, but I think it automatically resizes it, I could be wrong)
Themes/{YOU TEMPLATE IN USE}/images/AlternativeMenu.icons




SA Knowledge Base
in AlternativeMenu.subs.php
find
$areas['multimedia']['title'] = empty($modSettings['altmenu_replace_with_icon']) ? $txt['multimedia'] : $txt['multimedia_icon'];
after add
$areas['kb']['title'] = empty($modSettings['altmenu_replace_with_icon']) ? $txt['kb'] : $txt['kb_icon'];

in AlternativeMenu.english.php
find
$txt['teampage'] = 'Team';
$txt['teampage_icon'] = '<img src="'. $settings['images_url']. '/AlternativeMenu.icons/teampage.png" title="'.$txt['teampage']. '" alt="'.$txt['teampage']. '" class="altmenu_blur" />';

after add
$txt['kb'] = 'Knowledge Base';
$txt['kb_icon'] = '<img src="'. $settings['images_url']. '/AlternativeMenu.icons/kb.png" title="'.$txt['kb']. '" alt="'.$txt['kb']. '" class="altmenu_blur" />';


upload your kb.png image to the AlternativeMenu folder (it's recommended to use a 32x32 image, but I think it automatically resizes it, I could be wrong)
Themes/{YOU TEMPLATE IN USE}/images/AlternativeMenu.icons




SMF Articles
in AlternativeMenu.subs.php
find
$areas['multimedia']['title'] = empty($modSettings['altmenu_replace_with_icon']) ? $txt['multimedia'] : $txt['multimedia_icon'];
after add
$areas['articles']['title'] = empty($modSettings['altmenu_replace_with_icon']) ? $txt['articles'] : $txt['articles_icon'];

in AlternativeMenu.english.php
find
$txt['teampage'] = 'Team';
$txt['teampage_icon'] = '<img src="'. $settings['images_url']. '/AlternativeMenu.icons/teampage.png" title="'.$txt['teampage']. '" alt="'.$txt['teampage']. '" class="altmenu_blur" />';

after add
$txt['articles'] = 'Articles';
$txt['articles_icon'] = '<img src="'. $settings['images_url']. '/AlternativeMenu.icons/article.png" title="'.$txt['articles']. '" alt="'.$txt['articles']. '" class="altmenu_blur" />';


upload your article.png image to the AlternativeMenu folder (it's recommended to use a 32x32 image, but I think it automatically resizes it, I could be wrong)
Themes/{YOU TEMPLATE IN USE}/images/AlternativeMenu.icons




SMF Links
in AlternativeMenu.subs.php
find
$areas['multimedia']['title'] = empty($modSettings['altmenu_replace_with_icon']) ? $txt['multimedia'] : $txt['multimedia_icon'];
after add
$areas['links']['title'] = empty($modSettings['altmenu_replace_with_icon']) ? $txt['links'] : $txt['links_icon'];

in AlternativeMenu.english.php
find
$txt['teampage'] = 'Team';
$txt['teampage_icon'] = '<img src="'. $settings['images_url']. '/AlternativeMenu.icons/teampage.png" title="'.$txt['teampage']. '" alt="'.$txt['teampage']. '" class="altmenu_blur" />';

after add
$txt['links'] = 'Links';
$txt['links_icon'] = '<img src="'. $settings['images_url']. '/AlternativeMenu.icons/links.png" title="'.$txt['links']. '" alt="'.$txt['links']. '" class="altmenu_blur" />';


upload your links.png image to the AlternativeMenu folder (it's recommended to use a 32x32 image, but I think it automatically resizes it, I could be wrong)
Themes/{YOU TEMPLATE IN USE}/images/AlternativeMenu.icons




BanList
in AlternativeMenu.subs.php
find
$areas['multimedia']['title'] = empty($modSettings['altmenu_replace_with_icon']) ? $txt['multimedia'] : $txt['multimedia_icon'];
after add
$areas['banlist']['title'] = empty($modSettings['altmenu_replace_with_icon']) ? $txt['banlist'] : $txt['banlist_icon'];

in AlternativeMenu.english.php
find
$txt['teampage'] = 'Team';
$txt['teampage_icon'] = '<img src="'. $settings['images_url']. '/AlternativeMenu.icons/teampage.png" title="'.$txt['teampage']. '" alt="'.$txt['teampage']. '" class="altmenu_blur" />';

after add
$txt['banlist'] = 'Ban List';
$txt['banlist_icon'] = '<img src="'. $settings['images_url']. '/AlternativeMenu.icons/banlist.png" title="'.$txt['banlist']. '" alt="'.$txt['banlist']. '" class="altmenu_blur" />';


upload your banlist.png image to the AlternativeMenu folder (it's recommended to use a 32x32 image, but I think it automatically resizes it, I could be wrong)
Themes/{YOU TEMPLATE IN USE}/images/AlternativeMenu.icons




I don't think this was a mod, I don't remember, Recent Topics
in AlternativeMenu.subs.php
find
$areas['multimedia']['title'] = empty($modSettings['altmenu_replace_with_icon']) ? $txt['multimedia'] : $txt['multimedia_icon'];
after add
$areas['recenttopics']['title'] = empty($modSettings['altmenu_replace_with_icon']) ? $txt['recenttopics'] : $txt['recenttopics_icon'];

in AlternativeMenu.english.php
find
$txt['teampage'] = 'Team';
$txt['teampage_icon'] = '<img src="'. $settings['images_url']. '/AlternativeMenu.icons/teampage.png" title="'.$txt['teampage']. '" alt="'.$txt['teampage']. '" class="altmenu_blur" />';

after add
$txt['recenttopics'] = 'Recent Topics';
$txt['recenttopics_icon'] = '<img src="'. $settings['images_url']. '/AlternativeMenu.icons/recenttopics.png" title="'.$txt['recenttopics']. '" alt="'.$txt['recenttopics']. '" class="altmenu_blur" />';


upload your recenttopics.png image to the AlternativeMenu folder (it's recommended to use a 32x32 image, but I think it automatically resizes it, I could be wrong)
Themes/{YOU TEMPLATE IN USE}/images/AlternativeMenu.icons




Google Tagged
in AlternativeMenu.subs.php
find
$areas['multimedia']['title'] = empty($modSettings['altmenu_replace_with_icon']) ? $txt['multimedia'] : $txt['multimedia_icon'];
after add
$areas['tagged']['title'] = empty($modSettings['altmenu_replace_with_icon']) ? $txt['tagged'] : $txt['tagged_icon'];

in AlternativeMenu.english.php
find
$txt['teampage'] = 'Team';
$txt['teampage_icon'] = '<img src="'. $settings['images_url']. '/AlternativeMenu.icons/teampage.png" title="'.$txt['teampage']. '" alt="'.$txt['teampage']. '" class="altmenu_blur" />';

after add
$txt['tagged'] = 'googletagged';
$txt['tagged_icon'] = '<img src="'. $settings['images_url']. '/AlternativeMenu.icons/googletagged.png" title="'.$txt['tagged']. '" alt="'.$txt['tagged']. '" class="altmenu_blur" />';


upload your googletagged.png image to the AlternativeMenu folder (it's recommended to use a 32x32 image, but I think it automatically resizes it, I could be wrong)
Themes/{YOU TEMPLATE IN USE}/images/AlternativeMenu.icons




Staff Page Mod
in AlternativeMenu.subs.php
find
$areas['multimedia']['title'] = empty($modSettings['altmenu_replace_with_icon']) ? $txt['multimedia'] : $txt['multimedia_icon'];
after add
$areas['staff']['title'] = empty($modSettings['altmenu_replace_with_icon']) ? $txt['staff'] : $txt['staff_icon'];

in AlternativeMenu.english.php
find
$txt['teampage'] = 'Team';
$txt['teampage_icon'] = '<img src="'. $settings['images_url']. '/AlternativeMenu.icons/teampage.png" title="'.$txt['teampage']. '" alt="'.$txt['teampage']. '" class="altmenu_blur" />';

after add
$txt['staff'] = 'Staff List';
$txt['staff_icon'] = '<img src="'. $settings['images_url']. '/AlternativeMenu.icons/staff.png" title="'.$txt['staff']. '" alt="'.$txt['staff']. '" class="altmenu_blur" />';


upload your staff.png image to the AlternativeMenu folder (it's recommended to use a 32x32 image, but I think it automatically resizes it, I could be wrong)
Themes/{YOU TEMPLATE IN USE}/images/AlternativeMenu.icons

shadav

Quote from: shadav on August 24, 2019, 11:33:08 AM
could you possibly help me :D

so I got all but 2 to display correctly and I can't figure it out...

so one is this mod: Like Posts
Like Stats (/index.php?action=likepostsstats)

I have tried:
AlternitiveMenu.subs.php
$areas['likepostsstats']['title'] = empty($modSettings['altmenu_replace_with_icon']) ? $txt['likepostsstats'] : $txt['likepostsstats_icon'];
and in AlternitiveMenu.english.php
$txt['likepostsstats'] = 'Like Stats';
$txt['likepostsstats_icon'] = '<img src="'. $settings['images_url']. '/AlternativeMenu.icons/like.png" title="'.$txt['likepostsstats']. '" alt="'.$txt['likepostsstats']. '" class="altmenu_blur" />';


but it doesn't work... I have tried likepostsstats, likestats, like, likes, LikePosts, like_posts, lp_menu, lp, lp_stats.... I can't figure it out....


and the other is the Posts menu (index.php?action=unread)

I have tried:
AlternitiveMenu.subs.php
$areas['unread']['title'] = empty($modSettings['altmenu_replace_with_icon']) ? $txt['unread'] : $txt['unread_icon'];
and in AlternitiveMenu.english.php
$txt['unread'] = 'Posts';
$txt['unread_icon'] = '<img src="'. $settings['images_url']. '/AlternativeMenu.icons/post.png" title="'.$txt['unread']. '" alt="'.$txt['unread']. '" class="altmenu_blur" />';


but it doesn't work either... I have tried unread, post, posts, unreadpost, unreadposts, member_postcount, posts_made... I can't figure it out...

thank you for any help

I got the like mod to work now
Like Posts
in AlternativeMenu.subs.php
find
$areas['multimedia']['title'] = empty($modSettings['altmenu_replace_with_icon']) ? $txt['multimedia'] : $txt['multimedia_icon'];
after add
$areas['like_post_stats']['title'] = empty($modSettings['altmenu_replace_with_icon']) ? $txt['like_post_stats'] : $txt['like_post_stats_icon'];

in AlternativeMenu.english.php
find
$txt['teampage'] = 'Team';
$txt['teampage_icon'] = '<img src="'. $settings['images_url']. '/AlternativeMenu.icons/teampage.png" title="'.$txt['teampage']. '" alt="'.$txt['teampage']. '" class="altmenu_blur" />';


after add
$txt['like_post_stats'] = 'Like Stats';
$txt['like_post_stats_icon'] = '<img src="'. $settings['images_url']. '/AlternativeMenu.icons/like.png" title="'.$txt['like_post_stats']. '" alt="'.$txt['like_post_stats']. '" class="altmenu_blur" />';


upload your like.png image to the AlternativeMenu folder (it's recommended to use a 32x32 image, but I think it automatically resizes it, I could be wrong)
Themes/{YOU TEMPLATE IN USE}/images/AlternativeMenu.icons


now still trying to figure out the Post one....

Advertisement: