Jump to:
| Project: | SimpleMenu |
| Version: | 6.x-2.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs work |
Issue Summary
Using the brand new hook_simplemenu_tree_alter(), I've written this simple module. Place it into your Simplemenu 2.x directory and enable it.
I like Admin hello message for logged in users, and I like avatar on bar like Wordpress, so I try to combine the two (Screenshot attached).
Added items are:
- avatar + username
-
- View
- Go to user profile
- Edit
-
- Account settings
- Category 1
- ...
- Category N
- Logout
- A logout link
Any element has yours css classes, so I place it on right, leaving left side of the bar for Content creation.
Here some additional CSS I've added on my theme:
<?php
#simplemenu,
#simplemenu li,
#simplemenu li a {
padding-top: 0;
padding-bottom: 0;
line-height: 30px !important;
height: 30px !important;
}
/** IE6 compatibility **/
#simplemenu li,
#simplemenu li a {
float: left;
}
#simplemenu li li a {
float: none !important;
}
#simplemenu .simplemenu-hello-username,
#simplemenu .simplemenu-hello-logout {
float: right;
}
/** Leave some space for block-search **/
#simplemenu .simplemenu-hello-logout {
margin-right: 200px;
}
/** Block search on top **/
#block-search-0 {
position: absolute;
top: -33px;
right: 0;
z-index: 100000;
}
#block-search-0 label {
display: none;
}
?>Ideally, avatar + username children should be populated with user local task the current user has access to (tabs on user profile), but I don't know how to do this, so I've copied some code from user_menu() to get user categories.
Suggestion to complete this module are welcomed, it's almost independent from core module thanks to hook_simplemenu_tree_alter().
P.S. To complete this account bar for anonymous, a login form (maybe using compact_forms) should be provided. A similar issue is active on #397246: Built-in login form?. I try to inject form items into simplemenu, but results are disappointing.
| Attachment | Size |
|---|---|
| simplemenu_hello.png | 3.17 KB |
| simplemenu_hello.tar_.gz | 1.17 KB |
Comments
#1
I placed the simplemenu_hello folder inside my simplemenu folder. I then enabled both modules. Nothing is happening, what did I do wrong?
#2
--- removed
Sorry, actually this is with simplemenu version 2.x, did you download 2.x or 1.x?
Thank you.
Alexis Wilke
#3
Thanks for the quick response. I used 1.x, where am I able to get 2.x?
#4
Note that 2.x is not being supported. 1.x has the same callback now (which is why I did not first notice this was a 2.x issue) but it is somewhat different.
All the available versions are under "View all releases"
http://drupal.org/node/346111
Thank you.
Alexis
#5
Thanks Alexis, I think I'll stick with 1.x if 2.x is not being supported. Appreciate all the hard work.