Skip to content

Instantly share code, notes, and snippets.

View pbrocks's full-sized avatar

Paul Barthmaier pbrocks

View GitHub Profile
@pbrocks
pbrocks / banner-warning-for-expireds.php
Last active June 21, 2019 23:04
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>' : '' );
@pbrocks
pbrocks / filter-wordpress-admin-tables-with-sticky-headers.php
Created May 11, 2018 01:57 — forked from bryanwillis/filter-wordpress-admin-tables-with-sticky-headers.php
Filters wordpress admin tables live and sticks the headers to top on scroll. Do not use as is, problem with updating tables.
<?php
if ( !function_exists( 'stick_scroll_filter_wp_list_tables' ) ) {
function stick_scroll_filter_wp_list_tables() {
$screen = get_current_screen();
$base = $screen->base;
$type = $screen->post_type;
$name = $screen->id;
if ( (($base === 'edit') && ($type == 'page' || $type == 'post')) && (wp_script_is( 'jquery', 'done' )) )
{ ?>
<style type="text/css">
@pbrocks
pbrocks / wp-hooks-filter.php
Created May 11, 2018 01:57 — forked from bueltge/wp-hooks-filter.php
Instruments Hooks for a Page of WordPress. Outputs during the Shutdown Hook after add get-params: ?instrument=hooks
<?php
/*
Plugin Name: Instrument Hooks for WordPress
Plugin URI: http://bueltge.de/
Description: Instruments Hooks for a Page. Outputs during the Shutdown Hook after add get-params <code>?instrument=hooks</code>.
Version: 0.0.1
Author: Frank B&uuml;ltge
Author URI: http://bueltge.de/
*/
@pbrocks
pbrocks / bp-custom.php
Created May 11, 2018 01:45 — forked from imath/bp-custom.php
This a snippet to auto join "just activated" members in one or more BuddyPress groups.
<?php
if ( ! class_exists( 'Imath_Auto_Join_Groups' ) ) :
/**
* AutoJoin new members to chosen groups
*
* This is a little snippet, feel free to :
* - use it
* - extend it..
@pbrocks
pbrocks / pmpro-start-of-month-payments.php
Last active May 8, 2018 13:01 — forked from eighty20results/pmpro-start-of-month-payments.php
No proration for the initial payment & set the start date for the recurring payments to the 1st of the month
<?php
/**
* Plugin Name: UNprorated initial membership payment
* Plugin URI: http://www.paidmembershipspro.com/wp/pmpro-customizations/
* Description: Will prorate the membership payment from today until the 1st of the next month.
* Version: .2.1
* Author: Thomas Sjolshagen @ Stranger Studios <[email protected]>
*/
/**
* Keep the membership level payment same as a full month.
@pbrocks
pbrocks / pmpro-blr-reset.php
Last active June 4, 2018 20:11
Use this recipe to reset your site's PMPro Better Logins and Views Report data. With this we are only resetting the views and logins, not removing any other membership data.
<?php
/**
* Add this code to your PMPro Customizations Plugin - For more info on this visit:
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
/**
* Create a menu to give us a place to perform the reset. I'm choosing a Dashboard menu purely for ease of access.
*/
add_action( 'admin_menu', 'blr_reset_views_admin_page' );
function blr_reset_views_admin_page() {
@pbrocks
pbrocks / clear-all-pmpro-data-on-init.php
Created May 5, 2018 14:46
This will delete all orders, members/level data, and reporting data. Your levels, discount codes, and settings will remain in place. All users will remain users (without memberships). All subscriptions at the gateway will remain active.
<?php
/**
* Clear out all PMPro member and report data.
*
* Back up your database first. Use at your own risk!!!
*
* This will delete all orders, members/level data, and reporting data.
* Your levels, discount codes, and settings will remain in place.
* All users will remain users (without memberships).
* All subscriptions at the gateway will remain active.
@pbrocks
pbrocks / README.md
Last active May 2, 2018 17:09 — forked from ControlledChaos/README.md
Replaces "Post" in the update messages for custom post types on the "Edit" post screen.

Custom Post Type Message

WordPress Snippetthat replaces "Post" with CPT name in the update messages for custom post types on the "Edit" post screen.

@pbrocks
pbrocks / pmpro-cancel-on-next-payments-date.php
Last active July 17, 2019 14:26 — forked from strangerstudios/pmpro_cancel_on_next_payments_date.php
Change PMPro membership cancellation to set expiration date for next payment instead of cancelling immediately.
<?php
/**
* Change cancellation to set expiration date for next payment instead of cancelling immediately.
*
* Assumes orders are generated for each payment (i.e. your webhooks/etc are setup correctly).
*
* Since 2015-09-21 and PMPro v1.8.5.6 contains code to look up next payment dates via Stripe and PayPal Express APIs.
*/
/**

Mike J, Gerhard P, Lauren S, Allen S chatted about a personal data exporter design that could support WooCommerce and its extensions needs (and be applicable to core itself or any plugin)

In a nutshell, we eventually thought it would be best to try having plugins (and extensions) register a callback function(s) for the export of personal data, e.g. have a plugin do something like this):

add_filter( "wp_privacy_register_export_data_callback", array( $this, 'register_export_data_callback' ) );
 
function register_export_data_callback( $export_callbacks ) {
    $export_callbacks[] = array(
        'slug' => 'stripe',