Skip to content

Instantly share code, notes, and snippets.

View search-results.php
<?php
/*
This is the main template part used in the tabbed search results as they are found at www.paidmembershipspro.com.
This will not function on it's own. Some notes:
* This is part of a child theme using the Memberlite theme as a parent.
* There is a search.php file in the child theme folder that loads this template part.
* There is also a search-result.php template part used by this.
* This also relies on CSS styles in Memberlite and our child theme.
*/
@strangerstudios
strangerstudios / inc_extras_patch.php
Last active Aug 26, 2015
Memberlite 2.0.3 XSS Patch
View inc_extras_patch.php
//line 305 of inc/extras.php
//change:
elseif(is_search())
{
?>
<h1 class="page-title"><?php printf( __( 'Search Results for: %s', 'memberlite' ), '<span>' . esc_attr(get_search_query()) . '</span>' ); ?></h1>
<?php
}
View my_memberlite_wordpress_social_custom_css.css
.wp-social-login-connect-with {float: left; margin-right: 1em !important; }
.wp-social-login-provider-list {clear: none !important; padding: 0; }
.wp-social-login-provider-list a {border: none; display: inline-block; text-decoration: none; }
@strangerstudios
strangerstudios / my_pmpro_constant_contact_custom_fields.php
Created Feb 7, 2014
Add a custom field to user data using pmpro-constant-contact.
View my_pmpro_constant_contact_custom_fields.php
//filter constant contact fields
function my_pmpro_constant_contact_custom_fields($fields, $user)
{
$fields[] = array("name"=>"CustomField1", "value"=>$user->user_login);
return $fields;
}
add_filter("pmpro_constant_contact_custom_fields", "my_pmpro_constant_contact_custom_fields", 10, 2);
@strangerstudios
strangerstudios / my_pmpro_aweber_custom_fields.php
Created Feb 11, 2014
Send custom fields from WordPress to AWeber through the PMPro AWeber addon. Your fields must be created already in AWeber and also stored as user meta for the users. Add this code to your active theme's functions.php or a custom plugin.
View my_pmpro_aweber_custom_fields.php
/*
Send custom fields from WordPress to AWeber through the PMPro AWeber addon.
Your fields must be created already in AWeber and also stored as user meta for the users.
Add this code to your active theme's functions.php or a custom plugin.
*/
function my_pmpro_aweber_custom_fields($fields, $user)
{
$fields['custom_field_name'] = get_user_meta($user->ID, "custom_field_name", true);
return $fields;
}
@strangerstudios
strangerstudios / custom_pmpro_getMemberStartdate.php
Last active Aug 29, 2015
Filter the pmpro_getMemberStartdate() function in Paid Memberships Pro. (Requires PMPro v1.7.8 or higher)
View custom_pmpro_getMemberStartdate.php
function custom_pmpro_getMemberStartdate($timestamp, $user_id, $level_id)
{
global $wpdb;
if(!empty($level_id))
$sqlQuery = "SELECT UNIX_TIMESTAMP(startdate) FROM $wpdb->pmpro_memberships_users WHERE membership_id IN(" . esc_sql($level_id) . ") AND user_id = '" . esc_sql($user_id) . "' ORDER BY id LIMIT 1";
else
$sqlQuery = "SELECT UNIX_TIMESTAMP(startdate) FROM $wpdb->pmpro_memberships_users WHERE user_id = '" . esc_sql($user_id) . "' ORDER BY id LIMIT 1";
$timestamp = $wpdb->get_var($sqlQuery);
@strangerstudios
strangerstudios / pmpro_xmlrpc_test.php
Last active Aug 29, 2015
Test code for the XMLRPC methods added to Paid Memberships Pro in PMPro v2.0. Add this to your active theme's functions.php or a custom plugin, then navigate to /?rpctest=1.
View pmpro_xmlrpc_test.php
/*
This code is just meant as a sample of how to use the new XMLRPC methods in PMPro.
Aftering adding this code, navigate to /?rpctest=1
*/
function xmlrpc_test()
{
if(!empty($_REQUEST['rpctest']) && current_user_can("manage_options"))
{
//load XMLRPC Client
include(ABSPATH . "/wp-includes/class-IXR.php");
View backupdb.sh
mysqldump -uusername -ppassword dbname > dbname_`date +'%Y-%m-%d'`.sql
gzip dbname_`date +'%Y-%m-%d'`.sql
@strangerstudios
strangerstudios / my_pmpro_after_checkout_tos_save.php
Last active Aug 29, 2015
Save the date the TOS was checked at checkout with Paid Memberships Pro
View my_pmpro_after_checkout_tos_save.php
//add field to profile
function my_pmprorh_init()
{
if(!function_exists("pmprorh_add_registration_field"))
return;
$secret = new PMProRH_Field("tos_checked_date", "readonly", array("profile"=>"admin", "label"=>"TOS Checked Date"));
pmprorh_add_registration_field("checkout_boxes", $secret);
}
@strangerstudios
strangerstudios / my_pmpro_profile_start_date.php
Created Mar 18, 2014
Add 2 week trial to a monthly subscription plan
View my_pmpro_profile_start_date.php
//change the profile start date
function my_pmpro_profile_start_date($date, $order)
{
if($order->membership_id == 1)
$date = date("Y-m-d", strtotime("+ 14 Days")) . "T0:0:0";
return $date;
}
add_filter("pmpro_profile_start_date", "my_pmpro_profile_start_date", 10, 2);
You can’t perform that action at this time.