Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Themes
Author Message
jane65
Regular
Regular



Joined: Feb 24, 2009
Posts: 81
Location: UK

PostPosted: Thu Jan 23, 2014 1:57 pm Reply with quote

Hi,

I am using RickTido Theme, on RN 2.51 and would like to add text links at the top of the page for both Login and Register, that switch after login to showing something like 'Logout username'.

I've been trying to work it out by using the code that I've used before for this when using the Fisubice theme, but I can't work out how to add the code to the RickTido theme so that it works properly. I got it to display on site but it didn't do the switch. I'd appreciate if someone could tell me how to add it to the RickTido theme.

Here's the code that I had in fisubice theme and I had the $theuser in the header.php too there.

Code:
if ($username == 'Anonymous') {

          $theuser = '<a href="modules.php?name=Your_Account">'._LOGIN.'</a>&nbsp;<bspacer/b>&nbsp;<a href="modules.php?name=Your_Account&amp;op=new_user">'._BREG.'</a>&nbsp;<bspacer/b>&nbsp;<a href="/modules.php?name=Your_Account&op=pass_lost">Forgotten Password?</a>';
    } else {
        $theuser = '<a href="modules.php?name=Your_Account"><br />Your Account</a>&nbsp;|&nbsp;<a href="modules.php?name=Your_Account&amp;op=logout" class="logout">'._LOGOUT.' '.$username.'</a>;
   }

if (is_admin($admin) AND is_user($user)) {
   echo''."\n";
}


Thanks for any help in advance with this.
Jane Smile
 
View user's profile Send private message
nuken
RavenNuke(tm) Development Team



Joined: Mar 11, 2007
Posts: 2024
Location: North Carolina

PostPosted: Thu Jan 23, 2014 2:39 pm Reply with quote

you will need to echo the $theuser variable where you want it to appear.

_________________
Tricked Out News 
View user's profile Send private message Send e-mail Visit poster's website
nuken







PostPosted: Thu Jan 23, 2014 3:17 pm Reply with quote

You would also need to determine the $username. Where in the theme do you want it to show?
 
jane65







PostPosted: Thu Jan 23, 2014 4:40 pm Reply with quote

Thank you for your replies Nuken. I've modified the theme a bit, but want it to display right at the top of the page above the logo area and navigation. How do I determine the $username? So far I have the following code in my theme.php but have found that although it displays where I want it to be on the page, it only shows that I am logged in even when I'm logged out, it isn't switching.

Code:
if ($username == 'Anonymous') {

          $theuser = '<a href="modules.php?name=Your_Account">'._LOGIN.'</a>&nbsp;<bspacer/b>&nbsp;<a href="modules.php?name=Your_Account&amp;op=new_user">'._BREG.'</a>';
    } else {
        $theuser = '<a href="modules.php?name=Your_Account"><br />Your Account</a>&nbsp;|&nbsp;<a href="modules.php?name=Your_Account&amp;op=logout">'._LOGOUT.' '.$username.'</a>'."\n";
   }
if (is_admin($admin) AND is_user($user)) {
   echo''."\n";
}

echo '<div class="lineb">'.$theuser.'</div>';
 
nuken







PostPosted: Thu Jan 23, 2014 4:57 pm Reply with quote

In you themes function themeheader, add $user to the globals list. After the body tag, add the following:

Code:


echo'<div style="margin: 0 auto; width: 980px;height:16px;">';
if (is_user($user)) {
      $uinfo = cookiedecode($user);
      echo _BWEL.' '.stripslashes($uinfo[1]). '<a style="float:right;" href="modules.php?name=Your_Account&amp;op=logout">'._LOGOUT.'</a>';
   } else {
   echo '<a href="modules.php?name=nukeNAV&amp;op=login" class="colorbox cboxElement">'._LOGIN.'</a> '._OR.'<a href="modules.php?name=Your_Account&amp;op=new_user"> '._BREG.'</a><a style="float:right" href="modules.php?name=Your_Account&op=pass_lost"> '._PASSWORDLOST.'?</a>';
   }
echo'</div>';


Last edited by nuken on Thu Jan 23, 2014 5:01 pm; edited 1 time in total 
nuken







PostPosted: Thu Jan 23, 2014 5:00 pm Reply with quote

I changed it up a bit. If you want it to all be on the left, just remove the float right style and add the needed spacing.
 
jane65







PostPosted: Fri Jan 24, 2014 9:00 am Reply with quote

Thanks for the code Nuken, it did the trick! Smile
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Themes

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©