Skip to content

Instantly share code, notes, and snippets.

@pbrocks
pbrocks / banner-warning-for-expireds.php
Last active June 21, 2019 23:04
Add a banner message to the top of your site to let members know that their membership has expired.
<?php
/**
* Add a banner message to the top of your site to let members know that their membership has expired.
*/
// Let's build the banner message to display if member expired.
function extra_warning_for_renewal( $input ) {
global $pmpro_pages;
$target = get_permalink( $pmpro_pages['levels'] );
$message = 'Hi ' . $input['display_name'] . '. Your ' . ( ( $input['message'] ) ? $input['membership_name'] . ' subscription, expired on ' . $input['enddate'] . ' <a class="button-primary" href="' . esc_url( $target ) . '">' . $input['message'] . '</a>' : '' );
@JasvinderSingh1
JasvinderSingh1 / wordpress.txt
Last active February 21, 2021 18:37
WORDPRESS CODES
// reference for Wordpress Functions
https://codex.wordpress.org/Function_Reference
https://developer.wordpress.org/
/***********************/
Display terms with pagination start
if ( get_query_var( 'paged' ) )
$paged = get_query_var('paged');
@andrewlimaza
andrewlimaza / multiple-custom-fields-for-email-checkout-pmpro.php
Created April 24, 2018 10:44
Add multiple Custom Fields to Email for Paid Memberships Pro with Attributes.
<?php
/**
* Add this code (line 8-32) to your PMPro Customizations Plugin.
* Inside your checkout email for members/admins, add any attributes and it will replace the value if there is a value available.
* E.g Your number is !!mobile!!, see line 24 for all available attributes to use in Email Template Admin Editor
*/
function my_pmpro_email_body( $body, $email ) {
//only checkout emails
if ( false !== strpos( $email->template, "checkout" ) ) {
@andrewlimaza
andrewlimaza / custom-field-register-helper-checkout-email.php
Last active May 28, 2019 05:30
Add custom field to Paid Memberships Pro Checkout Email using Register Helper
<?php
/**
* This will check for !!company_name!! in the emails body and replace it with the 'company_name' metadata (created by Register Helper).
* Add this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpro_email_body( $body, $email ) {
//only checkout emails
if ( false !== strpos( $email->template, "checkout" ) ) {
@kimcoleman
kimcoleman / my_pmpro_rh_custom_fields_maxk97.php
Created March 8, 2018 10:37
Another take on the custom fields for maxk97
<?php
/**
* Custom Fields for various sections of checkout
*/
function my_pmpro_rh_custom_fields() {
global $current_user;
// don't break if Register Helper is not loaded
if ( ! function_exists( 'pmprorh_add_registration_field' ) ) {
return false;
@andrewlimaza
andrewlimaza / change_body_for_email.php
Created January 9, 2018 06:56
Change body content according to level checkout for Paid Memberships Pro.
<?php
/**
* Change body text of email according to level checkout.
* Assumes level ID is 1.
* Add this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpro_email_body( $body, $email ) {
@dmmoelle
dmmoelle / membershipquery.php
Created January 2, 2018 20:47
how do I pass the value form the sdate form input on line 20 into the sql query on line 85
<?php
/*
Plugin Name: Member payment report
Plugin URI: http://www.michiganjaycees.org
Description: this is a report showing the payments that have processed
Author: Dan Moellering
Version: .1
Author URI: http://mdmnow.com
*/
add_action('admin_menu', 'member_payment_report_action');
@greathmaster
greathmaster / custom-level-confirmation-message-for-pmpro-approvals.php
Created December 12, 2017 03:05
Keep the custom messages set for each level under Membership >> Membership Levels and combine it with the PMPro Approvals status.
function modify_status_from_confirmation_message($confirmation_message, $pmpro_invoice)
{
global $current_user, $wpdb;
$approval_status = null;
if(class_exists('PMPro_Approvals'))
$approval_status = PMPro_Approvals::getUserApprovalStatus();
if(!empty($approval_status))
@andrewlimaza
andrewlimaza / pmpro_approval_check_approved.php
Created August 25, 2017 09:32
Check if a Paid Memberships Pro user is pending or denied.
<?php
//General code example for checking if a current user is pending or not.
global $current_user;
//check to see if the user has any membership level
if( pmpro_hasMembershipLevel() ) {
// Get the current user ID and their level ID for the PMPro Approvals meta.
@strangerstudios
strangerstudios / my_option_pmpro_sslseal.php
Created July 13, 2017 20:53
Add Custom SSL Seal to PMPro Checkout Page, Including SCRIPT Tags
/*
Add SSL Seal to PMPro Checkout Page
Add this code to a custom plugin or your active theme's functions.php.
Custom code is necessary for this now that PMPro 1.9.3 for security reasons
doesn't allow script tags in the SSL Seal setting text area.
The example below is for an AlphaSSL certificate. Replace the $seal string below with
your own seals code. Be careful if the seal has single quotes in it.