Skip to main content
27 Sep 2013

 

aMember Introduction

aMemeber is subscription management software. It is built on PHP ZEND framework. Features of aMember are following but not limited to:

  • Accept subscription payments
  • manage customer profiles
  • deliver digital content
  • integrate with your blog, forum, or CMS
  • send opt-in newsletters
  • run your own affiliate program

aMember User Subscription Flow

  • Navigate to aMember website subscription list page
  • Select subscription
  • Enter user profile details
  • Enter credit card, payment gateway details on Check out page
  • After Successful payment user is created and assigned subscription

Consider a case where you need to call some action when user is created or subscribed successfully.

Steps to use User Hooks in aMember

  1. Copy aMember/application/configs/site-dist.php to aMember/application/configs/site.php
  2. Append following code to site.php (excluding <code>)
  3. <code>
    Am_Di::getInstance()->hook->add('userAfterInsert', 'yourCustomFunction');
    function yourCustomFunction(Am_Event )
    {
    print '<pre>';
    = ->getUser(); // get user details
    print_r();
    // call external function OR do some processing using object
    print '<pre>';
    exit;
    }
    </code>
  4. Where "userAfterInsert" is hook available from aMember
  5. You have got user object and use that data to send it external application or do it anything with it.

Other Available User Hooks

  • 'userBeforeDelete'
  • 'userAfterDelete'
  • 'userBeforeInsert'
  • 'userBeforeUpdate'
  • 'userAfterUpdate'
  • 'userUnsubscribedChanged'

Summary

Utilize these available hooks(events) in case of integration with third party systems or adding snippets to existing aMember workflow. Create saperate functions to use any of the above hooks as shown in example to insert your customizations. Alternative way to use hooks in aMember is to create a new module and put code inside it. But that requires lot of effort & code. This hook functions are simple & upgrade safe. site.php code remains as it is on upgrade of the software version.