February 5

Check If User Is Subscribed To Product

These codes will help you discover if a member is subscribed to one or multiple products in aMember. The code is in PHP which means if you want to use this, you will have to convert your HTML pages to display PHP. If you use WordPress, these can be used in Pages or Posts or the Sidebar if you have the plugins installed.

Check for only one product ID

If user is subscribed to product ID #9, then

<?php session_start(); ?>
<? $user = $_SESSION['_amember_user'];
if (in_array(9, $_SESSION['_amember_product_ids'])) { } ?>
Check for a number of product ID’s
<?php
session_start();
$productids = array(3,4);
if (in_array(3, $_SESSION['_amember_product_ids'])){
 print "User is subscribed to product #3;
} else {
 print "User is not subscribed nor to product #3";
}
?>

Tags


You may also like

Force cPanel Password Reset

Force cPanel Password Reset
{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}

Get in touch

Name*
Email*
Message
0 of 350