Information and Links

Join the fray by commenting, tracking what others have to say, or linking to it from your blog.


Other Posts

aMember check for a logged in user using php

Posted by plattapuss on June 16th, 2008

Recently I needed to verify if a user was logged in on a site using aMemberPro. But the site uses the new_write method, and I needed a way to check for this quickly in a php file for an include block. Here is what I added to the php page:

CODE:
  1. session_start();;
  2. $amember_id = (isset($_SESSION['_amember_id']) && !empty($_SESSION['_amember_id'])) ? $_SESSION['_amember_id'] : false;
  3. if (!$amember_id) {
  4.   include('path/to/my/block.inc.php');
  5. }

Not sure how right or wrong this is, but it works rather well.



Reader Comments

aMember has a built in php include method available. In the protect folder, after choosing the folder, choose php_include. The code you need to use will be presented.

David
Membership Academy
http://www.membershipacademy.com