Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I am fairly new to Drupal 7 and am working on a new site using Kanji 7.x-1.0. For Anonymous users, I'd like to add a "Log In" link in the upper right above the Search block, the same place where "My account | Log out" are currently displayed for authenticated users. What would I need to do to add this feature? Thanks!
Comments
Comment #1
DonnyCarette CreditAttribution: DonnyCarette commentedYou could add a block with the login link (user page) inside the header region and position it in place with some custom CSS. (Block only visible for anonymous users)
Another way should remove the secondary links from page.tpl.php, and add a new region so you can choose what menu you want to display inside that region, but than you could not longer update the theme when there are new releases, so that's not recommended.
Comment #2
jenge CreditAttribution: jenge commentedThanks for the info! Per your first suggestion, I've added a new block in the header with a simple link to "/user" and will see if I can put it in the desired location with CSS.
Comment #3
jenge CreditAttribution: jenge commentedThanks again, Donny, for the info. I've added a block to the header region, and had some success altering its appearance with the CSS Injector module, but am not able to get the placement above the Search Box.
If I understand what's happening, it appears that the "headerWrapper" area gets filled in the order:
1) searchBox (float: right)
2) siteName (float: left)
3) header-region
Is there a way, without altering page.tpl.php, to change the order in which the divs are applied?
If the header-region were applied first so that it appeared above the siteName and searchBox, I think that would accomplish my goal.
Thanks again for your assistance!
Comment #4
DonnyCarette CreditAttribution: DonnyCarette commentedHi Jenge,
That's indeed the order for the headerWrapper.
There are some solutions like adding a page.tpl.php for each content type on your site (this will overwrite the default) but then you would have to add some script inside template.php
You also could create a sub theme based on Kanji, with only containing your .info and your version of page.tpl.php
But if you want you can change page.tpl.php, if there will be new releases for this theme it probably only will be inside style.css
Comment #5
jenge CreditAttribution: jenge commentedHi Donny,
Thanks for the advice. I got this to work as desired by editing page.tpl.php to add a "topMenu" div within "headerWrapper" with the login link if not logged_in. Then I tweaked css to position and style it to match the secondary-menu.
Depending on future changes, I think it should be fairly easy to paste it in to new versions of page.tpl.php.
Great theme. Thanks!
Comment #6
DonnyCarette CreditAttribution: DonnyCarette commented