Skip to content

Instantly share code, notes, and snippets.

View jeffaspenburg's full-sized avatar

Jeff Aspenburg jeffaspenburg

View GitHub Profile
@cartpauj
cartpauj / mepr-account-info-shortcode-extension.php
Last active August 21, 2019 15:34
MemberPress Account Info Shortcode Extension - Specify User ID
<?php
// This code adds a new shortcode similar to MemberPress' [mepr-account-info]
// However, it also adds an "id" parameter which will get info for a specific user
// by their ID.
//
// Sample Usage: [mepr-account-info-extended field="slug" id="123"]
// field = The slug of your usermeta or custom field
// id = The WP User ID of the user you wish to pull information for
// List of available slugs here: https://docs.memberpress.com/article/112-available-shortcodes
//
@cartpauj
cartpauj / memberpress-hooks.php
Last active July 16, 2024 19:03
Various Subscription and Transaction status hooks for MemberPress with some helpful comments
<?php
//Capture a new member signup. Only ever triggers once for each new member.
//Does not trigger for exising members who have subscribed to a Membership before.
//
//The user may not be logged in when this is called
//as it is triggered when a user is added over the REST API,
//and also when a user is added from the dashboard (MemberPress -> Members -> Add New)
function mepr_capture_new_member_signup_completed($event) {
$user = $event->get_data();
$txn_data = json_decode($event->args);
@cartpauj
cartpauj / mepr-active-memberships.php
Created March 7, 2018 15:51
Get a list of the current user's active MemberPress Subscriptions
<?php
if(class_exists('MeprUtils')) {
$user = MeprUtils::get_currentuserinfo();
if($user !== false && isset($user->ID)) {
//Returns an array of Membership ID's that the current user is active on
//Can also use 'products' or 'transactions' as the argument type
$active_prodcuts = $user->active_product_subscriptions('ids');
if(!empty($active_prodcuts)) {
@mgibbs189
mgibbs189 / custom-loop.php
Last active September 1, 2022 13:25
Multiple Loops for FacetWP
<?php
$args = array(
'post_type' => 'location',
'posts_per_page' => -1,
'order' => 'ASC',
'orderby' => 'title',
'facetwp' => true,
'tax_query' => array(
array(
'taxonomy' => 'advertiser-level',
@octocat
octocat / .gitignore
Created February 27, 2014 19:38
Some common .gitignore configurations
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #