Add user information items (avatar and edit profile information)
| Project: | SimpleMenu |
| Version: | 6.x-2.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs work |
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: Inbuilt 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 |
