I would like to make a horizontal user login that when the user is logged in replaces the login with a logout link.

I have tried most the examples but i can't get it to work

I would like to use the proper phptemplate way.

Thanks in advance for any help

Comments

johnalbin’s picture

Add this to your template.php file:

function phptemplate_search_theme_form($form) {
  return _phptemplate_callback('search-theme-form', array('form' => $form));
}

And create a file called "search-theme-form.tpl.php" with the following contents:

<div id="search" class="container-inline">
  <div class="form-item">
    <input type="text" maxlength="128" name="search_theme_form_keys" id="edit-search-theme-form-keys"  size="15" value="" title="<?php print t('Enter the terms you wish to search for.'); ?>" class="form-text" />
  </div>
  <input type="submit" name="op" id="edit-submit" value="<?php print t('Search'); ?>"  class="form-submit" />
  <input type="hidden" name="form_token" id="edit-search-theme-form-form-token" value="<?php print drupal_get_token('search_theme_form'); ?>"  />
  <input type="hidden" name="form_id" id="edit-search-theme-form" value="search_theme_form"  />
</div>

  - John (JohnAlbin)

  - John (JohnAlbin)

SueCarlson’s picture

How would you make this work on the Chameleon/Marvin theme, they don't have a template.php

www.sueswebdesigns.suesman.net

vm’s picture

chamelon and marvin are straight php themes controlled by the .theme file.

That being said, you would have a much easier time and find alot more information on using phptemplate themes as this is what the majority of people use with drupal.

straight php themes are more difficult to work with , especially if you have very little php knowledge.

netentropy’s picture

how will this search theme help with the login ?

http://www.netentropy.com/blog

johnalbin’s picture

The Zen theme is here: http://drupal.org/project/zen

  - John (JohnAlbin)

netentropy’s picture

tell me more about this them it seems cool. does it have a hozizontal login?

http://www.netentropy.com/blog

gpk’s picture

Um ... login = search ?? I think I'm confused ;-)

gpk
----
www.alexoria.co.uk

yelvington’s picture

The user login block is not hardcoded with breaks, etc. The blockish behavior derives from the fact that divs are, by default, defined as block layout elements in HTML. With CSS, you can redefine divs as display:inline. Since the login block has a unique identifier id="block-user-0" you should be able to write a CSS rule that inlines your login/password prompt by overriding the default behavior of div.

To have a block conditionally display for logged in / logged out users, the trick is to examine the value of $user->uid. Visitors are always 0. Users are always a positive integer.

johnalbin’s picture

I had a brain fart. I gave you a search form instead of a login form. :-(

yelvington’s advice is correct.

  - John (JohnAlbin)

  - John (JohnAlbin)

netentropy’s picture

I agree with the CSS but i would still like to rewrite the block to give it my own divisions and classes.

http://www.netentropy.com/blog