I would like to have session variables within the header of my website where when the user is not logged in it simply says "login" and when is the user is logged in it says Hi "name" etc... I know that the php code for that in the amember manual is the following
PHP: <?php session_start();$user = $_SESSION['_amember_user'];?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>><head><meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" /> etc. and then in say a div where you want the username or log in box to appear you have the following part of the code PHP: if ($user['member_id'] > 0){print "Hello $user[name_f] $user[name_l] <br>\n";print "Your E-Mail address is $user[email] <br>\n";print "Your subscription status is $user[status] <br>\n";} else {print "You are not logged-in"; You MUST make sure that at the top of the page you have NO spaces or blank lines otherwise you will get the 'headers already sent error'. Top of my page is PHP: <?php session_start();$logged_in = ($au = $_SESSION['_amember_user']);$user = $_SESSION['_amember_user'];$first_name = $user[name_f];$log_in = $user[login];$status = $user[status];?> and then in required location: PHP: <?phpif ($logged_in){ echo '<div class="login-div"> <div style="float:right; padding-right:24px;"> <p>You are currently logged in as: <strong>'.$log_in.'</strong> <a href="/amember/logout.php">Logout?</a></p> </div> </div>';?><hr /><?php}else{?> <div class="login-div"> <div style="float:right;"><form method="post" action="/amember/login.php"> <div><input type="hidden" name="amember_redirect_url" value="/result.php?display=member_page" /></div> <div class="login-element"><label>Username: </label><input type="text" name="amember_login" class="login-input" /></div><div class="login-element"><label>Password: </label><input type="password" name="amember_pass" class="login-input" /></div> <div style="float:left;"><input type="image" src="images/login-button.jpg" class="login-button" name="submit" value="Login" title="Login" /></div></form></div> </div> <?php }?> The result of the above can be seen at http://www.themanualslibrary.co.uk/the-manuals.php
You are amazing, thank you so much heres my site in care ure interested, not finished yet but almost http://www.fitfactors.net
I noticed that you're using Wordpress. Have you considered using amProtect? It's a plugin for Wordpress that handles access and such to pages on Wordpress but uses 'the rules' from aMember. You can also access very easily all aMember session variables by using short codes in Wordpress articles. You can check out the video, see if you like it - I most certainly do.