Page 1 of 1

login/logout? [Mostly SOLVED]

Posted: Mon Feb 18, 2008 7:17 pm
by JeremyBASS
Hello, so i am using the lastest CMSMS Have the lastest FEU and CustomContent installed and everything is working great but i tried to make a "simple" link and a bar that would show LogIN when not and Logout when logged in, thats the easy part.  The part I'm having trouble with is where the LogIN links to the page that i have the FEU loacted, which works, and the logout that just logs the user off and reloads page.  No luck with that side.  I'll post the code...

Start at the location of link

Code: Select all

<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td>{global_content name='Login_bar'}</td>
    <td>{$startform}{$label}: {$inputbox}<input name="submit" value="{$submittext}" type="submit" onmousedown="javascript:toggleDiv('hideMe3')"/>{if isset($hidden)}{$hidden}{/if}{$endform}</td>
  </tr>
</table>
global_content 'Login_bar'

Code: Select all

<a href="http://sjrmc.org/St_Joe_Core/index.php?page=login" target="_self" onmousedown="javascript:toggleDiv('hideMe3')"><font style="font: bold 14px Georgia, 'Times New Roman', Times, serif; color: #FFFFFF;"><strong>Account/</strong></font></a>
{cms_module module=CustomContent}
{if $ccuser->loggedin()}
{cms_module module=FrontEndUsers form=login}
{else}
<a href="http://sjrmc.org/St_Joe_Core/index.php?page=login" target="_self" onmousedown="javascript:toggleDiv('hideMe3')"><font style="font: bold 14px Georgia, 'Times New Roman', Times, serif; color: #FFFFFF;"><strong>LogIN</strong></font></a><font style="font: bold 14px Georgia, 'Times New Roman', Times, serif; color: #FFFFFF;"><strong> |</strong></font>
{/if}
Login template-----{cms_module module=FrontEndUsers form=login}

Code: Select all

{global_content name='Login_if1'}
global_content 'Login_if1'

Code: Select all

{cms_module module=CustomContent}
{if $ccuser->loggedin()}
  <!-- Logout form template -->
 {$startform}
  {$link_logout}
 {$endform}
<!-- Logout form template -->
{else}
<!-- Logout form template -->
  <a target="_self" href="index.php?page=registration" onmousedown="javascript:toggleDiv('hideMe3')"><font style="color: #006699"><strong>New User Registration</strong></font></a> 
<div class="hr"></div>
 <font size="-2">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="70%">
 {$startform} 
{if $error}
  {$error}<br/>
 {/if}
  <p>{$prompt_username}:{$input_username}<br/>{$prompt_password}: 
  {$input_password}<br/>
 {if isset($captcha)}
  {$captcha_title}: <br/>{$input_captcha}<br/>
  {$captcha}<br/>
<a href="http://sjrmc.org/St_Joe_Core/index.php?page=why-do-you-need-to-enter-in-this-code" target="_self" onmousedown="javascript:toggleDiv('hideMe3')">Why do you need to enter in this code?</a><br/>
 {/if}
  {if isset($input_rememberme)}
    {$input_rememberme} {$prompt_rememberme}<br/>
  {/if}
  {$input_submit}<br/>
{$link_forgot}<br/>{$link_lostun}</p>
 {$endform} 
  </font>
</td>
    <td width="30%">
<img src="../Core_images/Welcome.png" width="144" height="200" alt="Welcome" />
</td>
  </tr>
</table>
<!-- Logout form template -->
{/if} 
I have read the forums backwards and forwards and have not spotted anything like this to work off of, I can't think of an easier way to do this, I'm just stuck at the moment. I think it's mostly working but i just can't get the "LogOut" link that shows up in the page with {cms_module module=FrontEndUsers} when logged in... any help would be great... thanls all and have a great day

Re: login/logout?

Posted: Wed Feb 20, 2008 8:33 pm
by JeremyBASS
Does anyone have any idea?  I woundn't think i was the first to want this or think of this... but i've serached the forum over and over and have not found anything... any ideas would be great...

Re: login/logout?

Posted: Fri Feb 22, 2008 5:51 pm
by JeremyBASS
well update.. Still in the same boat... and it seems i'm nowhere closer... I figured that some one would have already done this or at least would be able to spot the error.  I know it's close as login dose get swiched out, but the best i get is it blank as if the {$link_logout} didn't pass through... Please any ideas would be great and welcomed... :) have a great day.

Re: login/logout?

Posted: Fri Feb 22, 2008 6:01 pm
by calguy1000
I don't really understand what you're trying to achieve... but I'll try to guess.

a) you want a bar in your page that displays a simple 'login' link if not logged in, and 'logout' if you are logged out.
b) the login link should redirect to a page that has the feu form on it so that your user can enter his username
    and password (and captcha) information.
c) if the user clicks the 'logout' link you want it to log the user out and reload the page

Add this code to your template
---

Code: Select all

{if $ccuser->loggedin()}{FrontEndUsers form='silent'}{$link_logout}{else}{cms_selflink page='login-page' text='login'}{/if}
That should do the trick.  of course you'll have to change the page alias in the page='login-page' parameter, but that should be about it.

Re: login/logout?

Posted: Fri Feb 22, 2008 6:24 pm
by JeremyBASS
worked like a charm... worked great.  Thanks that is way cleaner then my idea lol...

Re: login/logout? [Mostly SOLVED]

Posted: Fri Feb 22, 2008 7:24 pm
by JeremyBASS
  :D ok one last thing I have try diffrent ways to change the font styles but i can't get the color to take hold... any ideas on that...

Code: Select all

<font style="font: bold 14px Georgia, 'Times New Roman', Times, serif; color: #FFFFFF;"><strong>{if $ccuser->loggedin()}{FrontEndUsers form='silent'}{$link_logout}{else}{cms_selflink page='login' text='login'}{/if}</strong></font>
it seems that it's just the color that is the issue here not any of the other parts...  ???

Re: login/logout? [Mostly SOLVED]

Posted: Fri Feb 22, 2008 7:28 pm
by calguy1000
links are styled differerntly..... try

{if $ccuser->loggedin()}{FrontEndUsers form='silent'}{$link_logout}{else}{cms_selflink page='login-page' text='login'}{/if}

and then style links inside that div.

Re: login/logout? [Mostly SOLVED]

Posted: Fri Feb 22, 2008 7:33 pm
by JeremyBASS
lol... sorry i just wasted you time there... that was a stupid question... lol  ::) thank you for the help