Skip to content

Instantly share code, notes, and snippets.

@tech4him
tech4him / gist:a39cf232089766292665404441568990
Created June 24, 2017 22:22
PaidMembershipsPro - Default Membership on Registration
/**
* When registering, add the member to a specific membership level
* @param integer $user_id
**/
//Disables the pmpro redirect to levels page when user tries to register
add_filter("pmpro_login_redirect", "__return_false");
function my_pmpro_default_registration_level($user_id) {
//Give all members who register membership level 1
pmpro_changeMembershipLevel(1, $user_id);
}
@strangerstudios
strangerstudios / my_pmpro_default_registration_level.php
Created May 13, 2014 16:05
my_pmpro_default_registration_level
<?php
/**
* When registering, add the member to a specific membership level
* @param integer $user_id
**/
//Disables the pmpro redirect to levels page when user tries to register
add_filter("pmpro_login_redirect", "__return_false");
function my_pmpro_default_registration_level($user_id) {
@strangerstudios
strangerstudios / pmpro_login_redirect.php
Created March 16, 2014 13:19
Tell PMPro to NOT redirect from default register page to PMPro pages. Add this code into a custom plugin or your active theme's functions.php.
add_filter("pmpro_login_redirect", "__return_false");
@strangerstudios
strangerstudios / my_pmpro_email_filter.php
Last active April 7, 2018 21:07
Change admin_change email tempalte sent by Paid Memberships Pro to members when they move from one level to another. Useful for "approval" workflows on sign up.
/*
Change admin_change email sent to members when they move from "Applicant" level to "Approved" level.
You should have two levels, "Applicant" level ID 1 and "Approved" level ID 2.
If the names or IDs of your levels are different, you will have to change the code below.
You also need a file "applicant_approved.html" in the ../themes/yourtheme/paid-memberships-pro/email/ directory.
*/
function my_pmpro_email_filter($email)
{
if($email->template == "admin_change" && $email->data['membership_level_name'] == "Approved")
{
@strangerstudios
strangerstudios / my_pmpro_members_list_csv_extra_columns.php
Last active December 9, 2022 10:00
Add a custom field to the members list CSV export in Paid Memberships Pro.
<?php
/*
Add employer, title, and department columns to the members list CSV export.
Just add this code to your functions.php or a custom plugin.
The first function here defines the column headers and a callback function for each column.
*/
function my_pmpro_members_list_csv_extra_columns($columns)
{
$columns["employer"] = "my_extra_column_employer";
@strangerstudios
strangerstudios / pmpro_email_filter_example.php
Last active October 31, 2020 01:22
Edit all PMPro email properties at once via pmpro_email_filter.
/*
Edit email templates.
Other fields to change:
* $email->email
* $email->from
* $email->fromname
* $email->subject
* $email->template
* $email->body
@strangerstudios
strangerstudios / gist:4081449
Created November 15, 2012 21:35
Change Paid Memberships Pro Email Subjects
/*
Change email subjects.
The function checks $email->template and updates the subject as needed.
The email template name will be equivalent to the filenames in the /email/ folder of the PMPro plugin.
*/
function my_pmpro_email_subject($subject, $email)
{
//only checkout emails
@strangerstudios
strangerstudios / gist:4027538
Created November 6, 2012 21:06
Hide the confirm email and confirm password fields from the Paid Memberships Pro checkout page.
/*
Don't show confirm password or email fields on the checkout page.
Add this code to your active theme's functions.php or a custom plugin.
*/
add_filter("pmpro_checkout_confirm_password", "__return_false");
add_filter("pmpro_checkout_confirm_email", "__return_false");
@strangerstudios
strangerstudios / my_pmpro_members_list_csv_extra_columns.php
Last active April 7, 2018 21:10
Add Website and Nickname Fields to the Paid Memberships Pro Members List CSV Export
/*
Plugin Name: PMPro Extra Members List CSV Export Columns
Plugin URI: http://www.paidmembershipspro.com/wp/pmpro-extra-members-list-csv-export-columns/
Description: Add extra fields to the Paid Memberships Pro Members List CSV Export
Version: .1
Author: Stranger Studios
Author URI: http://www.strangerstudios.com
Notes on use:
@strangerstudios
strangerstudios / gist:2930051
Last active April 16, 2021 23:36
Use Paid Memberships Pro Filter to Force HTTPS on All Pages
/*
Add this into a custom plugin or your active theme's functions.php
*/
add_filter("pmpro_besecure", "__return_true");