1
fredski
Adding a login box to your theme, without user block
  • 2004/7/8 11:25

  • fredski

  • Quite a regular

  • Posts: 265

  • Since: 2004/1/26


I want to get rid of my login block as I used tabs for my user functions, at the top of my theme at the moment is:
New Users Register Here & Existing Users Login Here
which changes to Hello 'username' View Account when logged in.
<{if $xoops_isuser}> Hello <{$xoops_uname}>
 your account <{else}> New Users Register Here<{/if}>
 <{if 
$xoops_isuser}> <{else}> Existing Members Login
 
<{/if}>

what I want is the user login boxes there instead, and once logged in it just says Welcome Back 'username'

Anyone know the code that would do that. I need the username box, the password box, the remember me checkbox, and login button, below that should be register now and lost password links.

Something along the lines of this going across the top of my page, I'm not sure I'm on the right track because my coding abilities stink :) and I'm 150% sure that if I put this in my theme I'll get the white page of DEATH
<table width="100%" border="0">
      <
tr>
        <
td width="50%"><{if $xoops_isuser}> Welcome Back <{$xoops_uname}> <{else}> <form style="margin-top: 0px;" action="<{$xoops_url}>/user.php" method="post">
  <{
$block.lang_username}>
<
input type="text" name="uname" size="12" value="<{$block.unamevalue}>" />
  <{
$block.lang_password}> 
  <
input type="password" name="pass" size="12" />
  <
input type="checkbox" name="rememberme" value="On" class ="formButton" />
  <{
$block.lang_rememberme}>
<
input type="hidden" name="xoops_redirect" value="<{$xoops_requesturi}>" /><input type="hidden" name="op" value="login" /><input type="submit" value="<{$block.lang_login}>" />
  <{
$block.sslloginlink}><br />
  <
a href="<{$xoops_url}>/user.php#lost"><{$block.lang_lostpass}></a> <a href="<{$xoops_url}>/register.php"><{$block.lang_registernow}></a
</
form> <{/if}></td>
        <
td width="30%"><form style="margin-top: 1px; margin-bottom: 0px" action="<{$xoops_url}>/search.php" method="post">
                  <
div align="right">&nbsp;Search Site&nbsp
                    <
input class="button" type="text" name="query" size="10" />
                    <
input type="hidden" name="action" value="results" />
                    <
input name="Search" type="submit" class="gumb" value="GO" />
                  </
div>
                </
form></td>
        <
td width="20%" align="right" class="vrijeme"><span id="clock"></span> <script language="JavaScript" type="text/javascript" src="<{$xoops_imageurl}>images/clock.js">

                </
script> </td>
      </
tr>
    </
table>

2
koertzen
Re: Adding a login box to your theme, without user block
  • 2004/7/10 10:59

  • koertzen

  • Just popping in

  • Posts: 79

  • Since: 2003/10/22


If you turn php debuggin on, i'm sure you'll see that the $block... variables are undefined. I'll bet you got them from the user login block :). You can't use these variables in your theme. $block. format is only for use in blocks.

Sorry I can't be more help to you right now. I, too, am interested in doing something like this, so I'll try to take a look at it later today.

Or maybe someone else will reply inthe meantime with some pre-set code! :) (Have you looked at any 7dana themes that might have it already?)

3
Digiegirl
Re: Adding a login box to your theme, without user block
  • 2004/7/10 14:42

  • Digiegirl

  • Just popping in

  • Posts: 44

  • Since: 2002/8/23


Here's the code I use on my site which may be of use. It's pretty simple, but does the trick for what I want. You can see it on my sitehttp://www.girl-gamer.com I also use the auto login hack, but haven't added it to the code below.

-----------------------------------------------------------
<tr> <td id="login"><{if $xoops_isuser}>&nbsp;&nbsp;Welcome&nbsp;<a href="<{$xoops_url}>/user.php"><{$xoops_uname}></a> | &nbsp;&nbsp;<span id="clock"></span> <script language="Javascript" type="text/javascript" src="<{$xoops_url}>/themes/girl-gamer/clock.js">
</script><{else}>
<form action="<{$xoops_url}>/user.php" method="post"><span class="navtext">&nbsp;&nbsp;Username: </span>
<input type="text" name="uname" class="navinput" />
<span class="navtext"> Pass: </span >
<input type="password" name="pass" class="navinput" />
<input type="hidden" name="xoops_redirect" value="/index.php" />
<input type="hidden" name="op" value="login" />
<input type="submit" value="login" class="button" />  |&nbsp;<a href="<{$xoops_url}>/user.php#lost">Lost Password?</a> | <a href="<{$xoops_url}>/register.php">Register!</a> </form><{/if}>
</td></tr>
-----------------------------------------------------------

Cheers,
Dee

4
fredski
Re: Adding a login box to your theme, without user block
  • 2004/7/12 8:44

  • fredski

  • Quite a regular

  • Posts: 265

  • Since: 2004/1/26


Thanks Digiegirl, that gave me something to build on, my table is slightly different with the addition of a search box and my clock is written differently, plus I've given the login boxes a size to keep them from being oversized
<table width="100%" valign="middle" border="0" cellspacing="0" cellpadding="0">

        <
tr>

          <
td width="190" class="headerprvi">

              <
form style="margin-top: 1px; margin-bottom: 0px" action="<{$xoops_url}>/search.php" method="post">
            &
nbsp;Search Site&nbsp
            <
input class="button" type="text" name="query" size="10" />

                <
input type="hidden" name="action" value="results" />

                <
input name="submit" type="submit" class="gumb" value="Go" />

              </
