Skip to content

Instantly share code, notes, and snippets.

Thomas Sjolshagen eighty20results

Block or report user

Report or block eighty20results

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@eighty20results
eighty20results / preserve-startdate-including-registration-date.php
Last active Apr 16, 2018
Preserve startdate on membership level change
View preserve-startdate-including-registration-date.php
/*
Keep members start dates at checkout, even if switching levels.
*/
function custom_pmpro_checkout_start_date($date, $user_id, $level)
{
global $wpdb;
// Comment this out if you want to use the users registration date (Warning: Registration date may not contain data...)
$sqlQuery = "SELECT UNIX_TIMESTAMP(startdate) FROM $wpdb->pmpro_memberships_users WHERE user_id = '" . esc_sql($user_id) . "' ORDER BY id LIMIT 1";
View pmpro-show-all-directory-users.php
<?php
/*
Plugin Name: PMPro Directory Customization
Plugin URI: http://www.paidmembershipspro.com/wp/pmpro-customizations/
Description: Show all PMPro Users in directory (regardless of status).
Version: .1
Author: Thomas Sjolshagen @ Stranger Studios <thomas@eighty20results.com>
Author URI: http://www.strangerstudios.com
*/
@eighty20results
eighty20results / pmpro-billing-info-in-profile.php
Last active Feb 16, 2016
Add billing info to the users profile
View pmpro-billing-info-in-profile.php
<?php
/*
Use PMPro Register Helper to add PMPro Billing Address fields to the edit user page for admins.
*/
function my_show_pmpro_address_fields_in_profile()
{
//require PMPro and PMPro Register Helper
if(!defined('PMPRO_VERSION') || !defined('PMPRORH_VERSION'))
return;
@eighty20results
eighty20results / pmpro-rh-for-legacy-brands.php
Created Feb 16, 2016
Register Helper fields that also use the default WordPress meta field names for "First name" and "Last name".
View pmpro-rh-for-legacy-brands.php
<?php
function my_add_pmpro_RH_fields()
{
//require PMPro and PMPro Register Helper
if (!defined('PMPRO_VERSION') || !defined('PMPRORH_VERSION'))
return;
$fields = array();
$fields[] = new PMProRH_Field(
"first_name", // Input name, will also be used as the key to access as user meta
@eighty20results
eighty20results / pmpro-rh-for-legacy-brands.php
Created Feb 16, 2016
Register Helper fields that also use the default WordPress meta field names for "First name" and "Last name".
View pmpro-rh-for-legacy-brands.php
<?php
/*
Plugin Name: Additional Checkout Fields (PMPro Register Helper)
Plugin URI: http://www.paidmembershipspro.com/wp/pmpro-customizations/
Description: Additional Checkout page & profile fields for the Paid Memberships Pro Register Helper add-on
Version: .1
Author: Thomas Sjolshagen @ Stranger Studios <thomas@eighty20results.com>
Author URI: http://www.strangerstudios.com
*/
function my_add_pmpro_RH_fields()
View pmpro-rh-fields-for-femworking.php
<?php
/*
Plugin Name: Additional Checkout Fields (PMPro Register Helper)
Plugin URI: http://www.paidmembershipspro.com/wp/pmpro-customizations/
Description: Additional Checkout page & profile fields for the Paid Memberships Pro Register Helper add-on
Version: .1
Author: Thomas Sjolshagen @ Stranger Studios <thomas@eighty20results.com>
Author URI: http://www.strangerstudios.com
*/
function my_add_pmpro_RH_fields()
@eighty20results
eighty20results / pmpro-birthday-validation.php
Last active Mar 9, 2016
Collect birthdate on checkout
View pmpro-birthday-validation.php
<?php
/*
Add birthday to user signup and check that user is between 13-17.
Will not work with PayPal Standard or PayPal Express.
*/
//birthday fields
function my_pmpro_checkout_after_user_fields()
{
$current_day = date("j");
@eighty20results
eighty20results / pmpro-check-for-invalid-fqdn-in-email.php
Created Feb 29, 2016
Check for FQDNs that are supposed to trigger an "invalid email domain" error on checkout
View pmpro-check-for-invalid-fqdn-in-email.php
<?php
function restrict_email($value)
{
$email = $_REQUEST['bemail'];
if(is_invalid($email))
{
global $pmpro_msg, $pmpro_msgt;
//TODO: Set the error text to be whatever you want it to be:
@eighty20results
eighty20results / functions.php
Created Feb 29, 2016
Proposal: pmpro_loadTemplate() function
View functions.php
function pmpro_loadTemplate($page_name = null, $type = 'pages', $ext = 'php' )
{
// called from page handler shortcode
if (is_null($page_name))
{
global $pmpro_page_name;
$page_name = $pmpro_page_name;
}
// template paths in order of priority (array gets reversed)
@eighty20results
eighty20results / hide-membership-levels.php
Created Mar 2, 2016
Hide all levels except the current user's membership level from the list of membership levels on display
View hide-membership-levels.php
<?php
/*
* Hide some levels from Levels page
*/
function my_pmpro_levels_array($levels) {
global $current_user;
// if the user is logged in
if (!empty($current_user->ID))
You can’t perform that action at this time.