This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: PMPro Register Helper Examples | |
* Description: Add this to your PMPro Customizations folder and then activate the plugin from your dashboard. | |
* Author: pbrocks | |
* Version: 1.3 | |
* Author URI: https://github.com/pbrocks | |
* Add this to a Customizations Plugin and customize to suit your needs | |
*/ | |
function initialize_pmprorh_fields1() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* In your active theme create the folder `/paid-memberships-pro/pmpro-member-directory/` and save the code from this gist in a file called `directory.php`. | |
* This shortcode will display the members list and additional content based on the defined attributes. | |
*/ | |
function pmpromd_shortcode( $atts, $content = null, $code = '' ) { | |
// $atts ::= array of attributes | |
// $content ::= text within enclosing form of shortcode element | |
// $code ::= the shortcode found, when == callback name | |
// examples: [pmpro_member_directory show_avatar="false" show_email="false" levels="1,2"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php // do not include in Customizations plugin | |
/** | |
* Redirect to the levels page when users try to access protected files in PMPro. | |
* | |
* Add this code to your customizations plugin file. | |
* | |
* Learn about protecting files with PMPro here: | |
* https://www.paidmembershipspro.com/locking-down-protecting-files-with-pmpro/ | |
*/ | |
function my_pmpro_getfile_before_error( $filename ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php // Do not include in Customizations plugin | |
/** | |
* Code creates new column for Memberslist and Memberlist CSV export | |
* | |
* Add to a PMPro Customizations plugin | |
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function pmpro_memberslist_extra_col_header() { ?> | |
<th><?php _e( 'Last Login', 'pmpro' ); ?></th> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(document).ready(function($) { | |
var label = $('label[for=hidden_check]'); | |
$(label).hide(); | |
$('#date_check').click(function() { | |
if($('#date_check').is(':checked')) { | |
$(label).css('color','salmon').show(); | |
$('input[name=hidden_check]').val('1'); | |
} else { | |
$(label).hide(); | |
$('input[name=hidden_check]').val('0'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php // Do not include in PMPro Customizations plugin | |
/** | |
* Add a conditional Register Helper field with a checkbox that needs to be checked in order to show a Date field. | |
*/ | |
function initialize_conditional_dob() { | |
if ( ! function_exists( 'pmprorh_add_registration_field' ) ) { | |
return false; | |
} | |
// define the fields | |
$fields = array(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php // Do not include this or the doc block if adding to a Customizations plugin | |
/** | |
* Add this to its own folder in your plugins directory or copy the code below this doc block to a Customizations Plugin and customize to suit your needs. | |
* | |
* Plugin Name: PMPro Register Helper Examples | |
* Description: Create a folder name in your plugins' folder with the same name as this filename, but without the .php extension. Save this file in that folder and then you can activate this plugin in your WordPress dashboard, | |
* Author: pbrocks | |
* Author URI: https://github.com/pbrocks | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* This example is to show you the 'niche' options each Paid Memberships Pro - Register Helper Add-on field can take and how to use it. | |
* | |
* Add this to a Customizations Plugin and customize to suit your needs | |
*/ | |
function initialize_pmprorh_fields() { | |
// don't break if Register Helper is not loaded | |
if ( ! function_exists( 'pmprorh_add_registration_field' ) ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php // Do not copy this tag. | |
/** | |
* Use the shortcode [membership-level] to display the user's current membership level. | |
* | |
* Copy the function below into your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
/** | |
* pmpro_membership_level_shortcode Function to create the new [membership-level] shortcode | |
* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php // Do not include in your Customizations Plugin | |
/** | |
* Check the default bbPress role associated with a level and then assign it to a new member during PMPro checkout. | |
*/ | |
add_action( 'pmpro_after_checkout', 'pmpro_add_forum_role', 11 ); | |
function pmpro_add_forum_role( $user_id ) { | |
// $member_data = get_userdata( $user_object->ID ); | |
$member_object = pmpro_getMembershipLevelForUser( $user_id ); | |
$level_id = $member_object->id; |