Skip to content

Instantly share code, notes, and snippets.

View kerijacoby's full-sized avatar

Keri Jacoby kerijacoby

View GitHub Profile
@kerijacoby
kerijacoby / my_pmpro_prevent_renewal.php
Created November 16, 2022 17:34 — forked from dparker1005/my_pmpro_prevent_renewal.php
Remove 'Renew' link and prevent checkout if user already has membership level
<?php
// Copy from below here.
add_action('pmpro_is_level_expiring_soon', '__return_false', 10, 2);
// Prevent registration and display error message when checking out
// for level that the user already has.
function my_pmpro_prevent_renewal( $continue ) {
@kerijacoby
kerijacoby / positive-ssl-seal
Created November 4, 2022 17:18
Add Positive SSL Seal to PMPro Checkout Page.
<?php
/*
Add Positive SSL Seal to PMPro Checkout Page.
*/
function my_option_pmpro_sslseal($seal) {
if(is_admin()) {
return$seal;
}
ob_start(); ?>
<script type="text/javascript"> //<![CDATA[
@kerijacoby
kerijacoby / my-pmpro-custom-fields.php
Last active October 27, 2022 19:50 — forked from kimwhite/my-pmpro-custom-fields.php
NRGSCapps Custom Registration Fields
<?php // do not copy this line.
/**
* This recipe creates custom fields for your PMPro checkout page.
*
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
* Read this companion article for step-by-step directions on either method.
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
@kerijacoby
kerijacoby / hide-level
Created April 29, 2022 12:36
Hide a level from non-members
<?php
// Add this code below to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
function adjusting_the_pmpro_levels_array( $levels ) {
if( !pmpro_hasMembershipLevel() ) {
unset( $levels[14] ); // hide level 14 from non-members
}
return $levels;
@kerijacoby
kerijacoby / change-default-country-canada
Created March 31, 2022 13:03
Set the default country to Canada
<?php
function filter_pmpro_default_country( $default_country ) {
// Set country code to "CA" for Canada.
$default_country = "CA";
return $default_country;
}
add_filter( 'pmpro_default_country', 'filter_pmpro_default_country' );
@kerijacoby
kerijacoby / pmpro-register-helper-multiple-uploads.php
Created March 22, 2022 20:09
PMPro Register Helper Add Multiple File Uploads
<?php
/*
* Add Additional Register Helper fields for: 1-3 File Uploads
* Save All To User Profile Page
* Applies To All Levels
*/
// We have to put everything in a function called on init, so we are sure Register Helper is loaded.
function pmpro_register_helper_add_upload_fields() {
@kerijacoby
kerijacoby / protected_post_custom_post_thumbnail_html_mod.php
Created February 21, 2022 18:40
Filter the featured image and include an overlay if the post is protected. Exclude specific categories.
<?php
/**
* Filter the featured image and include an overlay if the post is protected.
* Use this with the recipe here: https://gist.github.com/kimcoleman/299bb458310e00d7282c090110c6b4f0
*
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
*
*/
/**
@kerijacoby
kerijacoby / pmpro-extra-expiration-warnings-30
Created February 14, 2022 23:41
Send emails at 30 days prior to membership expiration.
<?php
/**
* Filter the settings of email frequency sent when using the Extra Expiration Warning Emails Add On
* https://www.paidmembershipspro.com/add-ons/extra-expiration-warning-emails-add-on/
*
* Update the $settings array to your list of number of days => ''.
* Read the Add On documentation for additional customization using this filter.
*/
function custom_pmproeewe_email_frequency( $settings = array() ) {
@kerijacoby
kerijacoby / pmpro-register-helper-text-field.php
Created February 9, 2022 21:35
PMPro Register Helper Add Text Field
<?php
/*
* Add Additional Register Helper field for: Stage/ Zoom Name
* Save All To User Profile Page
* Applies To All Levels
*/
// We have to put everything in a function called on init, so we are sure Register Helper is loaded.
function pmpro_register_helper_add_fields() {
@kerijacoby
kerijacoby / bbpress_hide_forums
Created January 26, 2022 18:14
bbPress Hide Forums From Members If Member Does Not Have Access To Level
<?php
/*
* By default the pmpro-bbpress add on will hide topics and replies within a forum,
* but will still show the member forums in the forums list.
*
* You can use this code to hide forums from that list if the logged in member
* does not have access to that forum.
*/
//Tell PMPro to hide forums if member does not have access.