Skip to content

Instantly share code, notes, and snippets.

@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:3845777
Created October 6, 2012 18:50
All Access Levels with Paid Memberships Pro and PMPro-Addon-Packages .1.2+
/*
Set levels as "all access levels" so members of these levels will be able to view all Addon Packages.
Requires Paid Memberships Pro and the pmpro-addon-packages plugin.
*/
function my_pmproap_all_access_levels($levels, $user_id, $post_id)
{
//I'm just adding the level, but I could do some calculation based on the user and post id to programatically give access to content
$levels = array(16);
return $levels;
}
@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 / 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:4162053
Created November 28, 2012 15:40
Hide the PMPro "Require Membership" meta box from non-admins on add/edit post screen.
/*
Hide the PMPro "Require Membership" meta box from non-admins on add/edit post screen.
*/
function hide_pmpro_meta_box()
{
if(!current_user_can("manage_options"))
remove_action("admin_menu", "pmpro_page_meta_wrapper");
}
add_action("init", "hide_pmpro_meta_box", 1);
@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 / pmpro_authorizenet_post_url-example.php
Created March 9, 2013 15:51
Use a different post url for the Authorize.net class with Paid Memberships Pro
/*
Use the NETbilling host with the Authorize.net gateway class.
*/
function my_pmpro_authorizenet_post_url($post_url, $gateway_environment)
{
//could check gateway_environment == "live" here if we had test/live urls
return "https://secure.netbilling.com/gw/native/interactive2.2?x_Login";
}
add_filter("pmpro_authorizenet_post_url", "my_pmpro_authorizenet_post_url", 10, 2);
@strangerstudios
strangerstudios / pmpro-auto-password-generation.php
Created April 7, 2013 18:54
Auto generate passwords with Paid Memberships Pro
/*
Automatically generate password on checkout page.
Note: if you want to remove the entire user area and generate usernames and passwords, simply set the pmpro_skip_account_fields filter to return false.
Use the intstructions here (http://www.paidmembershipspro.com/documentation/advanced-techniques/templates/) to add a checkout page template with the password fields removed.
Uncheck the "Default WP notification email. (Recommended: Leave unchecked. Members will still get an email confirmation from PMPro after checkout.)" option in the PMPro Emails Settings tab.
*/
function my_generate_passwords()
@strangerstudios
strangerstudios / my_pmpro_members_list_csv_extra_columns.php
Last active December 19, 2024 09:06
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 / gist:5390468
Created April 15, 2013 19:02
Hide member content from searches (and other archives) with Paid Memberships Pro and WordPress
/*
Hide Member Content From Searches
By default PMPro will still show titles and optionally excerpts to non-members in the search results.
This code hides member pages completely from non-members.
Place this code into your active theme's functions.php or a custom plugin.
*/
function my_pmpro_posts_results($results)
{
//don't do anything in the admin