Skip to content

Instantly share code, notes, and snippets.

View chsWeb's full-sized avatar

Jono Young chsWeb

View GitHub Profile
@cartpauj
cartpauj / mepr-show-account-nav-shortcode.php
Last active February 29, 2024 02:27
Shortcode to show MemberPress Account page navigation menu on any page
<?php
//
// PASTE SHORTCODE [mepr-account-nav-menu] after adding this snippet to your site
// Use Code Snippets plugin (run snippet only on front end)
// https://wordpress.org/plugins/code-snippets/
//
function mepr_show_nav_menu() {
if(!class_exists('MeprAccountCtrl')) { return; }
$mepr_options = MeprOptions::fetch();
@wzulfikar
wzulfikar / Default.handlebars
Last active October 20, 2022 07:41
MacDown template that support mermaid diagram (http://knsv.github.io/mermaid/index.html). Save this snippet as `Default.handlebars` in `/Applications/MacDown.app/Contents/Resources/Templates/`
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
{{{ titleTag }}}
{{#each styleTags }}
@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