I'm trying to get all users with their active subscriptions or I need to check to see if a specific subscription is active for each user. I have included the boostrap.php file successfully, but can't seem to get it to work . Any help would be greatly appreciated. Here is what I have so far (Not much) PHP: require_once('../amember/bootstrap.php');$user = Am_Di::getInstance()->userTable;
Here is how you cab check if subscription is active for logged in user: PHP: require_once('../amember/bootstrap.php');$user = am_Di::getInstance()->auth->getUser();if(!$user) {// user is not logged in}else{ $products = $user->getActiveProductIds(); if(in_array(1, $products)){ // user have product1 }}
Thanks for the response. I will be using a CRON job to check all users, so they won't be logged in. Is there a way to do it without having the user logged in?
Sure here is code for any user: PHP: require_once('../amember/bootstrap.php');$user = am_Di::getInstance()->userTable->load($user_id, false);if(!$user) {// user is not found}else{ $products = $user->getActiveProductIds(); if(in_array(1, $products)){ // user have product1 }}