I have aMember 3.1.8 installed on my WordPress blog. I put the following code in my sidebar php files. My template, however, has two sidebar files: one for sidebars on PAGES and one for sidebars on POSTS. The following code is in exactly the same place on both sidebar.php files. <?php print "You are logged in as " . $_SESSION['_amember_user']['name_f'] . " " . $_SESSION['_amember_user']['name_l']; ?> It works perfectly on the POST sidebar, but on the PAGE sidebar, the username does not show up. All the other text is there like on the POST sidebar, but the username is completely missing on the PAGE sidebar. <?php session_start(); ?> is currently at the top off my home.php file. Any ideas why the username is missing on the page sidebars?
Yes, this is good advice. If you insert session_start() function into the wp-config.php page then it gets included in ALL WordPress pages, whether they are blog posts, pages etc. I actually use additional code to force session refresh on every page load. This makes sure that if a user has had the subscription status altered (i.e. a subscription has expired, for example), the session data will automatically and immediately refreshed. Otherwise this data will not be updated until a user visits an aMember page (such as amember/member.php) or until they log out and back in again. The full code I use, and insert right at the top of the wp-config.php page is: Code: <?php session_start(); if ($_SESSION['_amember_useer']) { $_product_id = array('ONLY_LOGIN'); require('/linux path/to/amember/plugins/protect/php_include/check.inc.php'); } ?> This seems to work fine for me. If you don't need/want such fine control over a users access then just using session_start() on its own should work fine for most cases. David
I had actually put the session code at the top of the blog page template, but not at the top of the page.php as well. I added it to the top of the page.php and it worked fine. And then I checked the replies to this thread, and I changed everything, putting that extended code in the config file instead. Seems to be working fine. Thanks!