Wordpress Themes - WP Forum at BFA
Click here to register or to donate.
Auto self-registration is not available here - far too many spammers. This forum has many, many backlinks and because of that there is an intense desire among spammers to drop their links here.

Wordpress Themes - WP Forum at BFA » WordPress Themes » Montezuma Theme »

[SOLVED] Welcome / logout text at the top right


  #1  
Old Mar 17, 2013, 05:22 AM
zibzab
 
7 posts · Mar 2013
Hi, I love the montezuma theme - just one thing I'd like to add if possible.

Above the menus in the header, I'd like to add some text that knows if a user is logged in. If they are logged in, it says Welcome "First Name" and then shows the option to log-out. If they are not logged in, then there is no message displayed.

Is this easy to do - any help would be much appreciated.

Cheers


Just to add, I have used the following code in other themes and it has worked great. Just need to know how to add this to Montezuma.

Code:
<?php global $user_identity; if ($user_identity): ?>
<h2 class="site-description">
<?php global $current_user;
      get_currentuserinfo();
	echo 'Welcome ' . $current_user->user_firstname ; ?>

  (<a href="<?php bloginfo('wpurl'); ?>/wp-login.php?action=logout" title="Logout">Logout</a>)</h2>
<?php endif; ?>
Any ideas?

Last edited by zibzab; Mar 17, 2013 at 10:56 AM. Reason: update
  #2  
Old Mar 17, 2013, 10:31 AM
zibzab
 
7 posts · Mar 2013
Hi, I have used this code in a different theme and it does what I want hoever, it doesn't appear correctly in Montezuma.

Code:
<?php global $user_identity; if ($user_identity): ?>
<h2 class="site-description">
<?php global $current_user;
      get_currentuserinfo();
	echo 'Welcome ' . $current_user->user_firstname ; ?>

  (<a href="<?php bloginfo('wpurl'); ?>/wp-login.php?action=logout" title="Logout">Logout</a>)</h2>
<?php endif; ?>
Can anyone help?
  #3  
Old Mar 17, 2013, 10:33 AM
zibzab
 
7 posts · Mar 2013
Just to add, I've used the following code on a different theme and it works fine - just not sure how to add this to Montezuna.

Code:
<?php global $user_identity; if ($user_identity): ?>
<h2 class="site-description">
<?php global $current_user;
      get_currentuserinfo();
	echo 'Welcome ' . $current_user->user_firstname ; ?>

  (<a href="<?php bloginfo('wpurl'); ?>/wp-login.php?action=logout" title="Logout">Logout</a>)</h2>
<?php endif; ?>
Any ideas?
  #4  
Old Mar 17, 2013, 11:37 AM
juggledad's Avatar
juggledad
 
23,630 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
you need to add a 'Dynamic Sidebar' (see the limited php code) and then add your code into it and have a plugin like widget logic.
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #5  
Old Mar 17, 2013, 11:55 AM
zibzab
 
7 posts · Mar 2013
Hi, sorry I'm not sure what you mean by "'Dynamic Sidebar' (see the limited php code)". I need this to go above the menu items - not as a sidebar widget. Is this possible?
  #6  
Old Mar 17, 2013, 12:00 PM
zibzab
 
7 posts · Mar 2013
Hi, just seen the Limited Php section.

With this in mind, is there a way of getting what I want into the header, or is it almost impossible?
  #7  
Old Mar 17, 2013, 12:12 PM
juggledad's Avatar
juggledad
 
23,630 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
the label 'dynamic sydbar' is mis leading, it should say 'dynamic widget area'
so add one in the header
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #8  
Old Mar 17, 2013, 12:26 PM
zibzab
 
7 posts · Mar 2013
Hi, thanks for helping. I'm not sure where or what I should be adding the dynamic widget!

Sorry to sound stupid, but could you give me a bit more info please. I'm not a developer.


Thanks
  #9  
Old Mar 17, 2013, 01:33 PM
juggledad's Avatar
juggledad
 
23,630 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
Copy the sample code and put it in the hearer.php virtual template, then go to the widget area and you will see the new area and you can add a widget into it

Experiment a little, play with it, best way to learn
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #10  
Old Mar 17, 2013, 03:32 PM
zibzab
 
7 posts · Mar 2013
Hi, with a bit more rooting around I have managed to do it - looks good.

After trying unsuccessfully to create my own widget I found a plug-in called executable-php-widget which allowed me to create what I wanted.

Job done. Thanks.

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
adding login/logout to menu bar Pshill Page & Category Menu Bars 9 Nov 21, 2011 01:09 PM
[SOLVED] Logout error bug sober Atahualpa 3 Wordpress theme 2 Jan 5, 2011 05:11 AM
WP-admin logout/in for changes to occur? Craig Mattice Atahualpa 3 Wordpress theme 2 Apr 30, 2009 03:26 PM
Settings Not Saving Until Logout ieatgravel Atahualpa 3 Wordpress theme 3 Apr 14, 2009 05:25 AM


All times are GMT -6. The time now is 03:49 PM.


Powered by vBulletin® Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.