form>

          </
td>

          <
td><table width="100%" border="0" cellspacing="0" cellpadding="0">

              <
tr

                
              <
td> <{if $xoops_isuser}>&nbsp;&nbsp;Welcome Back&nbsp;<a href="<{$xoops_url}>/user.php"><{$xoops_uname}></a
                <{else}>
<
form action="<{$xoops_url}>/user.php" method="post">
                  <
span class="navtext">Name: </span
                  <
input type="text" name="uname" class="navinput" size="12" />
                  <
span class="navtext"Pass: </span 
                  <
input type="password" name="pass" class="navinput" size="12" />
                  <
input type="hidden" name="xoops_redirect" value="<{$xoops_url}>/index.php" />
                  <
input type="hidden" name="op" value="login" />
                  <
input name="submit2" type="submit" class="button" value="Login" />
                  &
nbsp;<a href="<{$xoops_url}>/user.php#lost">Lost Password?</a
                  | <
a href="<{$xoops_url}>/register.php">Register!</a>
</
form>
           <{/if}></
td>

                <
td width="24%" align="right" class="vrijeme"><span id="clock"></span> <script language="JavaScript" type="text/javascript" src="<{$xoops_imageurl}>images/clock.js">

                </
script>
                &
nbsp;</td>

              </
tr>

            </
table></td>

        </
tr>

      </
table>


Not sure now wether to put the tickbox for remember me in there too or it might look cramped.

5
Digiegirl
Re: Adding a login box to your theme, without user block
  • 2004/7/12 9:37

  • Digiegirl

  • Just popping in

  • Posts: 44

  • Since: 2002/8/23


Glad it helped fredski I missed the bit in your first post about the remember me tick box, otherwise would've included it. I use the remember me box due to member request, so I guess it depends if your users want it. Might look a bit cramped, but you can always see what it looks like.

Not sure if you have the code with the remember me checkbox, so I'll post it in case you don't, or anyone else wants the code with the remember me checkbox.

Quote:
<tr> <td id="login"><{if $xoops_isuser}>&nbsp;&nbsp;Welcome&nbsp;<a href="<{$xoops_url}>/user.php"><{$xoops_uname}></a> | &nbsp;&nbsp;<span id="clock"></span> <script language="Javascript" type="text/javascript" src="<{$xoops_url}>/themes/girl-gamer/clock.js">
</script><{else}>
<form action="<{$xoops_url}>/user.php" method="post"><span class="navtext">&nbsp;&nbsp;Username: </span>
<input type="text" name="uname" class="navinput" />
<span class="navtext"> Pass: </span >
<input type="password" name="pass" class="navinput" />
<input type="hidden" name="xoops_redirect" value="/index.php" />
<input type="hidden" name="op" value="login" />
<input type="submit" value="login" class="button" />&nbsp;&nbsp;<input type="checkbox" name="rememberme" value="On" class="formButton" />&nbsp;Remember Me?
&nbsp;&nbsp;<a href="<{$xoops_url}>/user.php#lost">Lost Password?</a> | <a href="<{$xoops_url}>/register.php">Register!</a> </form><{/if}>
</td></tr>


Cheers,
Dee

6
fredski
Re: Adding a login box to your theme, without user block
  • 2004/7/12 10:47

  • fredski

  • Quite a regular

  • Posts: 265

  • Since: 2004/1/26


Hey Dee,

Thanks for that, I'm toying with the idea of putting the remember me code in as I think it's a handy feature, But I'll either have to drop the search box, or move the time/date script to a different part of my theme, or only have it apear if logged in. If viewed in 800 x 600 it can looked very cramped indeed :( and the idea after all is to get rid of clutter and blocks lol

7
Digiegirl
Re: Adding a login box to your theme, without user block
  • 2004/7/12 12:51

  • Digiegirl

  • Just popping in

  • Posts: 44

  • Since: 2002/8/23


Yeah I got lazy with the search box, and only have a text link in one of the menus. I'm thinking of reorganizing my menus and theme to get rid of some of the clutter on my site as well! Good Luck!

Cheers,
Dee

8
fredski
Re: Adding a login box to your theme, without user block
  • 2004/7/12 13:20

  • fredski

  • Quite a regular

  • Posts: 265

  • Since: 2004/1/26


Hey Dee, I ended up moving the time and date script, and putting in the remember me check box, only problem is my search box and login boxes don't line up correctly, not sure why. Im sure someone nice on here will tell me :)
Take a look see what you think HERE

Heres the site search box if you need it.

<form style="margin-top: 1px; margin-bottom: 0px" action="<{$xoops_url}>/search.php" method="post">
            &
nbsp;Search Site&nbsp
            <
input class="button" type="text" name="query" size="10" />

                <
input type="hidden" name="action" value="results" />
            <
input name="submit" type="submit" class="gumb" value="Go" />

              </
form>

9
Speed
Re: Adding a login box to your theme, without user block
  • 2004/7/12 18:15

  • Speed

  • Quite a regular

  • Posts: 310

  • Since: 2004/5/18


Thanks for the exchange of info! It's super helpful to see the code changes people are using.

10
Digiegirl
Re: Adding a login box to your theme, without user block
  • 2004/7/13 12:37

  • Digiegirl

  • Just popping in

  • Posts: 44

  • Since: 2002/8/23


Thanks for the code fredski. Might play around with the theme this weekend if I get a chance and try to organise it

Login

Who's Online

202 user(s) are online (124 user(s) are browsing Support Forums)


Members: 0


Guests: 202


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Mar 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits