Skip to content

Instantly share code, notes, and snippets.

@noameppel
noameppel / memberpress_mailchimp_mergetags.php
Last active June 8, 2021 05:38
Hooks in to MemberPress $args array before sending new member info to MailChimp.
<?php
/**
* [cleanforest_mepr_add_my_tags]
* Hooks in to MemberPress $args array before sending new member info to MailChimp.
* Used to add custom MERGETAG information.
*/
function cleanforest_mepr_add_my_tags($args, $contact)
{
// MMERGE3 State
$state = get_user_meta($contact->ID, 'mepr-address-state', true);
@noameppel
noameppel / wp_options_chart.php
Created December 6, 2016 13:02
Charts the number of options in the wp_options table using autoload.
<?php
// Version 1.0
// Author Noam Eppel noam@cleanforest.co
// Related: https://pressjitsu.com/blog/optimizing-wp-options-for-speed/
//
// Requires jquery.canvasjs.min.js from http://canvasjs.com/download-html5-charting-graphing-library/
// Hello WP. Update the path to the wp-load.php file.
require_once '../wp-load.php';
@noameppel
noameppel / memberpress-add-remove-roles.php
Last active June 5, 2017 04:38
MemberPress Add/Remove Roles
<?php
/*
* [csnnaa_remove_additional_roles]
* Remove additional role when transaction is created/edited/expires
*/
function csnnaa_remove_additional_roles($roles, $wp_user)
{
$mepr_user = new MeprUser($wp_user->ID);
$active = $mepr_user->active_product_subscriptions('ids');
@noameppel
noameppel / getMediumData.php
Last active September 26, 2019 01:56
Standalone PHP script to fetch latest Medium Posts
<?php
function getMediumData()
{
$handle = curl_init();
$url = "https://api.rss2json.com/v1/api.json?rss_url=https%3A%2F%2Fmedium.com%2Ffeed%2Fmorpheus-network";
// Set the url
curl_setopt($handle, CURLOPT_URL, $url);
// Set the result output to be a string.