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:
#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.
Comment | File | Size | Author |
---|---|---|---|
simplemenu_hello.tar_.gz | 1.17 KB | chirale | |
simplemenu_hello.png | 3.17 KB | chirale |
Comments
Comment #1
bryancasler CreditAttribution: bryancasler commentedI placed the simplemenu_hello folder inside my simplemenu folder. I then enabled both modules. Nothing is happening, what did I do wrong?
Comment #2
AlexisWilke CreditAttribution: AlexisWilke commented--- removed
Sorry, actually this is with simplemenu version 2.x, did you download 2.x or 1.x?
Thank you.
Alexis Wilke
Comment #3
bryancasler CreditAttribution: bryancasler commentedThanks for the quick response. I used 1.x, where am I able to get 2.x?
Comment #4
AlexisWilke CreditAttribution: AlexisWilke commentedNote 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
Comment #5
bryancasler CreditAttribution: bryancasler commentedThanks Alexis, I think I'll stick with 1.x if 2.x is not being supported. Appreciate all the hard work.