Skip to content

Instantly share code, notes, and snippets.

View andrewlimaza's full-sized avatar

Andrew Lima andrewlimaza

View GitHub Profile
@andrewlimaza
andrewlimaza / rh-three-fields
Created March 29, 2016 13:55
Add three custom fields using Register Helper Addon
function my_pmprorh_init()
{
//don't break if Register Helper is not loaded
if(!function_exists("pmprorh_add_registration_field"))
{
return false;
}
//define the fields
$fields = array();
$fields[] = new PMProRH_Field(
@andrewlimaza
andrewlimaza / mailing-information.php
Last active April 5, 2016 19:04
PMPro Register Helper - Mailing information fields
function my_pmprorh_init()
{
//create a checkout box
pmprorh_add_checkout_box("mailing_info", "Mailing Details", "This description is optional");
//don't break if Register Helper is not loaded
if(!function_exists("pmprorh_add_registration_field"))
{
return false;
}
@andrewlimaza
andrewlimaza / pmpro-customfields-level.php
Last active April 13, 2016 17:06
PMPRO - Only show custom fields to specific membership level for checkout.
<?php
// Copy Lines 5 - 32 to your functions.php of your theme or custom plugin
function my_pmprorh_init()
{
//don't break if Register Helper is not loaded
if(!function_exists("pmprorh_add_registration_field"))
{
return false;
@andrewlimaza
andrewlimaza / my_pmpro_hide_wp_feed.php
Created June 2, 2016 14:26
Hide PMPro activity feed for non-admins
<?php
//copy lines 5 - 14 into your active theme's functions.php or custom plugin.
function my_pmpro_remove_dashboard_widget(){
//check if user is not admin, then remove meta boxed
if( !current_user_can('manage_options') ) {
//remove default WP dashboard activity
remove_meta_box('dashboard_activity', 'dashboard', 'normal');
//remove PMPRO dashboard activity
@andrewlimaza
andrewlimaza / pmpro-rh-only-admin-eg.php
Created June 21, 2016 14:21
PMPRO Register Helper Add On "only_admin" example
<?php
//copy lines 5-29 into your active theme's functions.php or custom plugin
function my_pmprorh_init()
{
//don't break if Register Helper is not loaded
if(!function_exists("pmprorh_add_registration_field"))
{
return false;
<?php
//Copy from line 5 down and add to custom plugin/active theme's functions.php
function my_pmprorh_init()
{
//don't break if Register Helper is not loaded
if(!function_exists("pmprorh_add_registration_field"))
{
return false;
@andrewlimaza
andrewlimaza / my_pmpro_custom_countries.php
Last active July 15, 2016 15:05
Show certain countries for Paid Memberships Pro Checkout
<?php
//copy lines 5 down into your custom plugin (http://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/)
function pmproc_custom_countries( $pmpro_countries ){
//create a list of countries you would like to show
$pmpro_countries = array(
//refer to https://github.com/strangerstudios/paid-memberships-pro/blob/v1.7.8.1/includes/countries.php#L259 for a list of countries
'AD' => 'Andorra',
'AE' => 'United Arab Emirates',
@andrewlimaza
andrewlimaza / pmproc_custom_menu_load.php
Created July 18, 2016 13:21
Show a different menu for logged out users in WordPress.
<?php
//copy and paste lines 5 onwards into your customized plugin/functions.php file -> Create a custom plugin here: http://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
function pmproc_custom_menu( $args = '' ) {
if( is_user_logged_in() ) {
$args['menu'] = 'logged-in-menu'; //name of the logged in menu
} else {
$args['menu'] = 'logged-out-menu'; //name of the logged out menu
@andrewlimaza
andrewlimaza / pmproc_change_my_text.php
Created July 18, 2016 14:07
Change text for 'View and Print Membership Card'
<?php
//copy lines 5 onwards into your 'PMPro Customizations' plugin - http://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
function pmproc_change_my_text( $translated_text, $text, $domain ) {
switch ( $translated_text ) {
case 'View and Print Membership Card' :
@andrewlimaza
andrewlimaza / pmproc_change_level_text.php
Created July 20, 2016 13:38
change text for levels page if user is logged in and general text changes - Paid Memberships Pro
<?php
//Copy lines 5 onwards into your custom PMPro plugin -> http://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
function pmproc_change_level_text( $translated_text, $text, $domain ) {
if( pmpro_hasMembershipLevel() && is_user_logged_in()){
switch ( $translated_text ){
case 'Select' :