Skip to content

Instantly share code, notes, and snippets.

@supercleanse
supercleanse / roles_lookup.php
Created April 9, 2014 17:29
Updating roles via a lookup array when MemberPress Transaction completes
<?php
/*
Plugin Name: MemberPress Products to User Roles
Plugin URI: http://memberpress.com
Description: Assigns a member to a User Role depending on what Product they purchased.
Version: 1.0.0
Author: Caseproof, LLC
Author URI: http://caseproof.com
Copyright: 2004-2013, Caseproof, LLC
*/
anonymous
anonymous / Sticky menu on scroll.markdown
Created May 25, 2015 04:40
Sticky menu on scroll
@cartpauj
cartpauj / mepr-sub-actions.php
Created December 15, 2015 17:44
MemberPress Subscription Actions
<?php
// 1) User purchases and payment is complete
function capture_completed_transaction($txn) {
//It's possible this could be a recurring transaction for a product the user is already subscribed to so probably use a user meta field described below
$user = new MeprUser($txn->user_id); //A MeprUser object
$membership = new MeprProduct($txn->product_id); //A MeprProduct object
$users_memberships = $user->active_product_subscriptions('ids'); //An array of membership CPT ID's
//Here you may want to grab a user meta field of your own creating and check to see if the user is already subscribed to this membership or not
//If not, then push them to your 3rd party application and update the user meta field