Skip to content

Instantly share code, notes, and snippets.

View itsjusteileen's full-sized avatar
🎯
Focusing

Eileen Violini itsjusteileen

🎯
Focusing
View GitHub Profile
@itsjusteileen
itsjusteileen / pmprosm_sponsored_account_levels.php
Created February 8, 2019 19:11 — forked from ideadude/pmprosm_sponsored_account_levels.php
Example global settings for the PMPro Sponsored Members Add On
/*
Define the global array below for your main accounts and sponsored levels.
Array keys should be the main account level.
*/
global $pmprosm_sponsored_account_levels;
$pmprosm_sponsored_account_levels = array(
//set 5 seats at checkout
1 => array(
'main_level_id' => 1, //redundant but useful
'sponsored_level_id' => array(1,2), //array or single id
<?php
// http://stackoverflow.com/questions/7952977/php-check-if-url-and-a-file-exists
function is_200($url) {
$options['http'] = array(
'method' => "HEAD",
'ignore_errors' => 1,
'max_redirects' => 0
);
$body = file_get_contents($url, NULL, stream_context_create($options));
@itsjusteileen
itsjusteileen / pmpro_checkout_end_date_example.php
Created April 1, 2019 16:17 — forked from strangerstudios/pmpro_checkout_end_date_example.php
Setup Level 3 to start next Monday and end the following Monday with Paid Memberships Pro.
/*
Setup Level 3 to start next Monday and end the following Monday
Requires PMPro 1.8.9 or higher.
Add this code to your active theme's functions.php or a custom plugin.
*/
//startdate
function my_pmpro_checkout_start_date($enddate, $user_id, $level) {
if($level->id == 3)
/**
* BLOCK: gtm-audio-block
*
* Registering a basic block with Gutenberg.
* Simple block, renders and saves the same content without any interactivity.
*/
// Import CSS.
import './style.scss';
import './editor.scss';
/*
If a parent account checks out and distributes the discount code to 3/10 of its child accounts,
the parent account should still have 7 remaining. This 7 remaining uses should persist after a
renewal by the parent account.
By default the discount codes have an expiration period of one year.
Even if they renew, the discount code expiration date is not updated.
We are hard coding the start and end date of the discount code itself in the function pmprosm_createSponsorCode()
@itsjusteileen
itsjusteileen / change-level-only-when-user-expires.php
Last active June 21, 2019 18:34 — forked from andrewlimaza/change-level-only-when-user-expires.php
Change user's membership level only when a user expires from a specific level.
<?php
/**
* Change membership level for users expiring from startup level, moving them to primary level.
* Users can cancel their membership level after their before or after the membership level change.
*/
function wbon_change_default_level_when_expiring_startup( $user_id, $level_id ) {
global $wpdb;
@itsjusteileen
itsjusteileen / my_pmpro_after_change_membership_level.php
Created June 21, 2019 21:01 — forked from strangerstudios/my_pmpro_after_change_membership_level.php
Only allow users to use the trial level once with Paid Memberships Pro.
<?php
/*
Only allow users to use the trial level once.
Add this code to your active theme's functions.php
or a custom plugin.
Be sure to change the $trial_level_id variable in multiple places.
*/
//record when users gain the trial level
function my_pmpro_after_change_membership_level($level_id, $user_id)
{
@itsjusteileen
itsjusteileen / banner-warning-for-expireds.php
Created June 21, 2019 23:04 — forked from pbrocks/banner-warning-for-expireds.php
Add a banner message to the top of your site to let members know that their membership has expired.
<?php
/**
* Add a banner message to the top of your site to let members know that their membership has expired.
*/
// Let's build the banner message to display if member expired.
function extra_warning_for_renewal( $input ) {
global $pmpro_pages;
$target = get_permalink( $pmpro_pages['levels'] );
$message = 'Hi ' . $input['display_name'] . '. Your ' . ( ( $input['message'] ) ? $input['membership_name'] . ' subscription, expired on ' . $input['enddate'] . ' <a class="button-primary" href="' . esc_url( $target ) . '">' . $input['message'] . '</a>' : '' );
@itsjusteileen
itsjusteileen / functions.php
Created August 3, 2019 12:28 — forked from hlashbrooke/functions.php
Seriously Simple Podcasting: Remove 'Download file' link from episode meta data
add_filter( 'ssp_episode_meta_details', 'ssp_remove_download_link', 10, 3 );
function ssp_remove_download_link ( $meta, $episode_id, $context ) {
unset( $meta['link'] );
return $meta;
}
@itsjusteileen
itsjusteileen / wps_load_scripts.php
Created September 2, 2019 17:57 — forked from wpsmith/wps_load_scripts.php
Enqueue Isotope
<?php
add_action( 'wp_enqueue_scripts', 'wps_load_scripts' );
/**
* Enqueue Isotope
* For commercially developed child themes, you must obtain a license
* from isotope.metafizzy.co for approx. $25.
*
* @author Travis Smith
* @link http://wpsmith.net