moreisbetter 0 Report post Posted October 28, 2008 I'm using Template 5, and I would like for TNG to display the username at the top of every page while they are logged in.Has anyone added this feature to their TNG site? I couldn't find it by searching the forums or the Wiki.Thanks,Cyndi Share this post Link to post Share on other sites
satyricon 0 Report post Posted October 28, 2008 I have added this to my main index page, but not to each page. I am not using a template. When not logged in it shows 'Visitor', when you are logged in it shows the user's name as defined in the user table. Have a look and if it's approaching what you want I'll post the code - http://bedwas.infoRegardsAdrian Share this post Link to post Share on other sites
Ken Roy 0 Report post Posted October 28, 2008 I'm using Template 5, and I would like for TNG to display the username at the top of every page while they are logged in.Has anyone added this feature to their TNG site? I couldn't find it by searching the forums or the Wiki.Thanks,CyndiCyndi,You will need to change topmenu.php and replace line 49 <td> </td> with the the following code, which is similar to that used in template 4 or 6 <td> <?php if( $currentuser ) { echo "<span class=\"whiteheader\"> $text[welcome], $currentuserdesc.</span>\n"; } else { echo "<span class=\"whiteheader\"> $text[welcome], $text[myguest].</span>\n"; } ?> </td> You will also need to add the following to your cust_text.php in each language folder $text[myguest] = "Visitor";Don't forget to document your changes in another file, so you can redo the changes if needed in the future. Share this post Link to post Share on other sites
moreisbetter 0 Report post Posted October 28, 2008 I have added this to my main index page, but not to each page. I am not using a template. When not logged in it shows 'Visitor', when you are logged in it shows the user's name as defined in the user table. Have a look and if it's approaching what you want I'll post the code - http://bedwas.infoRegardsAdrianThanks, Adrian! Yes, I would like to see the code for this.CyndiYou will also need to add the following to your cust_text.php in each language folder$text[myguest] = "Visitor";Thanks, Ken! Do I need to create a user 'myguest'?Thanks,Cyndi Share this post Link to post Share on other sites
Ken Roy 0 Report post Posted October 28, 2008 Thanks, Adrian! Yes, I would like to see the code for this.CyndiThanks, Ken! Do I need to create a user 'myguest'?Thanks,CyndiCyndi,$text[myguest] is just the text variable I used to welcome users who are not logged in or anonymous users. I would not recommend creating such a user. If your site requires a user to login, then just drop that line. My site is left open so distant cousins can find it, which has worked very well these last couple of years once Google got it indexed. Share this post Link to post Share on other sites
Russellgs 0 Report post Posted October 28, 2008 Thanks, Ken! Do I need to create a user 'myguest'?Thanks,CyndiCyndi,No you do not need to create a user 'myguest'. Anyone that visits your site that is not logged in will be by default a 'Guest'. He is creating a text file varable named $text[myguest] and assigning the name "Visitor" to that variable, so that whenever a person not logged in visits your site they will see the line "Welcome Visitor ..." instead of there user name.Russ Share this post Link to post Share on other sites
satyricon 0 Report post Posted October 29, 2008 Thanks, Adrian! Yes, I would like to see the code for this.Hi Cyndi,As you can see from the above there is more than one way to accomplish this. As I have had a bash at designing my own front page, the HTML/PHP I used looks like the following (obviously the colours, classes, alignments will probably not match your template as they are set up for the colours on my page):<table width="900" class="standard" align="center" cellspacing="0" cellpadding="0" bgcolor="#E0E0FF" border="1"> <tr> <td align="center"> <?php if ($currentuser) {$welcome=$currentuserdesc;} else {$welcome=Visitor;} ?> <strong><br><font color=RED>Hello, <?php echo $welcome ?>, welcome to my Family History Website.</strong></font> <p> ... rest of table stuff goes here ... </td> </tr></table>I don't profess to be an expert coder in either HTML or PHP so I'm sure the above is both clunky and inelegant in the eyes of some (or most). However, it does what it says on the tin.I think the code is fairly self-evident, but please ask if there is anything needs clarifying.Hope this helps,Adrian Share this post Link to post Share on other sites
gleehan 0 Report post Posted November 1, 2008 Folks following this thread and interested in personalizing their sites for logged in users may also want to seePersonalization postHi Cyndi,As you can see from the above there is more than one way to accomplish this. As I have had a bash at designing my own front page, the HTML/PHP I used looks like the following (obviously the colours, classes, alignments will probably not match your template as they are set up for the colours on my page):<table width="900" class="standard" align="center" cellspacing="0" cellpadding="0" bgcolor="#E0E0FF" border="1"> <tr> <td align="center"> <?php if ($currentuser) {$welcome=$currentuserdesc;} else {$welcome=Visitor;} ?> <strong><br><font color=RED>Hello, <?php echo $welcome ?>, welcome to my Family History Website.</strong></font> <p> ... rest of table stuff goes here ... </td> </tr></table>I don't profess to be an expert coder in either HTML or PHP so I'm sure the above is both clunky and inelegant in the eyes of some (or most). However, it does what it says on the tin.I think the code is fairly self-evident, but please ask if there is anything needs clarifying.Hope this helps,Adrian Share this post Link to post Share on other sites
moreisbetter 0 Report post Posted November 5, 2008 Cyndi,You will need to change topmenu.php and replace line 49 <td> </td> with the the following code, which is similar to that used in template 4 or 6 <td> <?php if( $currentuser ) { echo "<span class=\"whiteheader\"> $text[welcome], $currentuserdesc.</span>\n"; } else { echo "<span class=\"whiteheader\"> $text[welcome], $text[myguest].</span>\n"; } ?> </td> You will also need to add the following to your cust_text.php in each language folder $text[myguest] = "Visitor";Don't forget to document your changes in another file, so you can redo the changes if needed in the future.I'm just now getting back to making this change, and although I thought I followed your instructions exactly, the only name that displays whether the user is logged in or not is 'Visitor'. Any ideas?Thanks,Cyndi Share this post Link to post Share on other sites
Ken Roy 0 Report post Posted November 5, 2008 I'm just now getting back to making this change, and although I thought I followed your instructions exactly, the only name that displays whether the user is logged in or not is 'Visitor'. Any ideas?Thanks,CyndiHi Cyndi,Sorry, I may have left out the fact that you need to add the $currentuser and $currentuserdesc variables to the global statement, so the code in line 1 of template 5 would be<?php global $text, $cms, $currentuser, $currentuserdesc; ?> Share this post Link to post Share on other sites
moreisbetter 0 Report post Posted November 5, 2008 Hi Cyndi,Sorry, I may have left out the fact that you need to add the $currentuser and $currentuserdesc variables to the global statement, so the code in line 1 of template 5 would be<?php global $text, $cms, $currentuser, $currentuserdesc; ?>Thanks, Ken - that did the trick!Cyndi Share this post Link to post Share on other sites