Created
July 21, 2021 20:58
-
-
Save tamara-m/a5f7df544f948e623a27e6b7187d814e to your computer and use it in GitHub Desktop.
Various searches in MemberMouse PHP. Various MemberMouse Hooks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Get Member IDs | |
*/ | |
$member_ids = array(); | |
$view = new MM_MembersView(); | |
$dataGrid = new MM_DataGrid(null, null, "desc", 99999); | |
$data = $view->search(null, $dataGrid); | |
foreach ( $data as $member ) { | |
$member_ids[] = $member->id; | |
} | |
/** | |
* Get Product IDs and Name | |
*/ | |
$products = MM_Product::getAll(); | |
foreach ( $products as $id => $product_name ) { | |
// Do stuff | |
} | |
/** | |
* Get Bundles | |
*/ | |
$view = new MM_BundlesView(); | |
$dataGrid = new MM_DataGrid(null, "id", "desc", 999999); | |
$data = $view->getViewData($dataGrid); | |
foreach($data as $key => $item) { | |
$id = $item->id; | |
$name = $item->name; | |
$status = $item->status; // 1 = Active 0 = Inactive | |
} | |
/** | |
* Get Membership Levels | |
*/ | |
$membership_levels = MM_MembershipLevel::getMembershipLevelsList(); | |
foreach ( $membership_levels as $id => $name ) { | |
// Do stuff | |
} | |
/** | |
* Get Subscriptions | |
*/ | |
$view = new MM_SubscriptionsView(); | |
$dataGrid = new MM_DataGrid(null, "date_added", "desc"); | |
$data = $view->getViewData($user_id, $dataGrid); | |
/************** HOOKS *******************/ | |
// Hook Documentation: https://support.membermouse.com/support/solutions/articles/9000020294-membermouse-wordpress-hooks | |
add_action('mm_member_add', 'function'); | |
add_action('mm_member_membership_change', 'function'); | |
add_action('mm_member_status_change', 'function'); | |
add_action('mm_member_account_update', 'function'); | |
add_action('mm_member_delete', 'function'); | |
add_action('mm_bundles_add', 'function'); | |
add_action('mm_bundles_status_change', 'function'); | |
add_action('mm_payment_received', 'function'); | |
add_action('mm_payment_rebill', 'function'); | |
add_action('mm_payment_rebill_declined', 'function'); | |
add_action('mm_billing_subscription_updated', 'function'); | |
add_action('mm_billing_subscription_rebill_date_changed', 'function'); | |
add_action('mm_billing_subscription_canceled', 'function'); | |
add_action('mm_affiliate_info_changed', 'function'); | |
add_action('mm_product_purchase', 'function'); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Heroic